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