2 #include "system/filesys.h"
3 #include "system/time.h"
4 #include "tdb_compat.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 struct ldb_message
*attributes
;
22 bool one_level_indexes
;
23 bool attribute_indexes
;
29 struct ltdb_idxptr
*idxptr
;
37 struct ldb_module
*module
;
38 struct ldb_request
*req
;
40 bool request_terminated
;
41 struct ltdb_req_spy
*spy
;
44 const struct ldb_parse_tree
*tree
;
47 const char * const *attrs
;
48 struct tevent_timer
*timeout_event
;
51 /* special record types */
52 #define LTDB_INDEX "@INDEX"
53 #define LTDB_INDEXLIST "@INDEXLIST"
54 #define LTDB_IDX "@IDX"
55 #define LTDB_IDXVERSION "@IDXVERSION"
56 #define LTDB_IDXATTR "@IDXATTR"
57 #define LTDB_IDXONE "@IDXONE"
58 #define LTDB_BASEINFO "@BASEINFO"
59 #define LTDB_OPTIONS "@OPTIONS"
60 #define LTDB_ATTRIBUTES "@ATTRIBUTES"
62 /* special attribute types */
63 #define LTDB_SEQUENCE_NUMBER "sequenceNumber"
64 #define LTDB_CHECK_BASE "checkBaseOnSearch"
65 #define LTDB_MOD_TIMESTAMP "whenChanged"
66 #define LTDB_OBJECTCLASS "objectClass"
68 /* The following definitions come from lib/ldb/ldb_tdb/ldb_cache.c */
70 int ltdb_cache_reload(struct ldb_module
*module
);
71 int ltdb_cache_load(struct ldb_module
*module
);
72 int ltdb_increase_sequence_number(struct ldb_module
*module
);
73 int ltdb_check_at_attributes_values(const struct ldb_val
*value
);
75 /* The following definitions come from lib/ldb/ldb_tdb/ldb_index.c */
77 struct ldb_parse_tree
;
79 int ltdb_search_indexed(struct ltdb_context
*ctx
, uint32_t *);
80 int ltdb_index_add_new(struct ldb_module
*module
, const struct ldb_message
*msg
);
81 int ltdb_index_delete(struct ldb_module
*module
, const struct ldb_message
*msg
);
82 int ltdb_index_del_element(struct ldb_module
*module
, struct ldb_dn
*dn
,
83 struct ldb_message_element
*el
);
84 int ltdb_index_add_element(struct ldb_module
*module
, struct ldb_dn
*dn
,
85 struct ldb_message_element
*el
);
86 int ltdb_index_del_value(struct ldb_module
*module
, struct ldb_dn
*dn
,
87 struct ldb_message_element
*el
, unsigned int v_idx
);
88 int ltdb_reindex(struct ldb_module
*module
);
89 int ltdb_index_transaction_start(struct ldb_module
*module
);
90 int ltdb_index_transaction_commit(struct ldb_module
*module
);
91 int ltdb_index_transaction_cancel(struct ldb_module
*module
);
93 /* The following definitions come from lib/ldb/ldb_tdb/ldb_pack.c */
95 int ltdb_pack_data(struct ldb_module
*module
,
96 const struct ldb_message
*message
,
98 void ltdb_unpack_data_free(struct ldb_module
*module
,
99 struct ldb_message
*message
);
100 int ltdb_unpack_data(struct ldb_module
*module
,
101 const TDB_DATA
*data
,
102 struct ldb_message
*message
);
104 /* The following definitions come from lib/ldb/ldb_tdb/ldb_search.c */
106 int ltdb_has_wildcard(struct ldb_module
*module
, const char *attr_name
,
107 const struct ldb_val
*val
);
108 void ltdb_search_dn1_free(struct ldb_module
*module
, struct ldb_message
*msg
);
109 int ltdb_search_dn1(struct ldb_module
*module
, struct ldb_dn
*dn
, struct ldb_message
*msg
);
110 int ltdb_add_attr_results(struct ldb_module
*module
,
112 struct ldb_message
*msg
,
113 const char * const attrs
[],
115 struct ldb_message
***res
);
116 int ltdb_filter_attrs(struct ldb_message
*msg
, const char * const *attrs
);
117 int ltdb_search(struct ltdb_context
*ctx
);
119 /* The following definitions come from lib/ldb/ldb_tdb/ldb_tdb.c */
120 int ltdb_lock_read(struct ldb_module
*module
);
121 int ltdb_unlock_read(struct ldb_module
*module
);
122 TDB_DATA
ltdb_key(struct ldb_module
*module
, struct ldb_dn
*dn
);
123 int ltdb_store(struct ldb_module
*module
, const struct ldb_message
*msg
, int flgs
);
124 int ltdb_modify_internal(struct ldb_module
*module
, const struct ldb_message
*msg
, struct ldb_request
*req
);
125 int ltdb_delete_noindex(struct ldb_module
*module
, struct ldb_dn
*dn
);
126 int ltdb_err_map(enum TDB_ERROR tdb_code
);
128 struct tdb_context
*ltdb_wrap_open(TALLOC_CTX
*mem_ctx
,
129 const char *path
, int hash_size
, int tdb_flags
,
130 int open_flags
, mode_t mode
,
131 struct ldb_context
*ldb
);