2 Unix SMB/CIFS implementation.
3 SMB client oplock functions
4 Copyright (C) Andrew Tridgell 2001
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #include "libcli/raw/libcliraw.h"
23 /****************************************************************************
24 send an ack for an oplock break request
25 ****************************************************************************/
26 _PUBLIC_ bool smbcli_oplock_ack(struct smbcli_tree *tree, uint16_t fnum, uint16_t ack_level)
29 struct smbcli_request *req;
31 req = smbcli_request_setup(tree, SMBlockingX, 8, 0);
33 SSVAL(req->out.vwv,VWV(0),0xFF);
34 SSVAL(req->out.vwv,VWV(1),0);
35 SSVAL(req->out.vwv,VWV(2),fnum);
36 SCVAL(req->out.vwv,VWV(3),LOCKING_ANDX_OPLOCK_RELEASE);
37 SCVAL(req->out.vwv,VWV(3)+1,ack_level);
38 SIVAL(req->out.vwv,VWV(4),0);
39 SSVAL(req->out.vwv,VWV(6),0);
40 SSVAL(req->out.vwv,VWV(7),0);
42 /* this request does not expect a reply, so tell the signing
43 subsystem not to allocate an id for a reply */
44 req->one_way_request = 1;
46 ret = smbcli_request_send(req);
52 /****************************************************************************
53 set the oplock handler for a connection
54 ****************************************************************************/
55 _PUBLIC_ void smbcli_oplock_handler(struct smbcli_transport *transport,
56 bool (*handler)(struct smbcli_transport *, uint16_t, uint16_t, uint8_t, void *),
59 transport->oplock.handler = handler;
60 transport->oplock.private = private;