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 struct ldb_message
*attributes
;
22 bool one_level_indexes
;
23 bool attribute_indexes
;
29 bool disallow_dn_filter
;
30 struct ltdb_idxptr
*idxptr
;
39 struct ldb_module
*module
;
40 struct ldb_request
*req
;
42 bool request_terminated
;
43 struct ltdb_req_spy
*spy
;
46 const struct ldb_parse_tree
*tree
;
49 const char * const *attrs
;
50 struct tevent_timer
*timeout_event
;
53 /* special record types */
54 #define LTDB_INDEX "@INDEX"
55 #define LTDB_INDEXLIST "@INDEXLIST"
56 #define LTDB_IDX "@IDX"
57 #define LTDB_IDXVERSION "@IDXVERSION"
58 #define LTDB_IDXATTR "@IDXATTR"
59 #define LTDB_IDXONE "@IDXONE"
60 #define LTDB_BASEINFO "@BASEINFO"
61 #define LTDB_OPTIONS "@OPTIONS"
62 #define LTDB_ATTRIBUTES "@ATTRIBUTES"
64 /* special attribute types */
65 #define LTDB_SEQUENCE_NUMBER "sequenceNumber"
66 #define LTDB_CHECK_BASE "checkBaseOnSearch"
67 #define LTDB_DISALLOW_DN_FILTER "disallowDNFilter"
68 #define LTDB_MOD_TIMESTAMP "whenChanged"
69 #define LTDB_OBJECTCLASS "objectClass"
71 /* The following definitions come from lib/ldb/ldb_tdb/ldb_cache.c */
73 int ltdb_cache_reload(struct ldb_module
*module
);
74 int ltdb_cache_load(struct ldb_module
*module
);
75 int ltdb_increase_sequence_number(struct ldb_module
*module
);
76 int ltdb_check_at_attributes_values(const struct ldb_val
*value
);
78 /* The following definitions come from lib/ldb/ldb_tdb/ldb_index.c */
80 struct ldb_parse_tree
;
82 int ltdb_search_indexed(struct ltdb_context
*ctx
, uint32_t *);
83 int ltdb_index_add_new(struct ldb_module
*module
, const struct ldb_message
*msg
);
84 int ltdb_index_delete(struct ldb_module
*module
, const struct ldb_message
*msg
);
85 int ltdb_index_del_element(struct ldb_module
*module
, struct ldb_dn
*dn
,
86 struct ldb_message_element
*el
);
87 int ltdb_index_add_element(struct ldb_module
*module
, struct ldb_dn
*dn
,
88 struct ldb_message_element
*el
);
89 int ltdb_index_del_value(struct ldb_module
*module
, struct ldb_dn
*dn
,
90 struct ldb_message_element
*el
, unsigned int v_idx
);
91 int ltdb_reindex(struct ldb_module
*module
);
92 int ltdb_index_transaction_start(struct ldb_module
*module
);
93 int ltdb_index_transaction_commit(struct ldb_module
*module
);
94 int ltdb_index_transaction_cancel(struct ldb_module
*module
);
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
, struct ldb_dn
*dn
, struct ldb_message
*msg
);
102 int ltdb_add_attr_results(struct ldb_module
*module
,
104 struct ldb_message
*msg
,
105 const char * const attrs
[],
107 struct ldb_message
***res
);
108 int ltdb_filter_attrs(struct ldb_message
*msg
, const char * const *attrs
);
109 int ltdb_search(struct ltdb_context
*ctx
);
111 /* The following definitions come from lib/ldb/ldb_tdb/ldb_tdb.c */
112 int ltdb_lock_read(struct ldb_module
*module
);
113 int ltdb_unlock_read(struct ldb_module
*module
);
114 TDB_DATA
ltdb_key(struct ldb_module
*module
, struct ldb_dn
*dn
);
115 int ltdb_store(struct ldb_module
*module
, const struct ldb_message
*msg
, int flgs
);
116 int ltdb_modify_internal(struct ldb_module
*module
, const struct ldb_message
*msg
, struct ldb_request
*req
);
117 int ltdb_delete_noindex(struct ldb_module
*module
, struct ldb_dn
*dn
);
118 int ltdb_err_map(enum TDB_ERROR tdb_code
);
120 struct tdb_context
*ltdb_wrap_open(TALLOC_CTX
*mem_ctx
,
121 const char *path
, int hash_size
, int tdb_flags
,
122 int open_flags
, mode_t mode
,
123 struct ldb_context
*ldb
);