2 Unix SMB/Netbios implementation.
4 SMB client oplock functions
5 Copyright (C) Andrew Tridgell 2001
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 extern int DEBUGLEVEL
;
28 /****************************************************************************
29 send an ack for an oplock break request
30 ****************************************************************************/
31 BOOL
cli_oplock_ack(struct cli_state
*cli
, int fnum
, unsigned char level
)
33 char *oldbuf
= cli
->outbuf
;
39 memset(buf
,'\0',smb_size
);
40 set_message(buf
,8,0,True
);
42 CVAL(buf
,smb_com
) = SMBlockingX
;
43 SSVAL(buf
,smb_tid
, cli
->cnum
);
44 cli_setup_packet(cli
);
45 SSVAL(buf
,smb_vwv0
,0xFF);
46 SSVAL(buf
,smb_vwv1
,0);
47 SSVAL(buf
,smb_vwv2
,fnum
);
49 SSVAL(buf
,smb_vwv3
,0x102); /* levelII oplock break ack */
51 SSVAL(buf
,smb_vwv3
,2); /* exclusive oplock break ack */
52 SIVAL(buf
,smb_vwv4
,0); /* timoeut */
53 SSVAL(buf
,smb_vwv6
,0); /* unlockcount */
54 SSVAL(buf
,smb_vwv7
,0); /* lockcount */
56 ret
= cli_send_smb(cli
);
64 /****************************************************************************
65 set the oplock handler for a connection
66 ****************************************************************************/
67 void cli_oplock_handler(struct cli_state
*cli
,
68 BOOL (*handler
)(struct cli_state
*, int, unsigned char))
70 cli
->oplock_handler
= handler
;