s3:libnetapi: Add NetComposeOfflineDomainJoin() to API.
[Samba.git] / source3 / locking / leases_db.h
blob9c149c19f076f048088c3b075df2fc2dd03c306c
1 /*
2 * Unix SMB/CIFS implementation.
3 * leases.tdb functions
5 * Copyright (C) Volker Lendecke 2014
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 3 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, see <http://www.gnu.org/licenses/>.
21 #ifndef _LEASES_DB_H_
22 #define _LEASES_DB_H_
24 struct GUID;
25 struct smb2_lease_key;
26 struct file_id;
27 struct leases_db_file;
29 bool leases_db_init(bool read_only);
30 NTSTATUS leases_db_add(const struct GUID *client_guid,
31 const struct smb2_lease_key *lease_key,
32 const struct file_id *id,
33 uint32_t current_state,
34 uint16_t lease_version,
35 uint16_t epoch,
36 const char *servicepath,
37 const char *filename,
38 const char *stream_name);
39 NTSTATUS leases_db_del(const struct GUID *client_guid,
40 const struct smb2_lease_key *lease_key,
41 const struct file_id *id);
42 NTSTATUS leases_db_parse(const struct GUID *client_guid,
43 const struct smb2_lease_key *lease_key,
44 void (*parser)(uint32_t num_files,
45 const struct leases_db_file *files,
46 void *private_data),
47 void *private_data);
48 NTSTATUS leases_db_rename(const struct GUID *client_guid,
49 const struct smb2_lease_key *lease_key,
50 const struct file_id *id,
51 const char *servicepath_new,
52 const char *filename_new,
53 const char *stream_name_new);
54 NTSTATUS leases_db_set(const struct GUID *client_guid,
55 const struct smb2_lease_key *lease_key,
56 uint32_t current_state,
57 bool breaking,
58 uint32_t breaking_to_requested,
59 uint32_t breaking_to_required,
60 uint16_t lease_version,
61 uint16_t epoch);
62 NTSTATUS leases_db_get(const struct GUID *client_guid,
63 const struct smb2_lease_key *lease_key,
64 const struct file_id *file_id,
65 uint32_t *current_state,
66 bool *breaking,
67 uint32_t *breaking_to_requested,
68 uint32_t *breaking_to_required,
69 uint16_t *lease_version,
70 uint16_t *epoch);
71 NTSTATUS leases_db_get_current_state(
72 const struct GUID *client_guid,
73 const struct smb2_lease_key *lease_key,
74 int *database_seqnum,
75 uint32_t *current_state);
76 NTSTATUS leases_db_copy_file_ids(TALLOC_CTX *mem_ctx,
77 uint32_t num_files,
78 const struct leases_db_file *files,
79 struct file_id **pp_ids);
80 #endif /* _LEASES_DB_H_ */