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/>.
33 #include <sys/types.h>
44 #include <util/debug.h>
46 #include "libmapi/libmapi.h"
48 #include "mapistore_defs.h"
50 typedef int (*init_backend_fn) (void);
52 #define MAPISTORE_INIT_MODULE "mapistore_init_backend"
54 /* Forward declaration */
55 struct mapistoredb_context;
57 struct indexing_context_list;
59 struct backend_context {
60 const struct mapistore_backend *backend;
62 struct indexing_context_list *indexing;
68 struct backend_context_list {
69 struct backend_context *ctx;
70 struct backend_context_list *prev;
71 struct backend_context_list *next;
74 struct processing_context;
76 struct mapistore_context {
77 struct processing_context *processing_ctx;
78 struct backend_context_list *context_list;
79 struct indexing_context_list *indexing_list;
83 struct indexing_folders_list {
90 #define __BEGIN_DECLS extern "C" {
100 /* definitions from mapistore_interface.c */
101 struct mapistore_context *mapistore_init(TALLOC_CTX *, const char *);
102 enum MAPISTORE_ERROR mapistore_release(struct mapistore_context *);
103 enum MAPISTORE_ERROR mapistore_add_context(struct mapistore_context *, const char *, uint32_t *);
104 enum MAPISTORE_ERROR mapistore_add_context_ref_count(struct mapistore_context *, uint32_t);
105 enum MAPISTORE_ERROR mapistore_del_context(struct mapistore_context *, uint32_t);
106 enum MAPISTORE_ERROR mapistore_create_uri(struct mapistore_context *, uint32_t, const char *, const char *, char **);
107 enum MAPISTORE_ERROR mapistore_release_record(struct mapistore_context *, uint32_t, uint64_t, uint8_t);
108 enum MAPISTORE_ERROR mapistore_search_context_by_uri(struct mapistore_context *, const char *, uint32_t *);
109 const char *mapistore_errstr(enum MAPISTORE_ERROR);
110 enum MAPISTORE_ERROR mapistore_add_context_indexing(struct mapistore_context *, const char *, uint32_t);
111 enum MAPISTORE_ERROR mapistore_opendir(struct mapistore_context *, uint32_t, uint64_t, uint64_t);
112 enum MAPISTORE_ERROR mapistore_closedir(struct mapistore_context *mstore_ctx, uint32_t, uint64_t);
113 enum MAPISTORE_ERROR mapistore_mkdir(struct mapistore_context *, uint32_t, uint64_t, uint64_t, struct SRow *);
114 enum MAPISTORE_ERROR mapistore_rmdir(struct mapistore_context *, uint32_t, uint64_t, uint64_t, uint8_t);
115 enum MAPISTORE_ERROR mapistore_get_folder_count(struct mapistore_context *, uint32_t, uint64_t, uint32_t *);
116 enum MAPISTORE_ERROR mapistore_get_message_count(struct mapistore_context *, uint32_t, uint64_t, uint32_t *);
117 enum MAPISTORE_ERROR mapistore_get_table_property(struct mapistore_context *, uint32_t, uint8_t, uint64_t,
118 enum MAPITAGS, uint32_t, void **);
119 enum MAPISTORE_ERROR mapistore_openmessage(struct mapistore_context *, uint32_t, uint64_t, uint64_t, struct mapistore_message *);
120 enum MAPISTORE_ERROR mapistore_createmessage(struct mapistore_context *, uint32_t, uint64_t, uint64_t);
121 enum MAPISTORE_ERROR mapistore_savechangesmessage(struct mapistore_context *, uint32_t, uint64_t, uint8_t);
122 enum MAPISTORE_ERROR mapistore_submitmessage(struct mapistore_context *, uint32_t, uint64_t, uint8_t);
123 enum MAPISTORE_ERROR mapistore_getprops(struct mapistore_context *, uint32_t, uint64_t, uint8_t, struct SPropTagArray *, struct SRow *);
124 enum MAPISTORE_ERROR mapistore_get_fid_by_name(struct mapistore_context *, uint32_t, uint64_t, const char *, uint64_t*);
125 enum MAPISTORE_ERROR mapistore_setprops(struct mapistore_context *, uint32_t, uint64_t, uint8_t, struct SRow *);
126 enum MAPISTORE_ERROR mapistore_get_child_fids(struct mapistore_context *, uint32_t, uint64_t, uint64_t **, uint32_t *);
127 enum MAPISTORE_ERROR mapistore_deletemessage(struct mapistore_context *, uint32_t, uint64_t, uint8_t);
129 /* definitions from mapistore_processing.c */
130 enum MAPISTORE_ERROR mapistore_set_mapping_path(const char *);
131 enum MAPISTORE_ERROR mapistore_set_database_path(const char *);
132 const char *mapistore_get_database_path(void);
133 enum MAPISTORE_ERROR mapistore_set_firstorgdn(const char *, const char *, const char *);
134 const char *mapistore_get_firstorgdn(void);
136 /* definitions from mapistore_backend.c */
137 const char *mapistore_backend_get_installdir(void);
138 init_backend_fn *mapistore_backend_load(TALLOC_CTX *, const char *);
139 struct backend_context *mapistore_backend_lookup(struct backend_context_list *, uint32_t);
140 struct backend_context *mapistore_backend_lookup_by_uri(struct backend_context_list *, const char *);
141 bool mapistore_backend_run_init(init_backend_fn *);
143 /* definitions from mapistoredb.c */
144 struct mapistoredb_context *mapistoredb_init(TALLOC_CTX *, const char *);
145 void mapistoredb_release(struct mapistoredb_context *);
146 enum MAPISTORE_ERROR mapistoredb_provision(struct mapistoredb_context *);
147 enum MAPISTORE_ERROR mapistoredb_get_mapistore_uri(struct mapistoredb_context *, enum MAPISTORE_DFLT_FOLDERS, const char *, const char *, char **);
149 /* definitions from mapistoredb_conf.c */
150 void mapistoredb_dump_conf(struct mapistoredb_context *);
151 enum MAPISTORE_ERROR mapistoredb_set_netbiosname(struct mapistoredb_context *, const char *);
152 enum MAPISTORE_ERROR mapistoredb_set_firstorg(struct mapistoredb_context *, const char *);
153 enum MAPISTORE_ERROR mapistoredb_set_firstou(struct mapistoredb_context *, const char *);
154 const char* mapistoredb_get_netbiosname(struct mapistoredb_context *);
155 const char* mapistoredb_get_firstorg(struct mapistoredb_context *);
156 const char* mapistoredb_get_firstou(struct mapistoredb_context *);
158 /* definitions from mapistore_indexing.c */
159 enum MAPISTORE_ERROR mapistore_indexing_add(struct mapistore_context *, const char *);
160 enum MAPISTORE_ERROR mapistore_indexing_del(struct mapistore_context *, const char *);
161 enum MAPISTORE_ERROR mapistore_indexing_get_folder_list(struct mapistore_context *, const char *, uint64_t, struct indexing_folders_list **);
162 enum MAPISTORE_ERROR mapistore_indexing_record_add_fid(struct mapistore_context *, uint32_t, uint64_t);
163 enum MAPISTORE_ERROR mapistore_indexing_record_del_fid(struct mapistore_context *, uint32_t, uint64_t, uint8_t);
164 enum MAPISTORE_ERROR mapistore_indexing_record_add_mid(struct mapistore_context *, uint32_t, uint64_t);
165 enum MAPISTORE_ERROR mapistore_indexing_record_del_mid(struct mapistore_context *, uint32_t, uint64_t, uint8_t);
167 /* definitions from mapistore_namedprops.c */
168 int mapistore_namedprops_get_mapped_id(void *ldb_ctx, struct MAPINAMEID, uint16_t *);
172 #endif /* ! __MAPISTORE_H */