2 #include "system/filesys.h"
3 #include "system/time.h"
5 #include "ldb_module.h"
7 /* this private structure is used by the ltdb backend in the
11 unsigned int connect_flags
;
13 unsigned long long sequence_number
;
15 /* the low level tdb seqnum - used to avoid loading BASEINFO when
20 struct ldb_message
*indexlist
;
21 bool one_level_indexes
;
22 bool attribute_indexes
;
28 bool disallow_dn_filter
;
29 struct ltdb_idxptr
*idxptr
;
40 struct ldb_module
*module
;
41 struct ldb_request
*req
;
43 bool request_terminated
;
44 struct ltdb_req_spy
*spy
;
47 const struct ldb_parse_tree
*tree
;
50 const char * const *attrs
;
51 struct tevent_timer
*timeout_event
;
57 /* special record types */
58 #define LTDB_INDEX "@INDEX"
59 #define LTDB_INDEXLIST "@INDEXLIST"
60 #define LTDB_IDX "@IDX"
61 #define LTDB_IDXVERSION "@IDXVERSION"
62 #define LTDB_IDXATTR "@IDXATTR"
63 #define LTDB_IDXONE "@IDXONE"
64 #define LTDB_BASEINFO "@BASEINFO"
65 #define LTDB_OPTIONS "@OPTIONS"
66 #define LTDB_ATTRIBUTES "@ATTRIBUTES"
68 /* special attribute types */
69 #define LTDB_SEQUENCE_NUMBER "sequenceNumber"
70 #define LTDB_CHECK_BASE "checkBaseOnSearch"
71 #define LTDB_DISALLOW_DN_FILTER "disallowDNFilter"
72 #define LTDB_MOD_TIMESTAMP "whenChanged"
73 #define LTDB_OBJECTCLASS "objectClass"
75 /* The following definitions come from lib/ldb/ldb_tdb/ldb_cache.c */
77 int ltdb_cache_reload(struct ldb_module
*module
);
78 int ltdb_cache_load(struct ldb_module
*module
);
79 int ltdb_increase_sequence_number(struct ldb_module
*module
);
80 int ltdb_check_at_attributes_values(const struct ldb_val
*value
);
82 /* The following definitions come from lib/ldb/ldb_tdb/ldb_index.c */
84 struct ldb_parse_tree
;
86 int ltdb_search_indexed(struct ltdb_context
*ctx
, uint32_t *);
87 int ltdb_index_add_new(struct ldb_module
*module
,
88 struct ltdb_private
*ltdb
,
89 const struct ldb_message
*msg
);
90 int ltdb_index_delete(struct ldb_module
*module
, const struct ldb_message
*msg
);
91 int ltdb_index_del_element(struct ldb_module
*module
,
92 struct ltdb_private
*ltdb
,
94 struct ldb_message_element
*el
);
95 int ltdb_index_add_element(struct ldb_module
*module
,
96 struct ltdb_private
*ltdb
,
98 struct ldb_message_element
*el
);
99 int ltdb_index_del_value(struct ldb_module
*module
,
100 struct ltdb_private
*ltdb
,
102 struct ldb_message_element
*el
, unsigned int v_idx
);
103 int ltdb_reindex(struct ldb_module
*module
);
104 int ltdb_index_transaction_start(struct ldb_module
*module
);
105 int ltdb_index_transaction_commit(struct ldb_module
*module
);
106 int ltdb_index_transaction_cancel(struct ldb_module
*module
);
108 /* The following definitions come from lib/ldb/ldb_tdb/ldb_search.c */
110 int ltdb_has_wildcard(struct ldb_module
*module
, const char *attr_name
,
111 const struct ldb_val
*val
);
112 void ltdb_search_dn1_free(struct ldb_module
*module
, struct ldb_message
*msg
);
113 int ltdb_search_dn1(struct ldb_module
*module
, struct ldb_dn
*dn
, struct ldb_message
*msg
,
114 unsigned int unpack_flags
);
115 int ltdb_search_key(struct ldb_module
*module
, struct ltdb_private
*ltdb
,
116 struct TDB_DATA tdb_key
,
117 struct ldb_message
*msg
,
118 unsigned int unpack_flags
);
119 int ltdb_filter_attrs(TALLOC_CTX
*mem_ctx
,
120 const struct ldb_message
*msg
, const char * const *attrs
,
121 struct ldb_message
**filtered_msg
);
122 int ltdb_search(struct ltdb_context
*ctx
);
124 /* The following definitions come from lib/ldb/ldb_tdb/ldb_tdb.c */
125 int ltdb_lock_read(struct ldb_module
*module
);
126 int ltdb_unlock_read(struct ldb_module
*module
);
128 * Determine if this key could hold a record. We allow the new GUID
129 * index, the old DN index and a possible future ID=
131 bool ltdb_key_is_record(TDB_DATA key
);
132 TDB_DATA
ltdb_key_dn(struct ldb_module
*module
, struct ldb_dn
*dn
);
133 TDB_DATA
ltdb_key_msg(struct ldb_module
*module
, const struct ldb_message
*msg
);
134 int ltdb_store(struct ldb_module
*module
, const struct ldb_message
*msg
, int flgs
);
135 int ltdb_modify_internal(struct ldb_module
*module
, const struct ldb_message
*msg
, struct ldb_request
*req
);
136 int ltdb_delete_noindex(struct ldb_module
*module
, struct ldb_dn
*dn
);
137 int ltdb_err_map(enum TDB_ERROR tdb_code
);
139 struct tdb_context
*ltdb_wrap_open(TALLOC_CTX
*mem_ctx
,
140 const char *path
, int hash_size
, int tdb_flags
,
141 int open_flags
, mode_t mode
,
142 struct ldb_context
*ldb
);