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