LCOV - code coverage report
Current view: top level - source4/libcli/raw - clioplock.c (source / functions) Hit Total Coverage
Test: coverage report for v4-17-test 1498b464 Lines: 17 18 94.4 %
Date: 2024-06-13 04:01:37 Functions: 2 2 100.0 %

          Line data    Source code
       1             : /* 
       2             :    Unix SMB/CIFS implementation.
       3             :    SMB client oplock functions
       4             :    Copyright (C) Andrew Tridgell 2001
       5             :    
       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.
      10             :    
      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.
      15             :    
      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/>.
      18             : */
      19             : 
      20             : #include "includes.h"
      21             : #include "libcli/raw/libcliraw.h"
      22             : #include "libcli/raw/raw_proto.h"
      23             : 
      24             : /****************************************************************************
      25             : send an ack for an oplock break request
      26             : ****************************************************************************/
      27          43 : _PUBLIC_ bool smbcli_oplock_ack(struct smbcli_tree *tree, uint16_t fnum, uint16_t ack_level)
      28             : {
      29             :         bool ret;
      30             :         struct smbcli_request *req;
      31             : 
      32          43 :         req = smbcli_request_setup(tree, SMBlockingX, 8, 0);
      33          43 :         if (req == NULL) {
      34           0 :                 return false;
      35             :         }
      36             : 
      37          43 :         SSVAL(req->out.vwv,VWV(0),0xFF);
      38          43 :         SSVAL(req->out.vwv,VWV(1),0);
      39          43 :         SSVAL(req->out.vwv,VWV(2),fnum);
      40          43 :         SCVAL(req->out.vwv,VWV(3),LOCKING_ANDX_OPLOCK_RELEASE);
      41          43 :         SCVAL(req->out.vwv,VWV(3)+1,ack_level);
      42          43 :         SIVAL(req->out.vwv,VWV(4),0);
      43          43 :         SSVAL(req->out.vwv,VWV(6),0);
      44          43 :         SSVAL(req->out.vwv,VWV(7),0);
      45             : 
      46             :         /*
      47             :          * The low level code knows it is a
      48             :          * one way request by looking at SMBlockingX,
      49             :          * wct == 8 and LOCKING_ANDX_OPLOCK_RELEASE
      50             :          */
      51          43 :         ret = smbcli_request_send(req);
      52             : 
      53          43 :         return ret;
      54             : }
      55             : 
      56             : 
      57             : /****************************************************************************
      58             : set the oplock handler for a connection
      59             : ****************************************************************************/
      60         236 : _PUBLIC_ void smbcli_oplock_handler(struct smbcli_transport *transport, 
      61             :                         bool (*handler)(struct smbcli_transport *, uint16_t, uint16_t, uint8_t, void *),
      62             :                         void *private_data)
      63             : {
      64         236 :         transport->oplock.handler = handler;
      65         236 :         transport->oplock.private_data = private_data;
      66         236 : }

Generated by: LCOV version 1.13