source: branches/samba-3.0/source/include/util_tdb.h

Last change on this file was 1, checked in by Paul Smedley, 18 years ago

Initial code import

File size: 3.1 KB
Line 
1/*
2 Unix SMB/CIFS implementation.
3 tdb utility functions
4 Copyright (C) Andrew Tridgell 1999
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 2 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, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19*/
20
21#ifndef __TDBUTIL_H__
22#define __TDBUTIL_H__
23
24#include "tdb.h"
25
26#ifndef _BOOL
27typedef int BOOL;
28#define _BOOL
29#endif
30
31/* single node of a list returned by tdb_search_keys */
32typedef struct keys_node
33{
34 struct keys_node *prev, *next;
35 TDB_DATA node_key;
36} TDB_LIST_NODE;
37
38struct tdb_wrap {
39 struct tdb_context *tdb;
40 const char *name;
41 struct tdb_wrap *next, *prev;
42};
43
44TDB_LIST_NODE *tdb_search_keys(struct tdb_context*, const char*);
45void tdb_search_list_free(TDB_LIST_NODE*);
46int32_t tdb_change_int32_atomic(struct tdb_context *tdb, const char *keystr, int32_t *oldval, int32_t change_val);
47int tdb_lock_bystring(struct tdb_context *tdb, const char *keyval);
48int tdb_lock_bystring_with_timeout(TDB_CONTEXT *tdb, const char *keyval,
49 int timeout);
50void tdb_unlock_bystring(struct tdb_context *tdb, const char *keyval);
51int tdb_read_lock_bystring_with_timeout(TDB_CONTEXT *tdb, const char *keyval,
52 unsigned int timeout);
53void tdb_read_unlock_bystring(TDB_CONTEXT *tdb, const char *keyval);
54int32_t tdb_fetch_int32(struct tdb_context *tdb, const char *keystr);
55int tdb_store_uint32(struct tdb_context *tdb, const char *keystr, uint32_t value);
56int tdb_store_int32(struct tdb_context *tdb, const char *keystr, int32_t v);
57int tdb_fetch_uint32(struct tdb_context *tdb, const char *keystr, uint32_t *value);
58int tdb_traverse_delete_fn(struct tdb_context *the_tdb, TDB_DATA key, TDB_DATA dbuf,
59 void *state);
60int tdb_store_bystring(struct tdb_context *tdb, const char *keystr, TDB_DATA data, int flags);
61TDB_DATA tdb_fetch_bystring(struct tdb_context *tdb, const char *keystr);
62int tdb_delete_bystring(struct tdb_context *tdb, const char *keystr);
63struct tdb_context *tdb_open_log(const char *name, int hash_size,
64 int tdb_flags, int open_flags, mode_t mode);
65int tdb_unpack(char *buf, int bufsize, const char *fmt, ...);
66size_t tdb_pack(char *buf, int bufsize, const char *fmt, ...);
67TDB_DATA make_tdb_data(const char *dptr, size_t dsize);
68TDB_DATA string_tdb_data(const char *string);
69int tdb_trans_store(struct tdb_context *tdb, TDB_DATA key, TDB_DATA dbuf,
70 int flag);
71int tdb_change_uint32_atomic(TDB_CONTEXT *tdb, const char *keystr,
72 uint32 *oldval, uint32 change_val);
73int tdb_chainlock_with_timeout( TDB_CONTEXT *tdb, TDB_DATA key,
74 unsigned int timeout);
75
76#endif /* __TDBUTIL_H__ */
Note: See TracBrowser for help on using the repository browser.