2 OpenChange Storage Abstraction Layer library
6 Copyright (C) Julien Kerihuel 2009-2011
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
28 \brief MAPISTORE general API
30 This header contains general functions, primarily for
31 users of the store (rather than storage providers).
42 #include <sys/types.h>
53 #include <util/debug.h>
55 #include "libmapi/libmapi.h"
57 #include "mapistore_defs.h"
59 typedef int (*init_backend_fn) (void);
61 #define MAPISTORE_INIT_MODULE "mapistore_init_backend"
63 /* Forward declaration */
64 struct mapistoredb_context;
66 struct indexing_context_list;
68 struct backend_context {
69 const struct mapistore_backend *backend;
71 struct indexing_context_list *indexing;
77 struct backend_context_list {
78 struct backend_context *ctx;
79 struct backend_context_list *prev;
80 struct backend_context_list *next;
83 struct processing_context;
85 struct mapistore_context {
86 struct processing_context *processing_ctx;
87 struct backend_context_list *context_list;
88 struct indexing_context_list *indexing_list;
92 struct indexing_folders_list {
99 #define __BEGIN_DECLS extern "C" {
100 #define __END_DECLS }
102 #define __BEGIN_DECLS
109 /* definitions from mapistore_interface.c */
110 struct mapistore_context *mapistore_init(TALLOC_CTX *, const char *);
111 enum MAPISTORE_ERROR mapistore_release(struct mapistore_context *);
112 enum MAPISTORE_ERROR mapistore_add_context(struct mapistore_context *, const char *, uint32_t *);
113 enum MAPISTORE_ERROR mapistore_add_context_ref_count(struct mapistore_context *, uint32_t);
114 enum MAPISTORE_ERROR mapistore_del_context(struct mapistore_context *, uint32_t);
115 enum MAPISTORE_ERROR mapistore_create_uri(struct mapistore_context *, uint32_t, const char *, const char *, char **);
116 enum MAPISTORE_ERROR mapistore_release_record(struct mapistore_context *, uint32_t, uint64_t, uint8_t);
117 enum MAPISTORE_ERROR mapistore_search_context_by_uri(struct mapistore_context *, const char *, uint32_t *);
118 const char *mapistore_errstr(enum MAPISTORE_ERROR);
119 enum MAPISTORE_ERROR mapistore_add_context_indexing(struct mapistore_context *, const char *, uint32_t);
120 enum MAPISTORE_ERROR mapistore_opendir(struct mapistore_context *, uint32_t, uint64_t, uint64_t);
121 enum MAPISTORE_ERROR mapistore_closedir(struct mapistore_context *mstore_ctx, uint32_t, uint64_t);
122 enum MAPISTORE_ERROR mapistore_mkdir(struct mapistore_context *, uint32_t, uint64_t, uint64_t, struct SRow *);
123 enum MAPISTORE_ERROR mapistore_rmdir(struct mapistore_context *, uint32_t, uint64_t, uint64_t, uint8_t);
124 enum MAPISTORE_ERROR mapistore_get_folder_count(struct mapistore_context *, uint32_t, uint64_t, uint32_t *);
125 enum MAPISTORE_ERROR mapistore_get_message_count(struct mapistore_context *, uint32_t, uint64_t, uint32_t *);
126 enum MAPISTORE_ERROR mapistore_get_table_property(struct mapistore_context *, uint32_t, enum MAPISTORE_TABLE_TYPE, uint64_t,
127 enum MAPITAGS, uint32_t, void **);
128 enum MAPISTORE_ERROR mapistore_openmessage(struct mapistore_context *, uint32_t, uint64_t, uint64_t, struct mapistore_message *);
129 enum MAPISTORE_ERROR mapistore_createmessage(struct mapistore_context *, uint32_t, uint64_t, uint64_t);
130 enum MAPISTORE_ERROR mapistore_savechangesmessage(struct mapistore_context *, uint32_t, uint64_t, uint8_t);
131 enum MAPISTORE_ERROR mapistore_submitmessage(struct mapistore_context *, uint32_t, uint64_t, uint8_t);
132 enum MAPISTORE_ERROR mapistore_getprops(struct mapistore_context *, uint32_t, uint64_t, uint8_t, struct SPropTagArray *, struct SRow *);
133 enum MAPISTORE_ERROR mapistore_get_fid_by_name(struct mapistore_context *, uint32_t, uint64_t, const char *, uint64_t*);
134 enum MAPISTORE_ERROR mapistore_setprops(struct mapistore_context *, uint32_t, uint64_t, uint8_t, struct SRow *);
135 enum MAPISTORE_ERROR mapistore_get_child_fids(struct mapistore_context *, uint32_t, uint64_t, uint64_t **, uint32_t *);
136 enum MAPISTORE_ERROR mapistore_deletemessage(struct mapistore_context *, uint32_t, uint64_t, enum MAPISTORE_DELETION_TYPE);
138 /* definitions from mapistore_processing.c */
139 enum MAPISTORE_ERROR mapistore_set_mapping_path(const char *);
140 enum MAPISTORE_ERROR mapistore_set_database_path(const char *);
141 const char *mapistore_get_database_path(void);
142 enum MAPISTORE_ERROR mapistore_set_firstorgdn(const char *, const char *, const char *);
143 const char *mapistore_get_firstorgdn(void);
145 /* definitions from mapistore_backend.c */
146 const char *mapistore_backend_get_installdir(void);
147 init_backend_fn *mapistore_backend_load(TALLOC_CTX *, const char *);
148 struct backend_context *mapistore_backend_lookup(struct backend_context_list *, uint32_t);
149 struct backend_context *mapistore_backend_lookup_by_uri(struct backend_context_list *, const char *);
150 bool mapistore_backend_run_init(init_backend_fn *);
152 /* definitions from mapistoredb.c */
153 struct mapistoredb_context *mapistoredb_init(TALLOC_CTX *, const char *);
154 void mapistoredb_release(struct mapistoredb_context *);
155 enum MAPISTORE_ERROR mapistoredb_provision(struct mapistoredb_context *);
156 enum MAPISTORE_ERROR mapistoredb_get_mapistore_uri(struct mapistoredb_context *, enum MAPISTORE_DFLT_FOLDERS, const char *, const char *, char **);
157 enum MAPISTORE_ERROR mapistoredb_get_new_fmid(struct mapistoredb_context *, uint64_t *);
158 enum MAPISTORE_ERROR mapistoredb_get_new_allocation_range(struct mapistoredb_context *, uint64_t, uint64_t *, uint64_t *);
160 /* definitions from mapistoredb_conf.c */
161 void mapistoredb_dump_conf(struct mapistoredb_context *);
162 enum MAPISTORE_ERROR mapistoredb_set_netbiosname(struct mapistoredb_context *, const char *);
163 enum MAPISTORE_ERROR mapistoredb_set_firstorg(struct mapistoredb_context *, const char *);
164 enum MAPISTORE_ERROR mapistoredb_set_firstou(struct mapistoredb_context *, const char *);
165 const char* mapistoredb_get_netbiosname(struct mapistoredb_context *);
166 const char* mapistoredb_get_firstorg(struct mapistoredb_context *);
167 const char* mapistoredb_get_firstou(struct mapistoredb_context *);
169 /* definitions from mapistore_indexing.c */
170 enum MAPISTORE_ERROR mapistore_indexing_add(struct mapistore_context *, const char *);
171 enum MAPISTORE_ERROR mapistore_indexing_del(struct mapistore_context *, const char *);
172 enum MAPISTORE_ERROR mapistore_indexing_get_folder_list(struct mapistore_context *, const char *, uint64_t, struct indexing_folders_list **);
173 enum MAPISTORE_ERROR mapistore_indexing_record_add_fid(struct mapistore_context *, uint32_t, uint64_t);
174 enum MAPISTORE_ERROR mapistore_indexing_record_del_fid(struct mapistore_context *, uint32_t, uint64_t, enum MAPISTORE_DELETION_TYPE);
175 enum MAPISTORE_ERROR mapistore_indexing_record_add_mid(struct mapistore_context *, uint32_t, uint64_t);
176 enum MAPISTORE_ERROR mapistore_indexing_record_del_mid(struct mapistore_context *, uint32_t, uint64_t, enum MAPISTORE_DELETION_TYPE);
178 /* definitions from mapistore_namedprops.c */
179 int mapistore_namedprops_get_mapped_id(void *ldb_ctx, struct MAPINAMEID, uint16_t *);
183 #endif /* ! __MAPISTORE_H */