r6470: Remove ldb_search_free() it is not needed anymore.
[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         /* error if an internal ldb+tdb error */
32         const char *last_err_string;
33 };
34
35 /* special record types */
36 #define LTDB_INDEX      "@INDEX"
37 #define LTDB_INDEXLIST  "@INDEXLIST"
38 #define LTDB_IDX        "@IDX"
39 #define LTDB_IDXATTR    "@IDXATTR"
40 #define LTDB_BASEINFO   "@BASEINFO"
41 #define LTDB_ATTRIBUTES "@ATTRIBUTES"
42 #define LTDB_SUBCLASSES "@SUBCLASSES"
43
44 /* special attribute types */
45 #define LTDB_SEQUENCE_NUMBER "sequenceNumber"
46 #define LTDB_OBJECTCLASS "objectClass"
47
48 /* well known attribute flags */
49 #define LTDB_FLAG_CASE_INSENSITIVE (1<<0)
50 #define LTDB_FLAG_INTEGER          (1<<1)
51 #define LTDB_FLAG_WILDCARD         (1<<2)
52 #define LTDB_FLAG_OBJECTCLASS      (1<<3)
53 #define LTDB_FLAG_HIDDEN           (1<<4)
54
55 /* The following definitions come from lib/ldb/ldb_tdb/ldb_cache.c  */
56
57 int ltdb_cache_reload(struct ldb_module *module);
58 int ltdb_cache_load(struct ldb_module *module);
59 int ltdb_increase_sequence_number(struct ldb_module *module);
60 int ltdb_attribute_flags(struct ldb_module *module, const char *attr_name);
61
62 /* The following definitions come from lib/ldb/ldb_tdb/ldb_index.c  */
63
64 struct ldb_parse_tree;
65
66 int ltdb_search_indexed(struct ldb_module *module, 
67                         const char *base,
68                         enum ldb_scope scope,
69                         struct ldb_parse_tree *tree,
70                         const char * const attrs[], struct ldb_message ***res);
71 int ltdb_index_add(struct ldb_module *module, const struct ldb_message *msg);
72 int ltdb_index_del(struct ldb_module *module, const struct ldb_message *msg);
73 int ltdb_reindex(struct ldb_module *module);
74
75 /* The following definitions come from lib/ldb/ldb_tdb/ldb_pack.c  */
76
77 int ltdb_pack_data(struct ldb_module *module,
78                    const struct ldb_message *message,
79                    struct TDB_DATA *data);
80 void ltdb_unpack_data_free(struct ldb_module *module,
81                            struct ldb_message *message);
82 int ltdb_unpack_data(struct ldb_module *module,
83                      const struct TDB_DATA *data,
84                      struct ldb_message *message);
85
86 /* The following definitions come from lib/ldb/ldb_tdb/ldb_search.c  */
87
88 int ltdb_has_wildcard(struct ldb_module *module, const char *attr_name, 
89                       const struct ldb_val *val);
90 void ltdb_search_dn1_free(struct ldb_module *module, struct ldb_message *msg);
91 int ltdb_search_dn1(struct ldb_module *module, const char *dn, struct ldb_message *msg);
92 int ltdb_search_dn(struct ldb_module *module, char *dn,
93                    const char * const attrs[], struct ldb_message ***res);
94 int ltdb_add_attr_results(struct ldb_module *module, struct ldb_message *msg,
95                           const char * const attrs[], 
96                           int *count, 
97                           struct ldb_message ***res);
98 int ltdb_search(struct ldb_module *module, const char *base,
99                 enum ldb_scope scope, const char *expression,
100                 const char * const attrs[], struct ldb_message ***res);
101
102 /* The following definitions come from lib/ldb/ldb_tdb/ldb_tdb.c  */
103 struct TDB_DATA ltdb_key(struct ldb_module *module, const char *dn);
104 int ltdb_store(struct ldb_module *module, const struct ldb_message *msg, int flgs);
105 int ltdb_delete_noindex(struct ldb_module *module, const char *dn);
106 int ltdb_modify_internal(struct ldb_module *module, const struct ldb_message *msg);
107
108 /* The following definitions come from lib/ldb/ldb_tdb/ldb_match.c  */
109 int ltdb_val_equal(struct ldb_module *module,
110                   const char *attr_name,
111                   const struct ldb_val *v1, const struct ldb_val *v2);
112 int ltdb_message_match(struct ldb_module *module, 
113                       struct ldb_message *msg,
114                       struct ldb_parse_tree *tree,
115                       const char *base,
116                       enum ldb_scope scope);
117
118 int ltdb_index_del_value(struct ldb_module *module, const char *dn, 
119                          struct ldb_message_element *el, int v_idx);
120