s4-torture: Add handlers to ignore incoming oplock/lease break requests
[nivanova/samba-autobuild/.git] / source4 / torture / smb2 / oplock_break_handler.h
1 /*
2  * Unix SMB/CIFS implementation.
3  *
4  * test suite for SMB2 replay
5  *
6  * Copyright (C) Anubhav Rakshit 2014
7  * Copyright (C) Stefan Metzmacher 2014
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
21  */
22
23 #ifndef __OPLOCK_BREAK_HANDLER_H__
24 #define __OPLOCK_BREAK_HANDLER_H__
25
26 struct break_info {
27         struct torture_context *tctx;
28         struct smb2_handle handle;
29         uint8_t level;
30         struct smb2_break br;
31         int count;
32         int failures;
33         NTSTATUS failure_status;
34         struct smb2_transport *received_transport;
35 };
36
37 extern struct break_info break_info;
38
39 bool torture_oplock_ack_handler(struct smb2_transport *transport,
40                                 const struct smb2_handle *handle,
41                                 uint8_t level,
42                                 void *private_data);
43 bool torture_oplock_ignore_handler(struct smb2_transport *transport,
44                                 const struct smb2_handle *handle,
45                                 uint8_t level,
46                                 void *private_data);
47 void torture_wait_for_oplock_break(struct torture_context *tctx);
48
49 static inline void torture_reset_break_info(struct torture_context *tctx,
50                               struct break_info *r)
51 {
52         ZERO_STRUCTP(r);
53         r->tctx = tctx;
54 }
55
56 #endif /* __OPLOCK_BREAK_HANDLER_H__ */