mapistore_backend.c File Reference

mapistore backends management API More...

#include <string.h>
#include <dlfcn.h>
#include <dirent.h>
#include "mapistore.h"
#include "mapistore_errors.h"
#include "mapistore_private.h"
#include <dlinklist.h>
#include <samba_util.h>
#include <util/debug.h>

Functions

_PUBLIC_ enum mapistore_error mapistore_backend_add_ref_count (struct backend_context *bctx)
 
enum mapistore_error mapistore_backend_create_context (TALLOC_CTX *mem_ctx, struct mapistore_connection_info *conn_info, struct tdb_wrap *tdbwrap, const char *namespace, const char *uri, uint64_t fid, struct backend_context **context_p)
 
_PUBLIC_ enum mapistore_error mapistore_backend_delete_context (struct backend_context *bctx)
 
_PUBLIC_ const char * mapistore_backend_get_installdir (void)
 
enum mapistore_error mapistore_backend_init (TALLOC_CTX *mem_ctx, const char *path)
 
enum mapistore_error mapistore_backend_list_contexts (const char *username, struct tdb_wrap *tdbwrap, TALLOC_CTX *mem_ctx, struct mapistore_contexts_list **contexts_listP)
 
_PUBLIC_ init_backend_fn * mapistore_backend_load (TALLOC_CTX *mem_ctx, const char *path)
 
_PUBLIC_ struct backend_context * mapistore_backend_lookup (struct backend_context_list *backend_list_ctx, uint32_t context_id)
 
_PUBLIC_ struct backend_context * mapistore_backend_lookup_by_name (TALLOC_CTX *mem_ctx, const char *name)
 
_PUBLIC_ struct backend_context * mapistore_backend_lookup_by_uri (struct backend_context_list *backend_list_ctx, const char *uri)
 
_PUBLIC_ enum mapistore_error mapistore_backend_register (const void *_backend)
 
_PUBLIC_ enum mapistore_error mapistore_backend_registered (const char *name)
 
_PUBLIC_ bool mapistore_backend_run_init (init_backend_fn *fns)
 

Detailed Description

mapistore backends management API

Function Documentation

_PUBLIC_ enum mapistore_error mapistore_backend_add_ref_count ( struct backend_context *  bctx)

Increase the ref count associated to a given backend

Parameters
bctxpointer to the backend context
Returns
MAPISTORE_SUCCESS on success, otherwise MAPISTORE_ERROR

References MAPISTORE_ERROR, and MAPISTORE_SUCCESS.

Referenced by mapistore_add_context_ref_count().

enum mapistore_error mapistore_backend_create_context ( TALLOC_CTX *  mem_ctx,
struct mapistore_connection_info *  conn_info,
struct tdb_wrap *  tdbwrap,
const char *  namespace,
const char *  uri,
uint64_t  fid,
struct backend_context **  context_p 
)

Create backend context

Parameters
mem_ctxpointer to the memory context
namespacethe backend namespace
urithe backend parameters which can be passes inline
Returns
a valid backend_context pointer on success, otherwise NULL

References MAPISTORE_ERR_NOT_FOUND, and MAPISTORE_SUCCESS.

Referenced by mapistore_add_context().

_PUBLIC_ enum mapistore_error mapistore_backend_delete_context ( struct backend_context *  bctx)

Delete a context from the specified backend

Parameters
bctxpointer to the backend context
Returns
MAPISTORE_SUCCESS on success, otherwise MAPISTORE error

References MAPISTORE_ERR_REF_COUNT, and MAPISTORE_SUCCESS.

Referenced by mapistore_del_context(), and mapistore_mgmt_generate_uri().

_PUBLIC_ const char* mapistore_backend_get_installdir ( void  )

Return the full path where mapistore backends are installed.

Returns
Pointer to the full path where backends are installed.

Referenced by mapistore_backend_load().

enum mapistore_error mapistore_backend_init ( TALLOC_CTX *  mem_ctx,
const char *  path 
)

Initialize mapistore backends

Parameters
mem_ctxpointer to the memory context
pathpointer to folder where mapistore backends are installed
Returns
MAPISTORE_SUCCESS on success, otherwise MAPISTORE_ERR_BACKEND_INIT

References mapistore_backend_load(), mapistore_backend_run_init(), MAPISTORE_ERR_BACKEND_INIT, and MAPISTORE_SUCCESS.

Referenced by mapistore_init().

enum mapistore_error mapistore_backend_list_contexts ( const char *  username,
struct tdb_wrap *  tdbwrap,
TALLOC_CTX *  mem_ctx,
struct mapistore_contexts_list **  contexts_listP 
)

List backend contexts for given user

Parameters
mem_ctxpointer to the memory context
namespacethe backend namespace
urithe backend parameters which can be passes inline
Returns
a valid backend_context pointer on success, otherwise NULL

References MAPISTORE_ERR_INVALID_PARAMETER, and MAPISTORE_SUCCESS.

Referenced by mapistore_errstr().

_PUBLIC_ init_backend_fn* mapistore_backend_load ( TALLOC_CTX *  mem_ctx,
const char *  path 
)

Load the initialization functions from backends DSO

Parameters
mem_ctxpointer to the memory context
pathpointer to the backend's DSO folder
Returns
allocated array of functions pointers to initialization functions on success, otherwise NULL.

References mapistore_backend_get_installdir().

Referenced by mapistore_backend_init().

_PUBLIC_ struct backend_context* mapistore_backend_lookup ( struct backend_context_list *  backend_list_ctx,
uint32_t  context_id 
)
_PUBLIC_ struct backend_context* mapistore_backend_lookup_by_name ( TALLOC_CTX *  mem_ctx,
const char *  name 
)

Return a pointer on backend functions given its name

Parameters
mem_ctxpointer to the memory context
namethe backend name to lookup
Returns
Allocated pointer to the mapistore_backend context on success, otherwise NULL

References MAPISTORE_ERROR, and MAPISTORE_SUCCESS.

Referenced by mapistore_mgmt_generate_uri().

_PUBLIC_ struct backend_context* mapistore_backend_lookup_by_uri ( struct backend_context_list *  backend_list_ctx,
const char *  uri 
)

find the context matching given uri string

Parameters
backend_list_ctxpointer to the backend context list
urithe uri string to search
Returns
Pointer to the mapistore_backend context on success, otherwise NULL

Referenced by mapistore_search_context_by_uri().

_PUBLIC_ enum mapistore_error mapistore_backend_register ( const void *  _backend)

Register mapistore backends

Parameters
backendpointer to the mapistore backend to register
Returns
MAPISTORE_SUCCESS on success

References MAPISTORE_ERR_INVALID_PARAMETER, and MAPISTORE_SUCCESS.

_PUBLIC_ enum mapistore_error mapistore_backend_registered ( const char *  name)

Check if the specified backend is registered given its name.

Parameters
namebackend's name to lookup
Returns
MAPISTORE_SUCCESS on success, otherwise MAPISTORE error

References MAPISTORE_ERR_INVALID_PARAMETER, MAPISTORE_ERR_NOT_FOUND, and MAPISTORE_SUCCESS.

Referenced by mapistore_mgmt_registered_backend().

_PUBLIC_ bool mapistore_backend_run_init ( init_backend_fn *  fns)

Run specified initialization functions.

Parameters
fnspointer to an array of mapistore backends initialization functions
Returns
true on success, otherwise false

Referenced by mapistore_backend_init().


Creative Commons License
Creative Commons Attribution icon Creative Commons Share Alike icon
This content is licensed under the Creative Commons
Attribution ShareAlike License v. 3.0:
http://creativecommons.org/licenses/by-sa/3.0/