r17711: fix compiler warnings
[ira/wip.git] / source4 / lib / ldb / ldb_tdb / ldb_tdb.h
1
2 #ifdef _SAMBA_BUILD_
3 #include "system/filesys.h"
4 #include "lib/tdb/include/tdb.h"
5 #else
6 #include "tdb.h"
7 #endif
8
9 /* this private structure is used by the ltdb backend in the
10    ldb_context */
11 struct ltdb_private {
12         TDB_CONTEXT *tdb;
13         unsigned int connect_flags;
14         
15         /* a double is used for portability and ease of string
16            handling. It has plenty of digits of precision */
17         double sequence_number;
18
19         struct ltdb_cache {
20                 struct ldb_message *baseinfo;
21                 struct ldb_message *indexlist;
22                 struct ldb_message *attributes;
23                 struct ldb_message *subclasses;
24
25                 struct {
26                         char *name;
27                         int flags;
28                 } last_attribute;
29         } *cache;
30 };
31
32 /*
33   the async local context
34   holds also internal search state during a full db search
35 */
36 struct ltdb_context {
37         struct ldb_module *module;
38
39         /* search stuff */
40         const struct ldb_parse_tree *tree;
41         const struct ldb_dn *base;
42         enum ldb_scope scope;
43         const char * const *attrs;
44
45         /* async stuff */
46         void *context;
47         int (*callback)(struct ldb_context *, void *, struct ldb_reply *);
48 };
49
50 /* special record types */
51 #define LTDB_INDEX      "@INDEX"
52 #define LTDB_INDEXLIST  "@INDEXLIST"
53 #define LTDB_IDX        "@IDX"
54 #define LTDB_IDXATTR    "@IDXATTR"
55 #define LTDB_BASEINFO   "@BASEINFO"
56 #define LTDB_ATTRIBUTES "@ATTRIBUTES"
57 #define LTDB_SUBCLASSES "@SUBCLASSES"
58
59 /* special attribute types */
60 #define LTDB_SEQUENCE_NUMBER "sequenceNumber"
61 #define LTDB_OBJECTCLASS "objectClass"
62
63 /* The following definitions come from lib/ldb/ldb_tdb/ldb_cache.c  */
64
65 int ltdb_cache_reload(struct ldb_module *module);
66 int ltdb_cache_load(struct ldb_module *module);
67 int ltdb_increase_sequence_number(struct ldb_module *module);
68 int ltdb_check_at_attributes_values(const struct ldb_val *value);
69
70 /* The following definitions come from lib/ldb/ldb_tdb/ldb_index.c  */
71
72 struct ldb_parse_tree;
73
74 int ltdb_search_indexed(struct ldb_handle *handle);
75 int ltdb_index_add(struct ldb_module *module, const struct ldb_message *msg);
76 int ltdb_index_del(struct ldb_module *module, const struct ldb_message *msg);
77 int ltdb_reindex(struct ldb_module *module);
78
79 /* The following definitions come from lib/ldb/ldb_tdb/ldb_pack.c  */
80
81 int ltdb_pack_data(struct ldb_module *module,
82                    const struct ldb_message *message,
83                    struct TDB_DATA *data);
84 void ltdb_unpack_data_free(struct ldb_module *module,
85                            struct ldb_message *message);
86 int ltdb_unpack_data(struct ldb_module *module,
87                      const struct TDB_DATA *data,
88                      struct ldb_message *message);
89
90 /* The following definitions come from lib/ldb/ldb_tdb/ldb_search.c  */
91
92 int ltdb_has_wildcard(struct ldb_module *module, const char *attr_name, 
93                       const struct ldb_val *val);
94 void ltdb_search_dn1_free(struct ldb_module *module, struct ldb_message *msg);
95 int ltdb_search_dn1(struct ldb_module *module, const struct ldb_dn *dn, struct ldb_message *msg);
96 int ltdb_add_attr_results(struct ldb_module *module,
97                           TALLOC_CTX *mem_ctx, 
98                           struct ldb_message *msg,
99                           const char * const attrs[], 
100                           unsigned int *count, 
101                           struct ldb_message ***res);
102 int ltdb_filter_attrs(struct ldb_message *msg, const char * const *attrs);
103 int ltdb_search(struct ldb_module *module, struct ldb_request *req);
104
105 /* The following definitions come from lib/ldb/ldb_tdb/ldb_tdb.c  */
106 struct ldb_handle *init_ltdb_handle(struct ltdb_private *ltdb, struct ldb_module *module,
107                                           void *context,
108                                           int (*callback)(struct ldb_context *, void *, struct ldb_reply *));
109 struct TDB_DATA ltdb_key(struct ldb_module *module, const struct ldb_dn *dn);
110 int ltdb_store(struct ldb_module *module, const struct ldb_message *msg, int flgs);
111 int ltdb_delete_noindex(struct ldb_module *module, const struct ldb_dn *dn);
112 int ltdb_modify_internal(struct ldb_module *module, const struct ldb_message *msg);
113
114 int ltdb_index_del_value(struct ldb_module *module, const char *dn, 
115                          struct ldb_message_element *el, int v_idx);
116
117 struct tdb_context *ltdb_wrap_open(TALLOC_CTX *mem_ctx,
118                                    const char *path, int hash_size, int tdb_flags,
119                                    int open_flags, mode_t mode,
120                                    struct ldb_context *ldb);
121