s3:net_idmap_delete do not lock two records at the same time
[Samba/gebeck_regimport.git] / lib / ldb / ldb_map / ldb_map_private.h
blob7faaa9970885ac888dfe1c21c411c7135ffdc496
1 #include "replace.h"
2 #include "system/filesys.h"
3 #include "system/time.h"
5 /* A handy macro to report Out of Memory conditions */
6 #define map_oom(module) ldb_set_errstring(ldb_module_get_ctx(module), talloc_asprintf(module, "Out of Memory"));
8 /* The type of search callback functions */
9 typedef int (*ldb_map_callback_t)(struct ldb_request *, struct ldb_reply *);
11 /* The special DN from which the local and remote base DNs are fetched */
12 #define MAP_DN_NAME "@MAP"
13 #define MAP_DN_FROM "@FROM"
14 #define MAP_DN_TO "@TO"
16 /* Private data structures
17 * ======================= */
19 struct map_reply {
20 struct map_reply *next;
21 struct ldb_reply *remote;
22 struct ldb_reply *local;
25 /* Context data for mapped requests */
26 struct map_context {
28 struct ldb_module *module;
29 struct ldb_request *req;
31 struct ldb_dn *local_dn;
32 const struct ldb_parse_tree *local_tree;
33 const char * const *local_attrs;
34 const char * const *remote_attrs;
35 const char * const *all_attrs;
37 struct ldb_message *local_msg;
38 struct ldb_request *remote_req;
40 struct map_reply *r_list;
41 struct map_reply *r_current;
43 /* The response continaing any controls the remote server gave */
44 struct ldb_reply *remote_done_ares;
47 /* Common operations
48 * ================= */
50 /* The following definitions come from lib/ldb/modules/ldb_map.c */
51 const struct ldb_map_context *map_get_context(struct ldb_module *module);
52 struct map_context *map_init_context(struct ldb_module *module,
53 struct ldb_request *req);
55 int ldb_next_remote_request(struct ldb_module *module, struct ldb_request *request);
57 bool map_check_local_db(struct ldb_module *module);
58 bool map_attr_check_remote(const struct ldb_map_context *data, const char *attr);
59 bool ldb_dn_check_local(struct ldb_module *module, struct ldb_dn *dn);
61 const struct ldb_map_attribute *map_attr_find_local(const struct ldb_map_context *data, const char *name);
62 const struct ldb_map_attribute *map_attr_find_remote(const struct ldb_map_context *data, const char *name);
64 const char *map_attr_map_local(void *mem_ctx, const struct ldb_map_attribute *map, const char *attr);
65 const char *map_attr_map_remote(void *mem_ctx, const struct ldb_map_attribute *map, const char *attr);
66 int map_attrs_merge(struct ldb_module *module, void *mem_ctx, const char ***attrs, const char * const *more_attrs);
68 struct ldb_val ldb_val_map_local(struct ldb_module *module, void *mem_ctx, const struct ldb_map_attribute *map, const struct ldb_val *val);
69 struct ldb_val ldb_val_map_remote(struct ldb_module *module, void *mem_ctx, const struct ldb_map_attribute *map, const struct ldb_val *val);
71 struct ldb_dn *ldb_dn_map_local(struct ldb_module *module, void *mem_ctx, struct ldb_dn *dn);
72 struct ldb_dn *ldb_dn_map_remote(struct ldb_module *module, void *mem_ctx, struct ldb_dn *dn);
73 struct ldb_dn *ldb_dn_map_rebase_remote(struct ldb_module *module, void *mem_ctx, struct ldb_dn *dn);
75 struct ldb_request *map_search_base_req(struct map_context *ac,
76 struct ldb_dn *dn,
77 const char * const *attrs,
78 const struct ldb_parse_tree *tree,
79 void *context,
80 ldb_map_callback_t callback);
81 struct ldb_request *map_build_fixup_req(struct map_context *ac,
82 struct ldb_dn *olddn,
83 struct ldb_dn *newdn,
84 void *context,
85 ldb_map_callback_t callback);
86 int map_subtree_collect_remote_simple(struct ldb_module *module, void *mem_ctx,
87 struct ldb_parse_tree **new,
88 const struct ldb_parse_tree *tree,
89 const struct ldb_map_attribute *map);
90 int map_return_fatal_error(struct ldb_request *req,
91 struct ldb_reply *ares);
92 int map_return_normal_error(struct ldb_request *req,
93 struct ldb_reply *ares,
94 int error);
96 int map_return_entry(struct map_context *ac, struct ldb_reply *ares);