3
<title>MAPIProxy 2.0 API Documentation</title>
4
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
5
<link href="apidocs.css" rel="stylesheet" type="text/css"/>
9
<div class="header"></div>
10
<div id="middle_side">
11
<div id="right_side_home">
12
<!-- Generated by Doxygen 1.8.1.2 -->
13
<div id="navrow1" class="tabs">
15
<li><a href="index.html"><span>Main Page</span></a></li>
16
<li><a href="pages.html"><span>Related Pages</span></a></li>
17
<li><a href="annotated.html"><span>Data Structures</span></a></li>
18
<li class="current"><a href="files.html"><span>Files</span></a></li>
21
<div id="navrow2" class="tabs2">
23
<li><a href="files.html"><span>File List</span></a></li>
24
<li><a href="globals.html"><span>Globals</span></a></li>
27
<div id="nav-path" class="navpath">
29
<li class="navelem"><a class="el" href="dir_4f343f6bd7925b18a2c3c13737f093b9.html">mapiproxy</a></li><li class="navelem"><a class="el" href="dir_4c35cb2dde09236b6b5ef740a040f283.html">modules</a></li> </ul>
34
<a href="#func-members">Functions</a> </div>
35
<div class="headertitle">
36
<div class="title">mpm_cache.c File Reference</div> </div>
38
<div class="contents">
40
<p>Cache messages and attachments so we can reduce WAN traffic.
41
<a href="#details">More...</a></p>
42
<div class="textblock"><code>#include "libmapi/libmapi.h"</code><br/>
43
<code>#include "libmapi/libmapi_private.h"</code><br/>
44
<code>#include "mapiproxy/dcesrv_mapiproxy.h"</code><br/>
45
<code>#include "mapiproxy/libmapiproxy/libmapiproxy.h"</code><br/>
46
<code>#include "mapiproxy/modules/mpm_cache.h"</code><br/>
47
</div><table class="memberdecls">
48
<tr class="heading"><td colspan="2"><h2><a name="func-members"></a>
49
Functions</h2></td></tr>
50
<tr class="memitem:a9bb6adf0b5f931b4ae40ccad991e8413"><td class="memItemLeft" align="right" valign="top">static NTSTATUS </td><td class="memItemRight" valign="bottom"><a class="el" href="mpm__cache_8c.html#a9bb6adf0b5f931b4ae40ccad991e8413">cache_dispatch</a> (struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r, struct mapiproxy *mapiproxy)</td></tr>
51
<tr class="memitem:aac46f4aa8bbafcc2e6b840e94f136741"><td class="memItemLeft" align="right" valign="top">static void </td><td class="memItemRight" valign="bottom"><a class="el" href="mpm__cache_8c.html#aac46f4aa8bbafcc2e6b840e94f136741">cache_dump_stream_stat</a> (struct <a class="el" href="structmpm__stream.html">mpm_stream</a> *stream)</td></tr>
52
<tr class="memitem:ac7834a5d736527505f5236e1fd51e77c"><td class="memItemLeft" align="right" valign="top">static NTSTATUS </td><td class="memItemRight" valign="bottom"><a class="el" href="mpm__cache_8c.html#ac7834a5d736527505f5236e1fd51e77c">cache_exec_sync_cmd</a> (struct <a class="el" href="structmpm__stream.html">mpm_stream</a> *stream)</td></tr>
53
<tr class="memitem:a343229637fac85431053d3a3fbce7568"><td class="memItemLeft" align="right" valign="top">static uint32_t </td><td class="memItemRight" valign="bottom"><a class="el" href="mpm__cache_8c.html#a343229637fac85431053d3a3fbce7568">cache_find_call_request_index</a> (uint8_t opnum, struct EcDoRpc_MAPI_REQ *mapi_req)</td></tr>
54
<tr class="memitem:a99a578fd0130e064c931b1bb52efa57c"><td class="memItemLeft" align="right" valign="top">static NTSTATUS </td><td class="memItemRight" valign="bottom"><a class="el" href="mpm__cache_8c.html#a99a578fd0130e064c931b1bb52efa57c">cache_init</a> (struct dcesrv_context *dce_ctx)</td></tr>
55
<tr class="memitem:afe28f63dd454143cf60ae816d86c65dc"><td class="memItemLeft" align="right" valign="top">static NTSTATUS </td><td class="memItemRight" valign="bottom"><a class="el" href="mpm__cache_8c.html#afe28f63dd454143cf60ae816d86c65dc">cache_pull</a> (struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r)</td></tr>
56
<tr class="memitem:a7b80896ecf38bb5304c5b44d8961da49"><td class="memItemLeft" align="right" valign="top">static NTSTATUS </td><td class="memItemRight" valign="bottom"><a class="el" href="mpm__cache_8c.html#a7b80896ecf38bb5304c5b44d8961da49">cache_pull_OpenAttach</a> (struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct EcDoRpc_MAPI_REQ mapi_req, struct EcDoRpc *EcDoRpc)</td></tr>
57
<tr class="memitem:af1c79ca9103ed25a4e49f79dad94a94f"><td class="memItemLeft" align="right" valign="top">static NTSTATUS </td><td class="memItemRight" valign="bottom"><a class="el" href="mpm__cache_8c.html#af1c79ca9103ed25a4e49f79dad94a94f">cache_pull_OpenMessage</a> (struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct OpenMessage_req request)</td></tr>
58
<tr class="memitem:a4f9f6d741698f8ee3034789b75b0b42d"><td class="memItemLeft" align="right" valign="top">static NTSTATUS </td><td class="memItemRight" valign="bottom"><a class="el" href="mpm__cache_8c.html#a4f9f6d741698f8ee3034789b75b0b42d">cache_pull_OpenStream</a> (struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct EcDoRpc_MAPI_REQ mapi_req, struct EcDoRpc *EcDoRpc)</td></tr>
59
<tr class="memitem:a1094dee68b57146db1607a2c34753407"><td class="memItemLeft" align="right" valign="top">static NTSTATUS </td><td class="memItemRight" valign="bottom"><a class="el" href="mpm__cache_8c.html#a1094dee68b57146db1607a2c34753407">cache_pull_Release</a> (struct dcesrv_call_state *dce_call, struct EcDoRpc *EcDoRpc, uint32_t handle_idx)</td></tr>
60
<tr class="memitem:a97cf4f171b4d1a84fbf4da19605fb820"><td class="memItemLeft" align="right" valign="top">static NTSTATUS </td><td class="memItemRight" valign="bottom"><a class="el" href="mpm__cache_8c.html#a97cf4f171b4d1a84fbf4da19605fb820">cache_push</a> (struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r)</td></tr>
61
<tr class="memitem:a070020d672d3850ca02df7fc92ab40d1"><td class="memItemLeft" align="right" valign="top">static NTSTATUS </td><td class="memItemRight" valign="bottom"><a class="el" href="mpm__cache_8c.html#a070020d672d3850ca02df7fc92ab40d1">cache_push_OpenAttach</a> (struct dcesrv_call_state *dce_call, struct EcDoRpc_MAPI_REQ mapi_req, struct EcDoRpc_MAPI_REPL mapi_repl, struct EcDoRpc *EcDoRpc)</td></tr>
62
<tr class="memitem:ab9d8132ba3576f237182f28bef9a9823"><td class="memItemLeft" align="right" valign="top">static NTSTATUS </td><td class="memItemRight" valign="bottom"><a class="el" href="mpm__cache_8c.html#ab9d8132ba3576f237182f28bef9a9823">cache_push_OpenMessage</a> (struct dcesrv_call_state *dce_call, struct EcDoRpc_MAPI_REQ mapi_req, struct EcDoRpc_MAPI_REPL mapi_repl, struct EcDoRpc *EcDoRpc)</td></tr>
63
<tr class="memitem:a72233358ee75eb93e39e50320980cc89"><td class="memItemLeft" align="right" valign="top">static NTSTATUS </td><td class="memItemRight" valign="bottom"><a class="el" href="mpm__cache_8c.html#a72233358ee75eb93e39e50320980cc89">cache_push_OpenStream</a> (struct dcesrv_call_state *dce_call, struct EcDoRpc_MAPI_REQ mapi_req, struct EcDoRpc_MAPI_REPL mapi_repl, struct EcDoRpc *EcDoRpc)</td></tr>
64
<tr class="memitem:a50fabb5b2ee2552ee0410557e5f816ee"><td class="memItemLeft" align="right" valign="top">static NTSTATUS </td><td class="memItemRight" valign="bottom"><a class="el" href="mpm__cache_8c.html#a50fabb5b2ee2552ee0410557e5f816ee">cache_push_ReadStream</a> (struct dcesrv_call_state *dce_call, struct EcDoRpc_MAPI_REQ mapi_req, struct EcDoRpc_MAPI_REPL mapi_repl, struct EcDoRpc *EcDoRpc)</td></tr>
65
<tr class="memitem:ab1730cf1108b8fda2c0d0a25b3a5133e"><td class="memItemLeft" align="right" valign="top">NTSTATUS </td><td class="memItemRight" valign="bottom"><a class="el" href="mpm__cache_8c.html#ab1730cf1108b8fda2c0d0a25b3a5133e">samba_init_module</a> (void)</td></tr>
67
<a name="details" id="details"></a><h2>Detailed Description</h2>
68
<div class="textblock"><p>Cache messages and attachments so we can reduce WAN traffic. </p>
69
</div><h2>Function Documentation</h2>
70
<a class="anchor" id="a9bb6adf0b5f931b4ae40ccad991e8413"></a>
72
<div class="memproto">
73
<table class="mlabels">
75
<td class="mlabels-left">
76
<table class="memname">
78
<td class="memname">static NTSTATUS cache_dispatch </td>
80
<td class="paramtype">struct dcesrv_call_state * </td>
81
<td class="paramname"><em>dce_call</em>, </td>
84
<td class="paramkey"></td>
86
<td class="paramtype">TALLOC_CTX * </td>
87
<td class="paramname"><em>mem_ctx</em>, </td>
90
<td class="paramkey"></td>
92
<td class="paramtype">void * </td>
93
<td class="paramname"><em>r</em>, </td>
96
<td class="paramkey"></td>
98
<td class="paramtype">struct mapiproxy * </td>
99
<td class="paramname"><em>mapiproxy</em> </td>
108
<td class="mlabels-right">
109
<span class="mlabels"><span class="mlabel">static</span></span> </td>
112
</div><div class="memdoc">
113
<p>Dispatch function.</p>
114
<p>This function avoids calling dcerpc_ndr_request - understand forwarding client request to remove server - when the client is reading a message/attachment stream available in the cache.</p>
115
<p>This function can also be used to loop over dcerpc_ndr_request and perform a read-ahead operation.</p>
116
<dl class="params"><dt>Parameters</dt><dd>
117
<table class="params">
118
<tr><td class="paramname">dce_call</td><td>the session context </td></tr>
119
<tr><td class="paramname">mem_ctx</td><td>the memory context </td></tr>
120
<tr><td class="paramname">r</td><td>pointer on EcDoRpc operation </td></tr>
121
<tr><td class="paramname">mapiproxy</td><td>pointer to a mapiproxy structure controlling mapiproxy behavior.</td></tr>
125
<dl class="section return"><dt>Returns</dt><dd>NT_STATUS_OK </dd></dl>
127
<p>References <a class="el" href="mpm__cache_8c.html#aac46f4aa8bbafcc2e6b840e94f136741">cache_dump_stream_stat()</a>, <a class="el" href="mpm__cache__stream_8c.html#a142a0bfc3a59bf5eec9b020987e36557">mpm_cache_stream_read()</a>, <a class="el" href="mpm__cache__stream_8c.html#a2f3ef6ff42c705a117bad6dc0cb642a0">mpm_cache_stream_reset()</a>, <a class="el" href="mpm__cache__stream_8c.html#a6e6b36fee79d3f8505f2fdaa0ad994ba">mpm_cache_stream_write()</a>, and <a class="el" href="dcesrv__mapiproxy__session_8c.html#a27de5ee88fd54850ea413e20774029b0">mpm_session_cmp()</a>.</p>
129
<p>Referenced by <a class="el" href="mpm__cache_8c.html#ab1730cf1108b8fda2c0d0a25b3a5133e">samba_init_module()</a>.</p>
133
<a class="anchor" id="aac46f4aa8bbafcc2e6b840e94f136741"></a>
134
<div class="memitem">
135
<div class="memproto">
136
<table class="mlabels">
138
<td class="mlabels-left">
139
<table class="memname">
141
<td class="memname">static void cache_dump_stream_stat </td>
143
<td class="paramtype">struct <a class="el" href="structmpm__stream.html">mpm_stream</a> * </td>
144
<td class="paramname"><em>stream</em></td><td>)</td>
149
<td class="mlabels-right">
150
<span class="mlabels"><span class="mlabel">static</span></span> </td>
153
</div><div class="memdoc">
154
<p>Dump time statistic between OpenStream and Release</p>
155
<p>This function monitors the effective time required to open, read and close a stream.</p>
156
<dl class="params"><dt>Parameters</dt><dd>
157
<table class="params">
158
<tr><td class="paramname">stream</td><td>the <a class="el" href="structmpm__stream.html" title="A stream can either be for a message or attachment.">mpm_stream</a> entry </td></tr>
163
<p>Referenced by <a class="el" href="mpm__cache_8c.html#a9bb6adf0b5f931b4ae40ccad991e8413">cache_dispatch()</a>, and <a class="el" href="mpm__cache_8c.html#a50fabb5b2ee2552ee0410557e5f816ee">cache_push_ReadStream()</a>.</p>
167
<a class="anchor" id="ac7834a5d736527505f5236e1fd51e77c"></a>
168
<div class="memitem">
169
<div class="memproto">
170
<table class="mlabels">
172
<td class="mlabels-left">
173
<table class="memname">
175
<td class="memname">static NTSTATUS cache_exec_sync_cmd </td>
177
<td class="paramtype">struct <a class="el" href="structmpm__stream.html">mpm_stream</a> * </td>
178
<td class="paramname"><em>stream</em></td><td>)</td>
183
<td class="mlabels-right">
184
<span class="mlabels"><span class="mlabel">static</span></span> </td>
187
</div><div class="memdoc">
189
<li>close the existing FILE *</li>
190
<li>build complete file path</li>
191
<li>replace <b>FILE</b> arguments with complete file path</li>
193
<li>stat the sync'd file</li>
194
<li>open the stream again</li>
195
<li>mark the file as cached</li>
197
<dl class="params"><dt>Parameters</dt><dd>
198
<table class="params">
199
<tr><td class="paramname">stream</td><td>pointer on the <a class="el" href="structmpm__stream.html" title="A stream can either be for a message or attachment.">mpm_stream</a> entry </td></tr>
204
<p>References <a class="el" href="mpm__cache__stream_8c.html#a724182ad6610fe42a5667ffa389a4b06">mpm_cache_stream_close()</a>, and <a class="el" href="mpm__cache__stream_8c.html#a1be8742bfcbebf3f1e58eab1a7b6010a">mpm_cache_stream_open()</a>.</p>
206
<p>Referenced by <a class="el" href="mpm__cache_8c.html#a50fabb5b2ee2552ee0410557e5f816ee">cache_push_ReadStream()</a>.</p>
210
<a class="anchor" id="a343229637fac85431053d3a3fbce7568"></a>
211
<div class="memitem">
212
<div class="memproto">
213
<table class="mlabels">
215
<td class="mlabels-left">
216
<table class="memname">
218
<td class="memname">static uint32_t cache_find_call_request_index </td>
220
<td class="paramtype">uint8_t </td>
221
<td class="paramname"><em>opnum</em>, </td>
224
<td class="paramkey"></td>
226
<td class="paramtype">struct EcDoRpc_MAPI_REQ * </td>
227
<td class="paramname"><em>mapi_req</em> </td>
236
<td class="mlabels-right">
237
<span class="mlabels"><span class="mlabel">static</span></span> </td>
240
</div><div class="memdoc">
241
<p>Find the position of the given MAPI call in a serialized MAPI request.</p>
242
<p>If the request includes a Release call, then request and replies indexes for other calls will mismatch.</p>
243
<dl class="params"><dt>Parameters</dt><dd>
244
<table class="params">
245
<tr><td class="paramname">opnum</td><td>The MAPI opnum to seek </td></tr>
246
<tr><td class="paramname">mapi_req</td><td>Pointer to the MAPI request calls array</td></tr>
250
<dl class="section return"><dt>Returns</dt><dd>On success, returns the call position, otherwise -1. </dd></dl>
252
<p>Referenced by <a class="el" href="mpm__cache_8c.html#a97cf4f171b4d1a84fbf4da19605fb820">cache_push()</a>.</p>
256
<a class="anchor" id="a99a578fd0130e064c931b1bb52efa57c"></a>
257
<div class="memitem">
258
<div class="memproto">
259
<table class="mlabels">
261
<td class="mlabels-left">
262
<table class="memname">
264
<td class="memname">static NTSTATUS cache_init </td>
266
<td class="paramtype">struct dcesrv_context * </td>
267
<td class="paramname"><em>dce_ctx</em></td><td>)</td>
272
<td class="mlabels-right">
273
<span class="mlabels"><span class="mlabel">static</span></span> </td>
276
</div><div class="memdoc">
277
<p>Initialize the cache module and retrieve configuration from smb.conf</p>
278
<p>Possible smb.conf parameters: mpm_cache:database</p>
279
<dl class="params"><dt>Parameters</dt><dd>
280
<table class="params">
281
<tr><td class="paramname">dce_ctx</td><td>the session context</td></tr>
285
<dl class="section return"><dt>Returns</dt><dd>NT_STATUS_OK on success otherwise NT_STATUS_INVALID_PARAMETER, NT_STATUS_NO_MEMORY </dd></dl>
287
<p>References <a class="el" href="mpm__cache__ldb_8c.html#a50c355d12cfef14722f5c714e6369996">mpm_cache_ldb_createdb()</a>.</p>
289
<p>Referenced by <a class="el" href="mpm__cache_8c.html#ab1730cf1108b8fda2c0d0a25b3a5133e">samba_init_module()</a>.</p>
293
<a class="anchor" id="afe28f63dd454143cf60ae816d86c65dc"></a>
294
<div class="memitem">
295
<div class="memproto">
296
<table class="mlabels">
298
<td class="mlabels-left">
299
<table class="memname">
301
<td class="memname">static NTSTATUS cache_pull </td>
303
<td class="paramtype">struct dcesrv_call_state * </td>
304
<td class="paramname"><em>dce_call</em>, </td>
307
<td class="paramkey"></td>
309
<td class="paramtype">TALLOC_CTX * </td>
310
<td class="paramname"><em>mem_ctx</em>, </td>
313
<td class="paramkey"></td>
315
<td class="paramtype">void * </td>
316
<td class="paramname"><em>r</em> </td>
325
<td class="mlabels-right">
326
<span class="mlabels"><span class="mlabel">static</span></span> </td>
329
</div><div class="memdoc">
330
<p>Analyze EcDoRpc MAPI requests</p>
331
<p>This function loops over EcDoRpc MAPI calls and search for the opnums required by the cache module to monitor Stream traffic properly.</p>
332
<dl class="params"><dt>Parameters</dt><dd>
333
<table class="params">
334
<tr><td class="paramname">dce_call</td><td>the session context </td></tr>
335
<tr><td class="paramname">mem_ctx</td><td>the memory context </td></tr>
336
<tr><td class="paramname">r</td><td>generic pointer on EcDoRpc operation</td></tr>
340
<dl class="section return"><dt>Returns</dt><dd>NT_STATUS_OK </dd></dl>
342
<p>References <a class="el" href="mpm__cache_8c.html#a7b80896ecf38bb5304c5b44d8961da49">cache_pull_OpenAttach()</a>, <a class="el" href="mpm__cache_8c.html#af1c79ca9103ed25a4e49f79dad94a94f">cache_pull_OpenMessage()</a>, <a class="el" href="mpm__cache_8c.html#a4f9f6d741698f8ee3034789b75b0b42d">cache_pull_OpenStream()</a>, and <a class="el" href="mpm__cache_8c.html#a1094dee68b57146db1607a2c34753407">cache_pull_Release()</a>.</p>
344
<p>Referenced by <a class="el" href="mpm__cache_8c.html#ab1730cf1108b8fda2c0d0a25b3a5133e">samba_init_module()</a>.</p>
348
<a class="anchor" id="a7b80896ecf38bb5304c5b44d8961da49"></a>
349
<div class="memitem">
350
<div class="memproto">
351
<table class="mlabels">
353
<td class="mlabels-left">
354
<table class="memname">
356
<td class="memname">static NTSTATUS cache_pull_OpenAttach </td>
358
<td class="paramtype">struct dcesrv_call_state * </td>
359
<td class="paramname"><em>dce_call</em>, </td>
362
<td class="paramkey"></td>
364
<td class="paramtype">TALLOC_CTX * </td>
365
<td class="paramname"><em>mem_ctx</em>, </td>
368
<td class="paramkey"></td>
370
<td class="paramtype">struct EcDoRpc_MAPI_REQ </td>
371
<td class="paramname"><em>mapi_req</em>, </td>
374
<td class="paramkey"></td>
376
<td class="paramtype">struct EcDoRpc * </td>
377
<td class="paramname"><em>EcDoRpc</em> </td>
386
<td class="mlabels-right">
387
<span class="mlabels"><span class="mlabel">static</span></span> </td>
390
</div><div class="memdoc">
391
<p>Monitor OpenAttach requests and register an attachment in the mpm_messages list.</p>
392
<p>This is the first step for attachment registration. This function first ensures the attachment is not already registered, otherwise delete it. It next creates the attachment entry in the global mpm_message structure.</p>
393
<dl class="params"><dt>Parameters</dt><dd>
394
<table class="params">
395
<tr><td class="paramname">dce_call</td><td>pointer to the session context </td></tr>
396
<tr><td class="paramname">mem_ctx</td><td>the memory context </td></tr>
397
<tr><td class="paramname">mapi_req</td><td>reference to the OpenAttach EcDoRpc_MAPI_REQ entry </td></tr>
398
<tr><td class="paramname">EcDoRpc</td><td>pointer to the EcDoRpc operation</td></tr>
402
<dl class="section return"><dt>Returns</dt><dd>NT_STATUS_OK on success, otherwise NT_STATUS_NO_MEMORY </dd></dl>
404
<p>References <a class="el" href="dcesrv__mapiproxy__session_8c.html#a27de5ee88fd54850ea413e20774029b0">mpm_session_cmp()</a>, and <a class="el" href="dcesrv__mapiproxy__session_8c.html#a4f128e06425202bbc1971bf000ae2ab1">mpm_session_init()</a>.</p>
406
<p>Referenced by <a class="el" href="mpm__cache_8c.html#afe28f63dd454143cf60ae816d86c65dc">cache_pull()</a>.</p>
410
<a class="anchor" id="af1c79ca9103ed25a4e49f79dad94a94f"></a>
411
<div class="memitem">
412
<div class="memproto">
413
<table class="mlabels">
415
<td class="mlabels-left">
416
<table class="memname">
418
<td class="memname">static NTSTATUS cache_pull_OpenMessage </td>
420
<td class="paramtype">struct dcesrv_call_state * </td>
421
<td class="paramname"><em>dce_call</em>, </td>
424
<td class="paramkey"></td>
426
<td class="paramtype">TALLOC_CTX * </td>
427
<td class="paramname"><em>mem_ctx</em>, </td>
430
<td class="paramkey"></td>
432
<td class="paramtype">struct OpenMessage_req </td>
433
<td class="paramname"><em>request</em> </td>
442
<td class="mlabels-right">
443
<span class="mlabels"><span class="mlabel">static</span></span> </td>
446
</div><div class="memdoc">
447
<p>Monitor OpenMessage requests and register a message in the mpm_messages list.</p>
448
<p>This is the first step for message registration: set Folder ID and Message ID set the handle to 0xFFFFFFFF Insert the message to the list</p>
449
<dl class="params"><dt>Parameters</dt><dd>
450
<table class="params">
451
<tr><td class="paramname">dce_call</td><td>pointer to the session context </td></tr>
452
<tr><td class="paramname">mem_ctx</td><td>the memory context </td></tr>
453
<tr><td class="paramname">request</td><td>reference to the OpenMessage request</td></tr>
457
<dl class="section return"><dt>Returns</dt><dd>NT_STATUS_OK on success </dd></dl>
459
<p>References <a class="el" href="dcesrv__mapiproxy__session_8c.html#a27de5ee88fd54850ea413e20774029b0">mpm_session_cmp()</a>, and <a class="el" href="dcesrv__mapiproxy__session_8c.html#a4f128e06425202bbc1971bf000ae2ab1">mpm_session_init()</a>.</p>
461
<p>Referenced by <a class="el" href="mpm__cache_8c.html#afe28f63dd454143cf60ae816d86c65dc">cache_pull()</a>.</p>
465
<a class="anchor" id="a4f9f6d741698f8ee3034789b75b0b42d"></a>
466
<div class="memitem">
467
<div class="memproto">
468
<table class="mlabels">
470
<td class="mlabels-left">
471
<table class="memname">
473
<td class="memname">static NTSTATUS cache_pull_OpenStream </td>
475
<td class="paramtype">struct dcesrv_call_state * </td>
476
<td class="paramname"><em>dce_call</em>, </td>
479
<td class="paramkey"></td>
481
<td class="paramtype">TALLOC_CTX * </td>
482
<td class="paramname"><em>mem_ctx</em>, </td>
485
<td class="paramkey"></td>
487
<td class="paramtype">struct EcDoRpc_MAPI_REQ </td>
488
<td class="paramname"><em>mapi_req</em>, </td>
491
<td class="paramkey"></td>
493
<td class="paramtype">struct EcDoRpc * </td>
494
<td class="paramname"><em>EcDoRpc</em> </td>
503
<td class="mlabels-right">
504
<span class="mlabels"><span class="mlabel">static</span></span> </td>
507
</div><div class="memdoc">
508
<p>Monitor OpenStream requests and register a stream in the mpm_streams list.</p>
509
<p>We are only interested in monitoring streams related to attachments or messages. This is the first step for stream registration:</p>
510
<p>Look whether this stream inherits from a message or attachment Fill the stream element according to previous statement Add it to the <a class="el" href="structmpm__stream.html" title="A stream can either be for a message or attachment.">mpm_stream</a> list</p>
511
<dl class="params"><dt>Parameters</dt><dd>
512
<table class="params">
513
<tr><td class="paramname">dce_call</td><td>pointer to the session context </td></tr>
514
<tr><td class="paramname">mem_ctx</td><td>the memory context </td></tr>
515
<tr><td class="paramname">mapi_req</td><td>reference to the OpenStream MAPI request </td></tr>
516
<tr><td class="paramname">EcDoRpc</td><td>pointer to the current EcDoRpc operation</td></tr>
520
<dl class="section return"><dt>Returns</dt><dd>NT_STATUS_OK on success, otherwise NT_STATUS_NO_MEMORY </dd></dl>
522
<p>References <a class="el" href="dcesrv__mapiproxy__session_8c.html#a27de5ee88fd54850ea413e20774029b0">mpm_session_cmp()</a>, and <a class="el" href="dcesrv__mapiproxy__session_8c.html#a4f128e06425202bbc1971bf000ae2ab1">mpm_session_init()</a>.</p>
524
<p>Referenced by <a class="el" href="mpm__cache_8c.html#afe28f63dd454143cf60ae816d86c65dc">cache_pull()</a>.</p>
528
<a class="anchor" id="a1094dee68b57146db1607a2c34753407"></a>
529
<div class="memitem">
530
<div class="memproto">
531
<table class="mlabels">
533
<td class="mlabels-left">
534
<table class="memname">
536
<td class="memname">static NTSTATUS cache_pull_Release </td>
538
<td class="paramtype">struct dcesrv_call_state * </td>
539
<td class="paramname"><em>dce_call</em>, </td>
542
<td class="paramkey"></td>
544
<td class="paramtype">struct EcDoRpc * </td>
545
<td class="paramname"><em>EcDoRpc</em>, </td>
548
<td class="paramkey"></td>
550
<td class="paramtype">uint32_t </td>
551
<td class="paramname"><em>handle_idx</em> </td>
560
<td class="mlabels-right">
561
<span class="mlabels"><span class="mlabel">static</span></span> </td>
564
</div><div class="memdoc">
565
<p>Track down Release calls and update the mpm_cache global list - removing associated entries.</p>
566
<p>This function recursively remove child entries whenever necessary.</p>
567
<dl class="params"><dt>Parameters</dt><dd>
568
<table class="params">
569
<tr><td class="paramname">dce_call</td><td>pointer to the session context </td></tr>
570
<tr><td class="paramname">EcDoRpc</td><td>pointer to the EcDoRpc operation </td></tr>
571
<tr><td class="paramname">handle_idx</td><td>the handle to track down</td></tr>
575
<dl class="section return"><dt>Returns</dt><dd>NT_STATUS_OK </dd></dl>
577
<p>References <a class="el" href="mpm__cache__stream_8c.html#a724182ad6610fe42a5667ffa389a4b06">mpm_cache_stream_close()</a>, <a class="el" href="dcesrv__mapiproxy__session_8c.html#a27de5ee88fd54850ea413e20774029b0">mpm_session_cmp()</a>, and <a class="el" href="dcesrv__mapiproxy__session_8c.html#a012505f633c42b3bef76acb3101e9c2d">mpm_session_release()</a>.</p>
579
<p>Referenced by <a class="el" href="mpm__cache_8c.html#afe28f63dd454143cf60ae816d86c65dc">cache_pull()</a>.</p>
583
<a class="anchor" id="a97cf4f171b4d1a84fbf4da19605fb820"></a>
584
<div class="memitem">
585
<div class="memproto">
586
<table class="mlabels">
588
<td class="mlabels-left">
589
<table class="memname">
591
<td class="memname">static NTSTATUS cache_push </td>
593
<td class="paramtype">struct dcesrv_call_state * </td>
594
<td class="paramname"><em>dce_call</em>, </td>
597
<td class="paramkey"></td>
599
<td class="paramtype">TALLOC_CTX * </td>
600
<td class="paramname"><em>mem_ctx</em>, </td>
603
<td class="paramkey"></td>
605
<td class="paramtype">void * </td>
606
<td class="paramname"><em>r</em> </td>
615
<td class="mlabels-right">
616
<span class="mlabels"><span class="mlabel">static</span></span> </td>
619
</div><div class="memdoc">
620
<p>Analyze EcDoRpc MAPI responses</p>
621
<p>This function loops over EcDoRpc MAPI calls and search for the opnums required by the cache module to monitor Stream traffic properly.</p>
622
<dl class="params"><dt>Parameters</dt><dd>
623
<table class="params">
624
<tr><td class="paramname">dce_call</td><td>pointer to the session context </td></tr>
625
<tr><td class="paramname">mem_ctx</td><td>the memory context </td></tr>
626
<tr><td class="paramname">r</td><td>generic pointer on EcDoRpc operation</td></tr>
630
<dl class="section return"><dt>Returns</dt><dd>NT_STATUS_OK </dd></dl>
632
<p>References <a class="el" href="mpm__cache_8c.html#a343229637fac85431053d3a3fbce7568">cache_find_call_request_index()</a>, <a class="el" href="mpm__cache_8c.html#a070020d672d3850ca02df7fc92ab40d1">cache_push_OpenAttach()</a>, <a class="el" href="mpm__cache_8c.html#ab9d8132ba3576f237182f28bef9a9823">cache_push_OpenMessage()</a>, <a class="el" href="mpm__cache_8c.html#a72233358ee75eb93e39e50320980cc89">cache_push_OpenStream()</a>, and <a class="el" href="mpm__cache_8c.html#a50fabb5b2ee2552ee0410557e5f816ee">cache_push_ReadStream()</a>.</p>
634
<p>Referenced by <a class="el" href="mpm__cache_8c.html#ab1730cf1108b8fda2c0d0a25b3a5133e">samba_init_module()</a>.</p>
638
<a class="anchor" id="a070020d672d3850ca02df7fc92ab40d1"></a>
639
<div class="memitem">
640
<div class="memproto">
641
<table class="mlabels">
643
<td class="mlabels-left">
644
<table class="memname">
646
<td class="memname">static NTSTATUS cache_push_OpenAttach </td>
648
<td class="paramtype">struct dcesrv_call_state * </td>
649
<td class="paramname"><em>dce_call</em>, </td>
652
<td class="paramkey"></td>
654
<td class="paramtype">struct EcDoRpc_MAPI_REQ </td>
655
<td class="paramname"><em>mapi_req</em>, </td>
658
<td class="paramkey"></td>
660
<td class="paramtype">struct EcDoRpc_MAPI_REPL </td>
661
<td class="paramname"><em>mapi_repl</em>, </td>
664
<td class="paramkey"></td>
666
<td class="paramtype">struct EcDoRpc * </td>
667
<td class="paramname"><em>EcDoRpc</em> </td>
676
<td class="mlabels-right">
677
<span class="mlabels"><span class="mlabel">static</span></span> </td>
680
</div><div class="memdoc">
681
<p>Monitor OpenAttach replies and store OpenAttach MAPI handle.</p>
682
<p>This is the second step for attachment registration:</p>
683
<p>Seek for a given parent_handle/attachmentID in the mpm_attachments list.</p>
684
<p>if a match is found (expected) and MAPI retval is set to MAPI_E_SUCCESS, update the handle parameter for the element and commit this attachment in the tdb store.</p>
685
<p>If retval is different from MAPI_E_SUCCESS, then delete the element.</p>
686
<dl class="params"><dt>Parameters</dt><dd>
687
<table class="params">
688
<tr><td class="paramname">dce_call</td><td>pointer to the session context </td></tr>
689
<tr><td class="paramname">mapi_req</td><td>reference to the OpenAttach request entry </td></tr>
690
<tr><td class="paramname">mapi_repl</td><td>reference to the OpenAttach MAPI response entry </td></tr>
691
<tr><td class="paramname">EcDoRpc</td><td>pointer to the current EcDoRpc operation</td></tr>
695
<dl class="section return"><dt>Returns</dt><dd>NT_STATUS_OK </dd></dl>
697
<p>References <a class="el" href="mpm__cache__ldb_8c.html#a8904cd5afe0afdc51b6dbde0969c4d07">mpm_cache_ldb_add_attachment()</a>, and <a class="el" href="dcesrv__mapiproxy__session_8c.html#a27de5ee88fd54850ea413e20774029b0">mpm_session_cmp()</a>.</p>
699
<p>Referenced by <a class="el" href="mpm__cache_8c.html#a97cf4f171b4d1a84fbf4da19605fb820">cache_push()</a>.</p>
703
<a class="anchor" id="ab9d8132ba3576f237182f28bef9a9823"></a>
704
<div class="memitem">
705
<div class="memproto">
706
<table class="mlabels">
708
<td class="mlabels-left">
709
<table class="memname">
711
<td class="memname">static NTSTATUS cache_push_OpenMessage </td>
713
<td class="paramtype">struct dcesrv_call_state * </td>
714
<td class="paramname"><em>dce_call</em>, </td>
717
<td class="paramkey"></td>
719
<td class="paramtype">struct EcDoRpc_MAPI_REQ </td>
720
<td class="paramname"><em>mapi_req</em>, </td>
723
<td class="paramkey"></td>
725
<td class="paramtype">struct EcDoRpc_MAPI_REPL </td>
726
<td class="paramname"><em>mapi_repl</em>, </td>
729
<td class="paramkey"></td>
731
<td class="paramtype">struct EcDoRpc * </td>
732
<td class="paramname"><em>EcDoRpc</em> </td>
741
<td class="mlabels-right">
742
<span class="mlabels"><span class="mlabel">static</span></span> </td>
745
</div><div class="memdoc">
746
<p>Monitor OpenMessage replies and store OpenMessage MAPI handle.</p>
747
<p>This is the second step for message registration:</p>
748
<p>Seek for a given FolderId/MessageId in the mpm_message list</p>
749
<p>If a match is found (expected) and MAPI retval is set to MAPI_E_SUCCESS, update the handle field for the element and commit this message in the tdb store.</p>
750
<p>If retval is different from MAPI_E_SUCCESS, then delete the record</p>
751
<dl class="params"><dt>Parameters</dt><dd>
752
<table class="params">
753
<tr><td class="paramname">dce_call</td><td>pointer to the session context </td></tr>
754
<tr><td class="paramname">mapi_req</td><td>reference to the OpenMessage MAPI request entry </td></tr>
755
<tr><td class="paramname">mapi_repl</td><td>reference to the OpenMessage MAPI response entry </td></tr>
756
<tr><td class="paramname">EcDoRpc</td><td>pointer to the current EcDoRpc operation</td></tr>
760
<dl class="section return"><dt>Returns</dt><dd>NT_STATUS_OK </dd></dl>
762
<p>References <a class="el" href="mpm__cache__ldb_8c.html#ab48c2b5474f93ac2e5b8479b48b9f24e">mpm_cache_ldb_add_message()</a>, and <a class="el" href="dcesrv__mapiproxy__session_8c.html#a27de5ee88fd54850ea413e20774029b0">mpm_session_cmp()</a>.</p>
764
<p>Referenced by <a class="el" href="mpm__cache_8c.html#a97cf4f171b4d1a84fbf4da19605fb820">cache_push()</a>.</p>
768
<a class="anchor" id="a72233358ee75eb93e39e50320980cc89"></a>
769
<div class="memitem">
770
<div class="memproto">
771
<table class="mlabels">
773
<td class="mlabels-left">
774
<table class="memname">
776
<td class="memname">static NTSTATUS cache_push_OpenStream </td>
778
<td class="paramtype">struct dcesrv_call_state * </td>
779
<td class="paramname"><em>dce_call</em>, </td>
782
<td class="paramkey"></td>
784
<td class="paramtype">struct EcDoRpc_MAPI_REQ </td>
785
<td class="paramname"><em>mapi_req</em>, </td>
788
<td class="paramkey"></td>
790
<td class="paramtype">struct EcDoRpc_MAPI_REPL </td>
791
<td class="paramname"><em>mapi_repl</em>, </td>
794
<td class="paramkey"></td>
796
<td class="paramtype">struct EcDoRpc * </td>
797
<td class="paramname"><em>EcDoRpc</em> </td>
806
<td class="mlabels-right">
807
<span class="mlabels"><span class="mlabel">static</span></span> </td>
810
</div><div class="memdoc">
811
<p>Monitor OpenStream replies and store the OpenStream MAPI handle.</p>
812
<p>This is the second step for stream registration:</p>
813
<p>Seek the parent_handle/PropertyTag couple in the mpm_streams list.</p>
814
<p>If a match is found (expected) and MAPI retval is set to MAPI_E_SUCCESS, update the handle field and StreamSize parameters for the element and commit this stream in the tdb store.</p>
815
<p>If retval is different from MAPI_E_SUCCESS, then delete the element.</p>
816
<dl class="params"><dt>Parameters</dt><dd>
817
<table class="params">
818
<tr><td class="paramname">dce_call</td><td>pointer to the session context </td></tr>
819
<tr><td class="paramname">mapi_req</td><td>reference to the OpenStream MAPI request entry </td></tr>
820
<tr><td class="paramname">mapi_repl</td><td>reference to the OpenStream MAPI response entry </td></tr>
821
<tr><td class="paramname">EcDoRpc</td><td>pointer to the current EcDoRpc operation</td></tr>
825
<dl class="section return"><dt>Returns</dt><dd>NT_STATUS_OK </dd></dl>
827
<p>References <a class="el" href="mpm__cache__ldb_8c.html#adc33f2a14113997d485ed48e4375f1d1">mpm_cache_ldb_add_stream()</a>, and <a class="el" href="dcesrv__mapiproxy__session_8c.html#a27de5ee88fd54850ea413e20774029b0">mpm_session_cmp()</a>.</p>
829
<p>Referenced by <a class="el" href="mpm__cache_8c.html#a97cf4f171b4d1a84fbf4da19605fb820">cache_push()</a>.</p>
833
<a class="anchor" id="a50fabb5b2ee2552ee0410557e5f816ee"></a>
834
<div class="memitem">
835
<div class="memproto">
836
<table class="mlabels">
838
<td class="mlabels-left">
839
<table class="memname">
841
<td class="memname">static NTSTATUS cache_push_ReadStream </td>
843
<td class="paramtype">struct dcesrv_call_state * </td>
844
<td class="paramname"><em>dce_call</em>, </td>
847
<td class="paramkey"></td>
849
<td class="paramtype">struct EcDoRpc_MAPI_REQ </td>
850
<td class="paramname"><em>mapi_req</em>, </td>
853
<td class="paramkey"></td>
855
<td class="paramtype">struct EcDoRpc_MAPI_REPL </td>
856
<td class="paramname"><em>mapi_repl</em>, </td>
859
<td class="paramkey"></td>
861
<td class="paramtype">struct EcDoRpc * </td>
862
<td class="paramname"><em>EcDoRpc</em> </td>
871
<td class="mlabels-right">
872
<span class="mlabels"><span class="mlabel">static</span></span> </td>
875
</div><div class="memdoc">
876
<p>Monitor ReadStream replies.</p>
877
<p>This function writes ReadStream data received from remote server and associated to messages or attachments to the opened associated file. This function only writes data if the file is not already cached, otherwise it just returns.</p>
878
<dl class="params"><dt>Parameters</dt><dd>
879
<table class="params">
880
<tr><td class="paramname">dce_call</td><td>pointer to the session context </td></tr>
881
<tr><td class="paramname">mapi_req</td><td>reference to the ReadStream MAPI request </td></tr>
882
<tr><td class="paramname">mapi_repl</td><td>reference to the ReadStream MAPI reply </td></tr>
883
<tr><td class="paramname">EcDoRpc</td><td>pointer to the current EcDoRpc operation</td></tr>
887
<dl class="section return"><dt>Returns</dt><dd>NT_STATUS_OK</dd></dl>
888
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="mpm__cache_8c.html#a9bb6adf0b5f931b4ae40ccad991e8413">cache_dispatch</a> </dd></dl>
890
<p>References <a class="el" href="mpm__cache_8c.html#aac46f4aa8bbafcc2e6b840e94f136741">cache_dump_stream_stat()</a>, <a class="el" href="mpm__cache_8c.html#ac7834a5d736527505f5236e1fd51e77c">cache_exec_sync_cmd()</a>, <a class="el" href="mpm__cache__stream_8c.html#a6e6b36fee79d3f8505f2fdaa0ad994ba">mpm_cache_stream_write()</a>, and <a class="el" href="dcesrv__mapiproxy__session_8c.html#a27de5ee88fd54850ea413e20774029b0">mpm_session_cmp()</a>.</p>
892
<p>Referenced by <a class="el" href="mpm__cache_8c.html#a97cf4f171b4d1a84fbf4da19605fb820">cache_push()</a>.</p>
896
<a class="anchor" id="ab1730cf1108b8fda2c0d0a25b3a5133e"></a>
897
<div class="memitem">
898
<div class="memproto">
899
<table class="memname">
901
<td class="memname">NTSTATUS samba_init_module </td>
903
<td class="paramtype">void </td>
904
<td class="paramname"></td><td>)</td>
908
</div><div class="memdoc">
909
<p>Entry point for the cache mapiproxy module</p>
910
<dl class="section return"><dt>Returns</dt><dd>NT_STATUS_OK on success, otherwise NTSTATUS error </dd></dl>
912
<p>References <a class="el" href="mpm__cache_8c.html#a9bb6adf0b5f931b4ae40ccad991e8413">cache_dispatch()</a>, <a class="el" href="mpm__cache_8c.html#a99a578fd0130e064c931b1bb52efa57c">cache_init()</a>, <a class="el" href="mpm__cache_8c.html#afe28f63dd454143cf60ae816d86c65dc">cache_pull()</a>, and <a class="el" href="mpm__cache_8c.html#a97cf4f171b4d1a84fbf4da19605fb820">cache_push()</a>.</p>
916
</div><!-- contents -->
919
<table style="clear:both; margin: 0.5em auto; width:80%; text-align: center; background-color:#f8f8f8; border:2px solid #e0e0e0; padding:5px;">
922
<img alt="Creative Commons License" src="CC_SomeRightsReserved.png" width="90" height="30" border="0" /><br />
923
<img alt="Creative Commons Attribution icon" src="24px-Cc-by_white.svg.png" width="24" height="24" border="0" />
924
<img alt="Creative Commons Share Alike icon" src="24px-Cc-sa_white.svg.png" width="24" height="24" border="0" />
926
<td> <i><strong class="selflink">This content</strong> is licensed under the Creative Commons<br />
927
Attribution ShareAlike License v. 3.0:<br />
928
<a href="http://creativecommons.org/licenses/by-sa/3.0/" class="external free" title="http://creativecommons.org/licenses/by-sa/3.0/" rel="nofollow">http://creativecommons.org/licenses/by-sa/3.0/</a></i>