- Timestamp:
- Mar 1, 2010, 3:05:48 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/samba-3.3.x/docs/htmldocs/Samba3-Developers-Guide/devprinting.html
r368 r411 1 <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Chapter 15. Samba Printing Internals</title><link rel="stylesheet" href="../samba.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.7 5.2"><link rel="home" href="index.html" title="SAMBA Developers Guide"><link rel="up" href="pt04.html" title="Part IV. Debugging and tracing"><link rel="prev" href="tracing.html" title="Chapter 14. Tracing samba system calls"><link rel="next" href="pt05.html" title="Part V. Appendices"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 15. Samba Printing Internals</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="tracing.html">Prev</a> </td><th width="60%" align="center">Part IV. Debugging and tracing</th><td width="20%" align="right"> <a accesskey="n" href="pt05.html">Next</a></td></tr></table><hr></div><div class="chapter" title="Chapter 15. Samba Printing Internals"><div class="titlepage"><div><div><h2 class="title"><a name="devprinting"></a>Chapter 15. Samba Printing Internals</h2></div><div><div class="author"><h3 class="author"><span class="firstname">Gerald</span> <span class="surname">Carter</span></h3></div></div><div><p class="pubdate">October 2002</p></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="devprinting.html#id2567455">Abstract</a></span></dt><dt><span class="sect1"><a href="devprinting.html#id2567467">1 <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Chapter 15. Samba Printing Internals</title><link rel="stylesheet" href="../samba.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.74.0"><link rel="home" href="index.html" title="SAMBA Developers Guide"><link rel="up" href="pt04.html" title="Part IV. Debugging and tracing"><link rel="prev" href="tracing.html" title="Chapter 14. Tracing samba system calls"><link rel="next" href="pt05.html" title="Part V. Appendices"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 15. Samba Printing Internals</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="tracing.html">Prev</a> </td><th width="60%" align="center">Part IV. Debugging and tracing</th><td width="20%" align="right"> <a accesskey="n" href="pt05.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="devprinting"></a>Chapter 15. Samba Printing Internals</h2></div><div><div class="author"><h3 class="author"><span class="firstname">Gerald</span> <span class="surname">Carter</span></h3></div></div><div><p class="pubdate">October 2002</p></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="devprinting.html#id2561382">Abstract</a></span></dt><dt><span class="sect1"><a href="devprinting.html#id2561395"> 2 2 Printing Interface to Various Back ends 3 </a></span></dt><dt><span class="sect1"><a href="devprinting.html#id256 7544">3 </a></span></dt><dt><span class="sect1"><a href="devprinting.html#id2561471"> 4 4 Print Queue TDB's 5 </a></span></dt><dt><span class="sect1"><a href="devprinting.html#id256 7717">5 </a></span></dt><dt><span class="sect1"><a href="devprinting.html#id2561645"> 6 6 ChangeID and Client Caching of Printer Information 7 </a></span></dt><dt><span class="sect1"><a href="devprinting.html#id256 7728">7 </a></span></dt><dt><span class="sect1"><a href="devprinting.html#id2561655"> 8 8 Windows NT/2K Printer Change Notify 9 </a></span></dt></dl></div><div class="sect1" title="Abstract"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2567455"></a>Abstract</h2></div></div></div><p>9 </a></span></dt></dl></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2561382"></a>Abstract</h2></div></div></div><p> 10 10 The purpose of this document is to provide some insight into 11 11 Samba's printing functionality and also to describe the semantics 12 12 of certain features of Windows client printing. 13 </p></div><div class="sect1" title="Printing Interface to Various Back ends"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2567467"></a>13 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2561395"></a> 14 14 Printing Interface to Various Back ends 15 15 </h2></div></div></div><p> … … 17 17 function prototypes are defined in the <code class="varname">printif</code> structure declared 18 18 in <code class="filename">printing.h</code>. 19 </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>retrieve the contents of a print queue</p></li><li class="listitem"><p>pause the print queue</p></li><li class="listitem"><p>resume a paused print queue</p></li><li class="listitem"><p>delete a job from the queue</p></li><li class="listitem"><p>pause a job in the print queue</p></li><li class="listitem"><p>result a paused print job in the queue</p></li><li class="listitem"><p>submit a job to the print queue</p></li></ul></div><p>19 </p><div class="itemizedlist"><ul type="disc"><li><p>retrieve the contents of a print queue</p></li><li><p>pause the print queue</p></li><li><p>resume a paused print queue</p></li><li><p>delete a job from the queue</p></li><li><p>pause a job in the print queue</p></li><li><p>result a paused print job in the queue</p></li><li><p>submit a job to the print queue</p></li></ul></div><p> 20 20 Currently there are only two printing back end implementations 21 21 defined. 22 </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>a generic set of functions for working with standard UNIX23 printing subsystems</p></li><li class="listitem"><p>a set of CUPS specific functions (this is only enabled if24 the CUPS libraries were located at compile time).</p></li></ul></div></div><div class="sect1" title="Print Queue TDB's"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2567544"></a>22 </p><div class="itemizedlist"><ul type="disc"><li><p>a generic set of functions for working with standard UNIX 23 printing subsystems</p></li><li><p>a set of CUPS specific functions (this is only enabled if 24 the CUPS libraries were located at compile time).</p></li></ul></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2561471"></a> 25 25 Print Queue TDB's 26 26 </h2></div></div></div><p> … … 78 78 When updating a print queue, smbd will perform the following 79 79 steps ( refer to <code class="filename">print.c:print_queue_update()</code> ): 80 </p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>Check to see if another smbd is currently in80 </p><div class="orderedlist"><ol type="1"><li><p>Check to see if another smbd is currently in 81 81 the process of updating the queue contents by checking the pid 82 82 stored in <code class="constant">LOCK/<em class="replaceable"><code>printer_name</code></em></code>. 83 If so, then do not update the TDB.</p></li><li class="listitem"><p>Lock the mutex entry in the TDB and store our own pid.84 Check that this succeeded, else fail.</p></li><li class="listitem"><p>Store the updated time stamp for the new cache85 listing</p></li><li class="listitem"><p>Retrieve the queue listing via "lpq command"</p></li><li class="listitem"><pre class="programlisting">83 If so, then do not update the TDB.</p></li><li><p>Lock the mutex entry in the TDB and store our own pid. 84 Check that this succeeded, else fail.</p></li><li><p>Store the updated time stamp for the new cache 85 listing</p></li><li><p>Retrieve the queue listing via "lpq command"</p></li><li><pre class="programlisting"> 86 86 foreach job in the queue 87 87 { … … 95 95 update the job status only 96 96 } 97 }</pre></li><li class="listitem"><p>Delete any jobs in the TDB that are not98 in the in the lpq listing</p></li><li class="listitem"><p>Store the print queue status in the TDB</p></li><li class="listitem"><p>update the cache time stamp again</p></li></ol></div><p>97 }</pre></li><li><p>Delete any jobs in the TDB that are not 98 in the in the lpq listing</p></li><li><p>Store the print queue status in the TDB</p></li><li><p>update the cache time stamp again</p></li></ol></div><p> 99 99 Note that it is the contents of this TDB that is returned to Windows 100 100 clients and not the actual listing from the "lpq command". … … 111 111 queue TDB. Otherwise, the Device Mode is obtained from the printer 112 112 object when the client issues a GetJob(level == 2) request. 113 </p></div><div class="sect1" title="ChangeID and Client Caching of Printer Information"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2567717"></a>113 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2561645"></a> 114 114 ChangeID and Client Caching of Printer Information 115 115 </h2></div></div></div><p> 116 116 [To be filled in later] 117 </p></div><div class="sect1" title="Windows NT/2K Printer Change Notify"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2567728"></a>117 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2561655"></a> 118 118 Windows NT/2K Printer Change Notify 119 119 </h2></div></div></div><p> … … 128 128 </p><p> 129 129 The basic set of RPC's used to implement change notification are 130 </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>RemoteFindFirstPrinterChangeNotifyEx ( RFFPCN )</p></li><li class="listitem"><p>RemoteFindNextPrinterChangeNotifyEx ( RFNPCN )</p></li><li class="listitem"><p>FindClosePrinterChangeNotify( FCPCN )</p></li><li class="listitem"><p>ReplyOpenPrinter</p></li><li class="listitem"><p>ReplyClosePrinter</p></li><li class="listitem"><p>RouteRefreshPrinterChangeNotify ( RRPCN )</p></li></ul></div><p>130 </p><div class="itemizedlist"><ul type="disc"><li><p>RemoteFindFirstPrinterChangeNotifyEx ( RFFPCN )</p></li><li><p>RemoteFindNextPrinterChangeNotifyEx ( RFNPCN )</p></li><li><p>FindClosePrinterChangeNotify( FCPCN )</p></li><li><p>ReplyOpenPrinter</p></li><li><p>ReplyClosePrinter</p></li><li><p>RouteRefreshPrinterChangeNotify ( RRPCN )</p></li></ul></div><p> 131 131 One additional RPC is available to a server, but is never used by the 132 132 Windows spooler service: 133 </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>RouteReplyPrinter()</p></li></ul></div><p>133 </p><div class="itemizedlist"><ul type="disc"><li><p>RouteReplyPrinter()</p></li></ul></div><p> 134 134 The opnum for all of these RPC's are defined in include/rpc_spoolss.h 135 135 </p><p> … … 173 173 The current list of notification events supported by Samba can be 174 174 found by examining the internal tables in srv_spoolss_nt.c 175 </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>printer_notify_table[]</p></li><li class="listitem"><p>job_notify_table[]</p></li></ul></div><p>175 </p><div class="itemizedlist"><ul type="disc"><li><p>printer_notify_table[]</p></li><li><p>job_notify_table[]</p></li></ul></div><p> 176 176 When an event occurs that could be monitored, smbd sends a message 177 177 to itself about the change. The list of events to be transmitted … … 193 193 The actual change notification is performed using the RRPCN request 194 194 RPC. This packet contains 195 </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>the printer handle registered with the196 client's spooler on which the change occurred</p></li><li class="listitem"><p>The change_low value which was sent as part197 of the last RFNPCN request from the client</p></li><li class="listitem"><p>The SPOOL_NOTIFY_INFO container with the event195 </p><div class="itemizedlist"><ul type="disc"><li><p>the printer handle registered with the 196 client's spooler on which the change occurred</p></li><li><p>The change_low value which was sent as part 197 of the last RFNPCN request from the client</p></li><li><p>The SPOOL_NOTIFY_INFO container with the event 198 198 information</p></li></ul></div><p> 199 199 A <code class="varname">SPOOL_NOTIFY_INFO</code> contains: 200 </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>the version and flags field are predefined201 and should not be changed</p></li><li class="listitem"><p>The count field is the number of entries200 </p><div class="itemizedlist"><ul type="disc"><li><p>the version and flags field are predefined 201 and should not be changed</p></li><li><p>The count field is the number of entries 202 202 in the SPOOL_NOTIFY_INFO_DATA array</p></li></ul></div><p> 203 203 The <code class="varname">SPOOL_NOTIFY_INFO_DATA</code> entries contain: 204 </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>The type defines whether or not this event205 is for a printer or a print job</p></li><li class="listitem"><p>The field is the flag identifying the event</p></li><li class="listitem"><p>the notify_data union contains the new valuie of the206 attribute</p></li><li class="listitem"><p>The enc_type defines the size of the structure for marshalling207 and unmarshalling</p></li><li class="listitem"><p>(a) the id must be 0 for a printer event on a printer handle.204 </p><div class="itemizedlist"><ul type="disc"><li><p>The type defines whether or not this event 205 is for a printer or a print job</p></li><li><p>The field is the flag identifying the event</p></li><li><p>the notify_data union contains the new valuie of the 206 attribute</p></li><li><p>The enc_type defines the size of the structure for marshalling 207 and unmarshalling</p></li><li><p>(a) the id must be 0 for a printer event on a printer handle. 208 208 (b) the id must be the job id for an event on a printer job 209 209 (c) the id must be the matching number of the printer index used … … 211 211 handle for notification. Samba currently uses the snum of 212 212 the printer for this which can break if the list of services 213 has been modified since the notification handle was registered.</p></li><li class="listitem"><p>The size is either (a) the string length in UNICODE for strings,213 has been modified since the notification handle was registered.</p></li><li><p>The size is either (a) the string length in UNICODE for strings, 214 214 (b) the size in bytes of the security descriptor, or (c) 0 for 215 215 data values.</p></li></ul></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="tracing.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="pt04.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="pt05.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 14. Tracing samba system calls </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Part V. Appendices</td></tr></table></div></body></html>
Note:
See TracChangeset
for help on using the changeset viewer.