Moving docs tree to docs-xml to make room for generated docs in the release tarball.
[ira/wip.git] / docs-xml / Samba3-Developers-Guide / rpc_plugin.xml
1 <?xml version="1.0" encoding="iso-8859-1"?>
2 <!DOCTYPE chapter PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
3 <chapter id="rpc-plugin">
4 <chapterinfo>
5         <author>
6                 <firstname>Anthony</firstname><surname>Liguori</surname>
7                 <affiliation>
8                         <orgname>IBM</orgname>
9                         <address><email>aliguor@us.ibm.com</email></address>
10                 </affiliation>
11         </author>
12         <author>
13                 <firstname>Jelmer</firstname><surname>Vernooij</surname>
14                 <affiliation>
15                         <orgname>Samba Team</orgname>
16                         <address><email>jelmer@samba.org</email></address>
17                 </affiliation>
18         </author>
19         <pubdate>January 2003</pubdate>
20 </chapterinfo>
21
22 <title>RPC Pluggable Modules</title>
23
24 <sect1>
25 <title>About</title>
26
27 <para>
28 This document describes how to make use the new RPC Pluggable Modules features
29 of Samba 3.0.  This architecture was added to increase the maintainability of
30 Samba allowing RPC Pipes to be worked on separately from the main CVS branch.
31 The RPM architecture will also allow third-party vendors to add functionality
32 to Samba through plug-ins.
33 </para>
34
35 </sect1>
36
37 <sect1>
38 <title>General Overview</title>
39
40 <para>
41 When an RPC call is sent to smbd, smbd tries to load a shared library by the
42 name <filename>librpc_&lt;pipename&gt;.so</filename> to handle the call if
43 it doesn't know how to handle the call internally.  For instance, LSA calls
44 are handled by <filename>librpc_lsass.so</filename>..
45 These shared libraries should be located in the <filename>&lt;sambaroot&gt;/lib/rpc</filename>.  smbd then attempts to call the init_module function within
46 the shared library. Check the chapter on modules for more information.
47 </para>
48
49 <para>
50 In the init_module function, the library should call 
51 rpc_pipe_register_commands().  This function takes the following arguments:
52 </para>
53
54 <para><programlisting>
55 NTSTATUS rpc_pipe_register_commands(int version, const char *clnt, const char *srv,
56                                const struct api_struct *cmds, int size);
57 </programlisting></para>
58
59 <variablelist>
60
61 <varlistentry><term>version</term>
62 <listitem><para>Version number of the RPC interface. Use the define <emphasis>SMB_RPC_INTERFACE_VERSION</emphasis> for this 
63 argument.</para></listitem>
64 </varlistentry>
65                 
66 <varlistentry><term>clnt</term>
67 <listitem><para>the Client name of the named pipe</para></listitem>
68 </varlistentry>
69
70 <varlistentry><term>srv</term>
71 <listitem><para>the Server name of the named pipe</para></listitem>
72 </varlistentry>
73
74 <varlistentry><term>cmds</term>
75 <listitem><para>a list of api_structs that map RPC ordinal numbers to function calls</para></listitem>
76 </varlistentry>
77
78 <varlistentry><term>size</term>
79 <listitem><para>the number of api_structs contained in cmds</para></listitem>
80 </varlistentry>
81
82 </variablelist>
83
84 <para>
85 See rpc_server/srv_reg.c and rpc_server/srv_reg_nt.c for a small example of
86 how to use this library.
87 </para>
88
89 </sect1>
90 </chapter>