r15942: Remove the sync internal ldb calls altogether.
[Samba.git] / source4 / lib / ldb / ldb_tdb / ldb_tdb.h
blob0c44a80edd81a2c7b2bd58c22935380b15733bd1
2 #ifdef _SAMBA_BUILD_
3 #include "system/filesys.h"
4 #include "lib/tdb/include/tdb.h"
5 #else
6 #include "tdb.h"
7 #endif
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;
15 /* a double is used for portability and ease of string
16 handling. It has plenty of digits of precision */
17 double sequence_number;
19 struct ltdb_cache {
20 struct ldb_message *baseinfo;
21 struct ldb_message *indexlist;
22 struct ldb_message *attributes;
23 struct ldb_message *subclasses;
25 struct {
26 char *name;
27 int flags;
28 } last_attribute;
29 } *cache;
33 the async local context
34 holds also internal search state during a full db search
36 struct ltdb_async_context {
37 struct ldb_module *module;
39 /* search stuff */
40 struct ldb_parse_tree *tree;
41 const struct ldb_dn *base;
42 enum ldb_scope scope;
43 const char * const *attrs;
45 /* async stuff */
46 void *context;
47 int (*callback)(struct ldb_context *, void *, struct ldb_async_result *);
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"
59 /* special attribute types */
60 #define LTDB_SEQUENCE_NUMBER "sequenceNumber"
61 #define LTDB_OBJECTCLASS "objectClass"
63 /* The following definitions come from lib/ldb/ldb_tdb/ldb_cache.c */
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);
70 /* The following definitions come from lib/ldb/ldb_tdb/ldb_index.c */
72 struct ldb_parse_tree;
74 int ltdb_search_indexed(struct ldb_async_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);
79 /* The following definitions come from lib/ldb/ldb_tdb/ldb_pack.c */
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);
90 /* The following definitions come from lib/ldb/ldb_tdb/ldb_search.c */
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);
105 /* The following definitions come from lib/ldb/ldb_tdb/ldb_tdb.c */
106 struct ldb_async_handle *init_ltdb_handle(struct ltdb_private *ltdb, struct ldb_module *module,
107 void *context,
108 int (*callback)(struct ldb_context *, void *, struct ldb_async_result *));
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);
114 int ltdb_index_del_value(struct ldb_module *module, const char *dn,
115 struct ldb_message_element *el, int v_idx);
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);