r25068: Older samba3 DCs will return DCERPC_FAULT_OP_RNG_ERROR for every opcode on the
[Samba.git] / source / lib / ldb / ldb_tdb / ldb_tdb.h
blob42f3dc242122eb2309f9f4887e428c406e577271
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 /* the low level tdb seqnum - used to avoid loading BASEINFO when
25 possible */
26 int tdb_seqnum;
28 struct ltdb_cache {
29 struct ldb_message *indexlist;
30 struct ldb_message *attributes;
31 struct ldb_message *subclasses;
33 struct {
34 char *name;
35 int flags;
36 } last_attribute;
37 } *cache;
41 the async local context
42 holds also internal search state during a full db search
44 struct ltdb_context {
45 struct ldb_module *module;
47 /* search stuff */
48 const struct ldb_parse_tree *tree;
49 const struct ldb_dn *base;
50 enum ldb_scope scope;
51 const char * const *attrs;
53 /* async stuff */
54 void *context;
55 int (*callback)(struct ldb_context *, void *, struct ldb_reply *);
58 /* special record types */
59 #define LTDB_INDEX "@INDEX"
60 #define LTDB_INDEXLIST "@INDEXLIST"
61 #define LTDB_IDX "@IDX"
62 #define LTDB_IDXATTR "@IDXATTR"
63 #define LTDB_BASEINFO "@BASEINFO"
64 #define LTDB_ATTRIBUTES "@ATTRIBUTES"
65 #define LTDB_SUBCLASSES "@SUBCLASSES"
67 /* special attribute types */
68 #define LTDB_SEQUENCE_NUMBER "sequenceNumber"
69 #define LTDB_MOD_TIMESTAMP "whenChanged"
70 #define LTDB_OBJECTCLASS "objectClass"
72 /* The following definitions come from lib/ldb/ldb_tdb/ldb_cache.c */
74 int ltdb_cache_reload(struct ldb_module *module);
75 int ltdb_cache_load(struct ldb_module *module);
76 int ltdb_increase_sequence_number(struct ldb_module *module);
77 int ltdb_check_at_attributes_values(const struct ldb_val *value);
79 /* The following definitions come from lib/ldb/ldb_tdb/ldb_index.c */
81 struct ldb_parse_tree;
83 int ltdb_search_indexed(struct ldb_handle *handle);
84 int ltdb_index_add(struct ldb_module *module, const struct ldb_message *msg);
85 int ltdb_index_del(struct ldb_module *module, const struct ldb_message *msg);
86 int ltdb_reindex(struct ldb_module *module);
88 /* The following definitions come from lib/ldb/ldb_tdb/ldb_pack.c */
90 int ltdb_pack_data(struct ldb_module *module,
91 const struct ldb_message *message,
92 struct TDB_DATA *data);
93 void ltdb_unpack_data_free(struct ldb_module *module,
94 struct ldb_message *message);
95 int ltdb_unpack_data(struct ldb_module *module,
96 const struct TDB_DATA *data,
97 struct ldb_message *message);
99 /* The following definitions come from lib/ldb/ldb_tdb/ldb_search.c */
101 int ltdb_has_wildcard(struct ldb_module *module, const char *attr_name,
102 const struct ldb_val *val);
103 void ltdb_search_dn1_free(struct ldb_module *module, struct ldb_message *msg);
104 int ltdb_search_dn1(struct ldb_module *module, const struct ldb_dn *dn, struct ldb_message *msg);
105 int ltdb_add_attr_results(struct ldb_module *module,
106 TALLOC_CTX *mem_ctx,
107 struct ldb_message *msg,
108 const char * const attrs[],
109 unsigned int *count,
110 struct ldb_message ***res);
111 int ltdb_filter_attrs(struct ldb_message *msg, const char * const *attrs);
112 int ltdb_search(struct ldb_module *module, struct ldb_request *req);
114 /* The following definitions come from lib/ldb/ldb_tdb/ldb_tdb.c */
115 struct ldb_handle *init_ltdb_handle(struct ltdb_private *ltdb, struct ldb_module *module,
116 struct ldb_request *req);
117 struct TDB_DATA ltdb_key(struct ldb_module *module, const struct ldb_dn *dn);
118 int ltdb_store(struct ldb_module *module, const struct ldb_message *msg, int flgs);
119 int ltdb_delete_noindex(struct ldb_module *module, const struct ldb_dn *dn);
120 int ltdb_modify_internal(struct ldb_module *module, const struct ldb_message *msg);
122 int ltdb_index_del_value(struct ldb_module *module, const char *dn,
123 struct ldb_message_element *el, int v_idx);
125 struct tdb_context *ltdb_wrap_open(TALLOC_CTX *mem_ctx,
126 const char *path, int hash_size, int tdb_flags,
127 int open_flags, mode_t mode,
128 struct ldb_context *ldb);