lib/replace: define HAVE_WORKING_STRPTIME instead of REPLACE_STRPTIME
[Samba/gebeck_regimport.git] / source4 / libcli / raw / clioplock.c
blob396ab96445028d607fabb45cd4bbb26cd9248995
1 /*
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/>.
20 #include "includes.h"
21 #include "libcli/raw/libcliraw.h"
22 #include "libcli/raw/raw_proto.h"
24 /****************************************************************************
25 send an ack for an oplock break request
26 ****************************************************************************/
27 _PUBLIC_ bool smbcli_oplock_ack(struct smbcli_tree *tree, uint16_t fnum, uint16_t ack_level)
29 bool ret;
30 struct smbcli_request *req;
32 req = smbcli_request_setup(tree, SMBlockingX, 8, 0);
34 SSVAL(req->out.vwv,VWV(0),0xFF);
35 SSVAL(req->out.vwv,VWV(1),0);
36 SSVAL(req->out.vwv,VWV(2),fnum);
37 SCVAL(req->out.vwv,VWV(3),LOCKING_ANDX_OPLOCK_RELEASE);
38 SCVAL(req->out.vwv,VWV(3)+1,ack_level);
39 SIVAL(req->out.vwv,VWV(4),0);
40 SSVAL(req->out.vwv,VWV(6),0);
41 SSVAL(req->out.vwv,VWV(7),0);
44 * The low level code knows it is a
45 * one way request by looking at SMBlockingX,
46 * wct == 8 and LOCKING_ANDX_OPLOCK_RELEASE
48 ret = smbcli_request_send(req);
50 return ret;
54 /****************************************************************************
55 set the oplock handler for a connection
56 ****************************************************************************/
57 _PUBLIC_ void smbcli_oplock_handler(struct smbcli_transport *transport,
58 bool (*handler)(struct smbcli_transport *, uint16_t, uint16_t, uint8_t, void *),
59 void *private_data)
61 transport->oplock.handler = handler;
62 transport->oplock.private_data = private_data;