int num_backends;
-
/**
- \details Register mapistore backends
-
- \param backend pointer to the mapistore backend to register
-
- \return MAPISTORE_SUCCESS on success
+ \brief Register a backend
+
+ This function registers a backend with mapistore.
+
+ The general approach is to create a mapistore_backend object within the
+ mapistore_init_backend() entry point, fill in the various structure elements
+ and function pointers, and then call mapistore_backend_register().
+
+ \code
+ enum MAPISTORE_ERROR mapistore_init_backend(void)
+ {
+ enum MAPISTORE_ERROR retval;
+ struct mapistore_backend demo_backend;
+
+ retval = mapistore_backend_init_defaults(&demo_backend);
+ MAPISTORE_RETVAL_IF(retval, retval, NULL);
+
+ demo_backend.name = "demo";
+ demo_backend.description = "this is just a demostration of the mapistore backend API";
+ demo_backend.uri_namespace = "demo://";
+ demo.init = demo_init; // calls demo_init() on startup
+ ... // more function pointers here.
+
+ mapistore_backend_register(&demo_backend);
+ if (retval != MAPISTORE_SUCCESS) {
+ MSTORE_DEBUG_ERROR(MSTORE_LEVEL_CRITICAL, "Failed to register the '%s' mapistore backend\n", demo_backend.name);
+ return retval;
+ }
+
+ return MAPISTORE_SUCCESS;
+ }
+ \endcode
+
+ \param backend pointer to the mapistore backend to register
+
+ \return MAPISTORE_SUCCESS on success
*/
-_PUBLIC_ extern enum MAPISTORE_ERROR mapistore_backend_register(const struct mapistore_backend *backend)
+_PUBLIC_ enum MAPISTORE_ERROR mapistore_backend_register(const struct mapistore_backend *backend)
{
int i;
__BEGIN_DECLS
-/*
- \brief Register a backend
-
- This function registers a backend with mapistore.
-
- The general approach is to create a mapistore_backend object within the
- mapistore_init_backend() entry point, fill in the various structure elements
- and function pointers, and then call mapistore_backend_register().
-
- \code
- enum MAPISTORE_ERROR mapistore_init_backend(void)
- {
- enum MAPISTORE_ERROR retval;
- struct mapistore_backend demo_backend;
-
- retval = mapistore_backend_init_defaults(&demo_backend);
- MAPISTORE_RETVAL_IF(retval, retval, NULL);
- demo_backend.name = "demo";
- demo_backend.description = "this is just a demostration of the mapistore backend API";
- demo_backend.uri_namespace = "demo://";
- demo.init = demo_init; // calls demo_init() on startup
- ... // more function pointers here.
-
- mapistore_backend_register(&demo_backend);
- if (retval != MAPISTORE_SUCCESS) {
- MSTORE_DEBUG_ERROR(MSTORE_LEVEL_CRITICAL, "Failed to register the '%s' mapistore backend\n", demo_backend.name);
- return retval;
- }
-
- return MAPISTORE_SUCCESS;
- }
- \endcode
- */
-extern enum MAPISTORE_ERROR mapistore_backend_register(const struct mapistore_backend *);
-extern enum MAPISTORE_ERROR mapistore_backend_init_defaults(struct mapistore_backend *);
+enum MAPISTORE_ERROR mapistore_backend_register(const struct mapistore_backend *);
+enum MAPISTORE_ERROR mapistore_backend_init_defaults(struct mapistore_backend *);
+enum MAPISTORE_ERROR mapistore_strip_ns_from_uri(const char *, char **);
+struct ldb_context *mapistore_public_ldb_connect(struct mapistore_backend_context *, const char *);
+enum MAPISTORE_ERROR mapistore_exist(struct mapistore_backend_context *, const char *, const char *);
+enum MAPISTORE_ERROR mapistore_register_folder(struct mapistore_backend_context *, const char *, const char *,
+ const char *, uint64_t);
__END_DECLS
return MAPISTORE_ERR_NOT_IMPLEMENTED;
}
-
-extern enum MAPISTORE_ERROR mapistore_backend_init_defaults(struct mapistore_backend *backend)
+/**
+ \brief Set default implementations for all the backend methods
+
+ The default implementations just fail (returning MAPISTORE_ERR_NOT_IMPLEMENTED), but
+ that is a lot better than forgetting to implement one and having the backend crash. You should
+ call this function before setting any of your own values.
+
+ \param backend the backend to set the defaults on
+
+ \return MAPISTORE_SUCCESS on success, otherwise a MAPISTORE_ERROR value
+*/
+
+enum MAPISTORE_ERROR mapistore_backend_init_defaults(struct mapistore_backend *backend)
{
/* Sanity checks */
MAPISTORE_RETVAL_IF(!backend, MAPISTORE_ERR_INVALID_PARAMETER, NULL);
backend->op_submitmessage = mapistore_op_defaults_submitmessage;
backend->op_deletemessage = mapistore_op_defaults_deletemessage;
-
/* Common semantics */
backend->op_getprops = mapistore_op_defaults_getprops;
backend->op_setprops = mapistore_op_defaults_setprops;
-
/* MAPIStoreDB/Store semantics */
backend->op_db_create_uri = mapistore_op_defaults_db_create_uri;
backend->op_db_provision_namedprops = mapistore_op_defaults_provision_namedprops;
return MAPISTORE_SUCCESS;
}
+
/**
\details Let backends register a folder and index it within
mapistore indexing database
const char *mapistore_get_named_properties_database_path(void);
const char *mapistore_get_named_properties_ldif_path(void);
-/* definition from mapistore_backend_public.c */
-struct ldb_context *mapistore_public_ldb_connect(struct mapistore_backend_context *, const char *);
-enum MAPISTORE_ERROR mapistore_exist(struct mapistore_backend_context *, const char *, const char *);
-enum MAPISTORE_ERROR mapistore_register_folder(struct mapistore_backend_context *, const char *, const char *,
- const char *, uint64_t);
-enum MAPISTORE_ERROR mapistore_strip_ns_from_uri(const char *, char **);
-
__END_DECLS
#endif /* __MAPISTORE_COMMON_H */