mapiproxy/libmapistore/mapistore_backend.c File Reference

mapistore backends management API More...

#include <string.h>
#include <dlfcn.h>
#include <dirent.h>
#include "mapistore.h"
#include <stdio.h>
#include <unistd.h>
#include <stdint.h>
#include <stdbool.h>
#include <tdb.h>
#include <ldb.h>
#include <talloc.h>
#include <util/debug.h>
#include "libmapi/libmapi.h"
#include "mapistore_private.h"
#include <dlinklist.h>
#include <util.h>

Functions

static init_backend_fn load_backend (const char *path)
static init_backend_fn * load_backends (TALLOC_CTX *mem_ctx, const char *path)
_PUBLIC_ int mapistore_backend_add_ref_count (struct backend_context *bctx)
struct backend_context * mapistore_backend_create_context (TALLOC_CTX *mem_ctx, const char *namespace, const char *uri)
_PUBLIC_ int mapistore_backend_delete_context (struct backend_context *bctx)
_PUBLIC_ const char * mapistore_backend_get_installdir (void)
int mapistore_backend_init (TALLOC_CTX *mem_ctx, const char *path)
_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_uri (struct backend_context_list *backend_list_ctx, const char *uri)
_PUBLIC_ int mapistore_backend_register (const void *_backend)
_PUBLIC_ bool mapistore_backend_run_init (init_backend_fn *fns)

Detailed Description

mapistore backends management API


Function Documentation

static init_backend_fn load_backend ( const char *  path  )  [static]

Obtain the backend init function from a shared library file

Parameters:
path full path to the backend shared library
Returns:
Pointer to the initialization function on success, otherwise NULL.

Referenced by load_backends().

static init_backend_fn* load_backends ( TALLOC_CTX *  mem_ctx,
const char *  path 
) [static]

Load backends from specified directory

Parameters:
mem_ctx pointer to the memory context
path name of the backend's shared library folder
Returns:
allocated array of functions pointers to initialization functions on success, otherwise NULL.

References load_backend().

Referenced by mapistore_backend_load().

_PUBLIC_ int mapistore_backend_add_ref_count ( struct backend_context *  bctx  ) 

Increase the ref count associated to a given backend

Parameters:
bctx pointer to the backend context
Returns:
MAPISTORE_SUCCESS on success, otherwise MAPISTORE_ERROR

References MAPISTORE_ERROR, and MAPISTORE_SUCCESS.

struct backend_context* mapistore_backend_create_context ( TALLOC_CTX *  mem_ctx,
const char *  namespace,
const char *  uri 
) [read]

Create backend context

Parameters:
mem_ctx pointer to the memory context
namespace the backend namespace
uri the backend parameters which can be passes inline
Returns:
a valid backend_context pointer on success, otherwise NULL

References MAPISTORE_SUCCESS.

_PUBLIC_ int mapistore_backend_delete_context ( struct backend_context *  bctx  ) 

Delete a context from the specified backend

Parameters:
bctx pointer to the backend context
Returns:
MAPISTORE_SUCCESS on success, otherwise MAPISTORE error

References MAPISTORE_ERR_REF_COUNT, and MAPISTORE_ERROR.

_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().

int mapistore_backend_init ( TALLOC_CTX *  mem_ctx,
const char *  path 
)

Initialize mapistore backends

Parameters:
mem_ctx pointer to the memory context
path pointer 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.

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

Load the initialization functions from backends DSO

Parameters:
mem_ctx pointer to the memory context
path pointer to the backend's DSO folder
Returns:
allocated array of functions pointers to initialization functions on success, otherwise NULL.

References load_backends(), and 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 
) [read]

find the context matching given context identifier

Parameters:
backend_list_ctx pointer to the backend context list
context_id the context identifier to search
Returns:
Pointer to the mapistore_backend context on success, otherwise NULL
_PUBLIC_ struct backend_context* mapistore_backend_lookup_by_uri ( struct backend_context_list *  backend_list_ctx,
const char *  uri 
) [read]

find the context matching given uri string

Parameters:
backend_list_ctx pointer to the backend context list
uri the uri string to search
Returns:
Pointer to the mapistore_backend context on success, otherwise NULL
_PUBLIC_ int mapistore_backend_register ( const void *  _backend  ) 

Register mapistore backends

Parameters:
_backend pointer to the mapistore backend to register
Returns:
MAPISTORE_SUCCESS on success

References MAPISTORE_ERR_INVALID_PARAMETER, and MAPISTORE_SUCCESS.

_PUBLIC_ bool mapistore_backend_run_init ( init_backend_fn *  fns  ) 

Run specified initialization functions.

Parameters:
fns pointer 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/