s3: Remove duplicate fsctl function definitions
[kai/samba.git] / source3 / include / talloc_dict.h
1 /*
2    Unix SMB/CIFS implementation.
3    Little dictionary style data structure based on dbwrap_rbt
4    Copyright (C) Volker Lendecke 2009
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 #ifndef __TALLOC_DICT_H__
21 #define __TALLOC_DICT_H__
22
23 #include "includes.h"
24
25 struct talloc_dict;
26
27 /*
28  * Create a talloc_dict structure.
29  */
30
31 struct talloc_dict *talloc_dict_init(TALLOC_CTX *mem_ctx);
32
33 /*
34  * Add a talloced object to the dict. Nulls out the pointer to indicate that
35  * the talloc ownership has been taken. If an object for "key" already exists,
36  * the existing object is talloc_free()ed and overwritten by the new
37  * object. If "data" is NULL, object for key "key" is deleted. Return false
38  * for "no memory".
39  */
40
41 bool talloc_dict_set(struct talloc_dict *dict, DATA_BLOB key, void *data);
42
43 /*
44  * Fetch a talloced object. If "mem_ctx!=NULL", talloc_move the object there
45  * and delete it from the dict.
46  */
47
48 void *talloc_dict_fetch(struct talloc_dict *dict, DATA_BLOB key,
49                         TALLOC_CTX *mem_ctx);
50
51 /*
52  * Traverse a talloc_dict. If "fn" returns non-null, quit the traverse
53  */
54
55 int talloc_dict_traverse(struct talloc_dict *dict,
56                          int (*fn)(DATA_BLOB key, void *data,
57                                    void *private_data),
58                          void *private_data);
59
60 #endif