1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
#ifndef TDB1_H
#define TDB1_H
/*
Unix SMB/CIFS implementation.
trivial database library (version 1 compat functions)
Copyright (C) Andrew Tridgell 1999-2004
Copyright (C) Rusty Russell 2011
** NOTE! The following LGPL license applies to the tdb
** library. This does NOT imply that all of Samba is released
** under the LGPL
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#include "tdb2.h"
#ifndef _SAMBA_BUILD_
/* For mode_t */
#include <sys/types.h>
/* For O_* flags. */
#include <sys/stat.h>
#endif
typedef int (*tdb1_traverse_func)(struct tdb_context *, TDB_DATA, TDB_DATA, void *);
struct tdb_context *tdb1_open(const char *name, int tdb1_flags,
int open_flags, mode_t mode,
union tdb_attribute *attributes);
void tdb1_set_max_dead(struct tdb_context *tdb, int max_dead);
TDB_DATA tdb1_fetch(struct tdb_context *tdb, TDB_DATA key);
int tdb1_parse_record(struct tdb_context *tdb, TDB_DATA key,
int (*parser)(TDB_DATA key, TDB_DATA data,
void *private_data),
void *private_data);
int tdb1_delete(struct tdb_context *tdb, TDB_DATA key);
int tdb1_store(struct tdb_context *tdb, TDB_DATA key, TDB_DATA dbuf, int flag);
int tdb1_append(struct tdb_context *tdb, TDB_DATA key, TDB_DATA new_dbuf);
int tdb1_close(struct tdb_context *tdb);
TDB_DATA tdb1_firstkey(struct tdb_context *tdb);
TDB_DATA tdb1_nextkey(struct tdb_context *tdb, TDB_DATA key);
int tdb1_traverse(struct tdb_context *tdb, tdb1_traverse_func fn, void *private_data);
int tdb1_traverse_read(struct tdb_context *tdb, tdb1_traverse_func fn, void *private_data);
int tdb1_exists(struct tdb_context *tdb, TDB_DATA key);
int tdb1_lockall(struct tdb_context *tdb);
int tdb1_unlockall(struct tdb_context *tdb);
int tdb1_lockall_read(struct tdb_context *tdb);
int tdb1_unlockall_read(struct tdb_context *tdb);
int tdb1_transaction_start(struct tdb_context *tdb);
int tdb1_transaction_prepare_commit(struct tdb_context *tdb);
int tdb1_transaction_commit(struct tdb_context *tdb);
int tdb1_transaction_cancel(struct tdb_context *tdb);
int tdb1_get_seqnum(struct tdb_context *tdb);
void tdb1_increment_seqnum_nonblock(struct tdb_context *tdb);
uint64_t tdb1_incompatible_hash(const void *key, size_t len, uint64_t seed, void *);
int tdb1_check(struct tdb_context *tdb,
int (*check) (TDB_DATA key, TDB_DATA data, void *private_data),
void *private_data);
/* @} ******************************************************************/
/* Low level locking functions: use with care */
int tdb1_chainlock(struct tdb_context *tdb, TDB_DATA key);
int tdb1_chainunlock(struct tdb_context *tdb, TDB_DATA key);
int tdb1_chainlock_read(struct tdb_context *tdb, TDB_DATA key);
int tdb1_chainunlock_read(struct tdb_context *tdb, TDB_DATA key);
/* wipe and repack */
int tdb1_wipe_all(struct tdb_context *tdb);
int tdb1_repack(struct tdb_context *tdb);
/* Debug functions. Not used in production. */
char *tdb1_summary(struct tdb_context *tdb);
extern TDB_DATA tdb1_null;
#endif /* tdb1.h */
|