s4:ldb Add Well Known GUID (WKGUID) tests to ldap.py
[Samba/ekacnet.git] / source4 / lib / ldb / ldb_tdb / ldb_tdb.h
blobb3887a6c3471dbe82ebb9e11284e1a4ea47b3f93
1 #include "ldb_includes.h"
2 #include "tdb.h"
3 #include "ldb_module.h"
5 /* this private structure is used by the ltdb backend in the
6 ldb_context */
7 struct ltdb_private {
8 TDB_CONTEXT *tdb;
9 unsigned int connect_flags;
11 unsigned long long sequence_number;
13 /* the low level tdb seqnum - used to avoid loading BASEINFO when
14 possible */
15 int tdb_seqnum;
17 struct ltdb_cache {
18 struct ldb_message *indexlist;
19 struct ldb_message *attributes;
20 bool one_level_indexes;
21 bool attribute_indexes;
23 struct {
24 char *name;
25 int flags;
26 } last_attribute;
27 } *cache;
29 int in_transaction;
31 bool check_base;
32 struct ltdb_idxptr *idxptr;
33 bool prepared_commit;
37 the async local context
38 holds also internal search state during a full db search
40 struct ltdb_req_spy {
41 struct ltdb_context *ctx;
44 struct ltdb_context {
45 struct ldb_module *module;
46 struct ldb_request *req;
48 bool request_terminated;
49 struct ltdb_req_spy *spy;
51 /* search stuff */
52 const struct ldb_parse_tree *tree;
53 struct ldb_dn *base;
54 enum ldb_scope scope;
55 const char * const *attrs;
56 struct tevent_timer *timeout_event;
59 /* special record types */
60 #define LTDB_INDEX "@INDEX"
61 #define LTDB_INDEXLIST "@INDEXLIST"
62 #define LTDB_IDX "@IDX"
63 #define LTDB_IDXVERSION "@IDXVERSION"
64 #define LTDB_IDXATTR "@IDXATTR"
65 #define LTDB_IDXONE "@IDXONE"
66 #define LTDB_BASEINFO "@BASEINFO"
67 #define LTDB_OPTIONS "@OPTIONS"
68 #define LTDB_ATTRIBUTES "@ATTRIBUTES"
70 /* special attribute types */
71 #define LTDB_SEQUENCE_NUMBER "sequenceNumber"
72 #define LTDB_CHECK_BASE "checkBaseOnSearch"
73 #define LTDB_MOD_TIMESTAMP "whenChanged"
74 #define LTDB_OBJECTCLASS "objectClass"
76 /* The following definitions come from lib/ldb/ldb_tdb/ldb_cache.c */
78 int ltdb_cache_reload(struct ldb_module *module);
79 int ltdb_cache_load(struct ldb_module *module);
80 int ltdb_increase_sequence_number(struct ldb_module *module);
81 int ltdb_check_at_attributes_values(const struct ldb_val *value);
83 /* The following definitions come from lib/ldb/ldb_tdb/ldb_index.c */
85 struct ldb_parse_tree;
87 int ltdb_search_indexed(struct ltdb_context *ctx, uint32_t *);
88 int ltdb_index_add_new(struct ldb_module *module, const struct ldb_message *msg);
89 int ltdb_index_delete(struct ldb_module *module, const struct ldb_message *msg);
90 int ltdb_index_del_element(struct ldb_module *module, const char *dn, struct ldb_message_element *el);
91 int ltdb_index_add_element(struct ldb_module *module, struct ldb_dn *dn,
92 struct ldb_message_element *el);
93 int ltdb_index_del_value(struct ldb_module *module, const char *dn,
94 struct ldb_message_element *el, int v_idx);
95 int ltdb_reindex(struct ldb_module *module);
96 int ltdb_index_transaction_start(struct ldb_module *module);
97 int ltdb_index_transaction_commit(struct ldb_module *module);
98 int ltdb_index_transaction_cancel(struct ldb_module *module);
100 /* The following definitions come from lib/ldb/ldb_tdb/ldb_pack.c */
102 int ltdb_pack_data(struct ldb_module *module,
103 const struct ldb_message *message,
104 struct TDB_DATA *data);
105 void ltdb_unpack_data_free(struct ldb_module *module,
106 struct ldb_message *message);
107 int ltdb_unpack_data(struct ldb_module *module,
108 const struct TDB_DATA *data,
109 struct ldb_message *message);
111 /* The following definitions come from lib/ldb/ldb_tdb/ldb_search.c */
113 int ltdb_has_wildcard(struct ldb_module *module, const char *attr_name,
114 const struct ldb_val *val);
115 void ltdb_search_dn1_free(struct ldb_module *module, struct ldb_message *msg);
116 int ltdb_search_dn1(struct ldb_module *module, struct ldb_dn *dn, struct ldb_message *msg);
117 int ltdb_add_attr_results(struct ldb_module *module,
118 TALLOC_CTX *mem_ctx,
119 struct ldb_message *msg,
120 const char * const attrs[],
121 unsigned int *count,
122 struct ldb_message ***res);
123 int ltdb_filter_attrs(struct ldb_message *msg, const char * const *attrs);
124 int ltdb_search(struct ltdb_context *ctx);
126 /* The following definitions come from lib/ldb/ldb_tdb/ldb_tdb.c */
127 int ltdb_lock_read(struct ldb_module *module);
128 int ltdb_unlock_read(struct ldb_module *module);
129 struct TDB_DATA ltdb_key(struct ldb_module *module, struct ldb_dn *dn);
130 int ltdb_store(struct ldb_module *module, const struct ldb_message *msg, int flgs);
131 int ltdb_modify_internal(struct ldb_module *module, const struct ldb_message *msg);
132 int ltdb_delete_noindex(struct ldb_module *module, struct ldb_dn *dn);
133 int ltdb_err_map(enum TDB_ERROR tdb_code);
135 struct tdb_context *ltdb_wrap_open(TALLOC_CTX *mem_ctx,
136 const char *path, int hash_size, int tdb_flags,
137 int open_flags, mode_t mode,
138 struct ldb_context *ldb);