[Multipart nttrans replies 3/3] Take 4: multi-part nttrans replies

Sam Liddicott sam at liddicott.com
Fri Jul 4 10:05:49 GMT 2008


This patch allows smb_raw_nttrans_recv to handle multi-part responses
even when used asynchronously from a callback.

smbcli_request has:
 1. a new member async_cli_helper which can contain an smbclient
    library specific helper callback, and some private data.
 2. a new in_parts member, which is a list of the smb_request_buffer's
    of responses to a request

smbcli_transport_finish_recv() will append receive buffers to
req->in_parts, if there is a helper callback, and then consult the
helper callback to decide if all response parts have arrived (or
if enough parts have arrived in the case of an error).

smbcli_request_receive_more() has been modified to read the
extra response parts from req->in_parts where these exist
in order to preserve the semantics for *_recv handlers.

smb_raw_nttrans_recv and smb_raw_nttrans_recv_helper are now merely
thin wrappers for smb_raw_nttrans_recv_parts which has been refactored
from smb_raw_nttrans_recv, and uses the same logic to either merely check
or actually process the reponse parts into the smb_nttrans struct.

This means that in order to support multi-part responses only a small
change is required to the *_recv function, and that at the option of
the author it could either store state so it can process just the new
response part, or process all the parts in order each time.

Once all parts are gathered, the state may need to be reset so that
the parts can be properly processed.

Helpers are de-installed once they have finished processing
a request (and made a decision).

Conflicts:

Signed-off-by: Sam Liddicott <sam at liddicott.com>
---
 source/libcli/raw/clitransport.c |   32 +++++
 source/libcli/raw/libcliraw.h    |   22 +++-
 source/libcli/raw/rawrequest.c   |   21 +++-
 source/libcli/raw/rawtrans.c     |  261
++++++++++++++++++++++++++++++--------
 4 files changed, 278 insertions(+), 58 deletions(-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: c88b69ba985742faee7ff2b926c40f79adce10a3.diff
Type: text/x-patch
Size: 18049 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/20080704/22e7d8ae/c88b69ba985742faee7ff2b926c40f79adce10a3-0001.bin


More information about the samba-technical mailing list