Merge 2610c05b5b95cc7036b3d6dfb894c6cfbdb68483 as Samba-4.0alpha16
[amitay/samba.git] / source4 / ntvfs / sysdep / sys_lease.h
1 /*
2    Unix SMB/CIFS implementation.
3
4    Copyright (C) Stefan Metzmacher 2008
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 "param/share.h"
21
22 struct sys_lease_context;
23 struct opendb_entry;
24 struct imessaging_context;
25 struct tevent_context;
26
27 typedef NTSTATUS (*sys_lease_send_break_fn)(struct imessaging_context *,
28                                             struct opendb_entry *,
29                                             uint8_t level);
30
31 struct sys_lease_ops {
32         const char *name;
33         NTSTATUS (*init)(struct sys_lease_context *ctx);
34         NTSTATUS (*setup)(struct sys_lease_context *ctx,
35                           struct opendb_entry *e);
36         NTSTATUS (*update)(struct sys_lease_context *ctx,
37                            struct opendb_entry *e);
38         NTSTATUS (*remove)(struct sys_lease_context *ctx,
39                            struct opendb_entry *e);
40 };
41
42 struct sys_lease_context {
43         struct tevent_context *event_ctx;
44         struct imessaging_context *msg_ctx;
45         sys_lease_send_break_fn break_send;
46         void *private_data; /* for use of backend */
47         const struct sys_lease_ops *ops;
48 };
49
50 NTSTATUS sys_lease_register(const struct sys_lease_ops *ops);
51 NTSTATUS sys_lease_init(void);
52
53 struct sys_lease_context *sys_lease_context_create(struct share_config *scfg,
54                                                    TALLOC_CTX *mem_ctx,
55                                                    struct tevent_context *ev,
56                                                    struct imessaging_context *msg_ctx,
57                                                    sys_lease_send_break_fn break_send);
58
59 NTSTATUS sys_lease_setup(struct sys_lease_context *ctx,
60                          struct opendb_entry *e);
61
62 NTSTATUS sys_lease_update(struct sys_lease_context *ctx,
63                           struct opendb_entry *e);
64
65 NTSTATUS sys_lease_remove(struct sys_lease_context *ctx,
66                           struct opendb_entry *e);