[jcifs] Batching command in CIFS
Christopher R. Hertel
crh at ubiqx.mn.org
Thu Jan 27 21:56:51 GMT 2005
On Fri, Jan 28, 2005 at 01:15:33AM +0800, Cellina Lin wrote:
> Thanks. I looked into the internal API, but had one problem for now....
> The method,
> SmbComReadAndX( int fid, long offset, int maxCount, ServerMessageBlock andx ),
> needs fid as parameter, but it seems that fid is available only after
> sending the SmbComNTCreateAndX and thus get the response from
> What should I put in the first parameter of SmbComReadAndX() call if I
> want to batch it with SmbComNTCreateAndX ()?
Try zero. As you correctly point out, there is no FID until the first
chained command completes. That's okay, though, because the whole point
of the AndX is to avoid a round-trip back the client and then to the
server again. This is done by using values generated by the first chained
request to fill in the blanks of the second request.
Consider the SMB_COM_SESSION_SETUP_ANDX + SMB_COM_TREE_CONNECT_ANDX
coimbination. Assuming user-level authentication, a valid UID is required
for the second command--the SMB_COM_TREE_CONNECT_ANDX--to proceed. The
UID is generated as a result of the first command, the
SMB_COM_SESSION_SETUP_ANDX, and is passed along to the second.
I'm not promising that it will work in your case. If you've seen it on
the wire, then you would just use whatever you saw in the trace (that is,
do what Windows does). If you haven't seen it on the wire, it may be
because it's a combination that Microsoft never implemented. If they
haven't implement it, then they probably haven't tested it.
...keep in mind that I'm the theory guy.
PS. See: http://ubiqx.org/cifs/SMB.html#SMB.4.4
"Implementing CIFS - the Common Internet FileSystem" ISBN: 013047116X
Samba Team -- http://www.samba.org/ -)----- Christopher R. Hertel
jCIFS Team -- http://jcifs.samba.org/ -)----- ubiqx development, uninq.
ubiqx Team -- http://www.ubiqx.org/ -)----- crh at ubiqx.mn.org
OnLineBook -- http://ubiqx.org/cifs/ -)----- crh at ubiqx.org
More information about the jcifs