mapistore_mgmt.c File Reference

Provides mapistore management routine for administrative/services tools. More...

#include "mapiproxy/libmapistore/mapistore.h"
#include "mapiproxy/libmapistore/mapistore_errors.h"
#include "mapiproxy/libmapistore/mapistore_private.h"
#include "mapiproxy/libmapistore/mgmt/mapistore_mgmt.h"
#include "mapiproxy/libmapistore/mgmt/gen_ndr/ndr_mapistore_mgmt.h"

Functions

_PUBLIC_ enum mapistore_error mapistore_mgmt_generate_uri (struct mapistore_mgmt_context *mgmt_ctx, const char *backend, const char *username, const char *folder, const char *message, const char *rootURI, char **uri)
 
_PUBLIC_ struct mapistore_mgmt_context * mapistore_mgmt_init (struct mapistore_context *mstore_ctx)
 
_PUBLIC_ enum mapistore_error mapistore_mgmt_register_message (struct mapistore_mgmt_context *mgmt_ctx, const char *backend, const char *sysuser, uint64_t mid, const char *rootURI, const char *messageID, char **registered_uri)
 
_PUBLIC_ enum mapistore_error mapistore_mgmt_registered_backend (struct mapistore_mgmt_context *mgmt_ctx, const char *backend)
 
_PUBLIC_ enum mapistore_error mapistore_mgmt_registered_folder_subscription (struct mapistore_mgmt_context *mgmt_ctx, const char *username, const char *folderURI, uint16_t NotificationFlags)
 
_PUBLIC_ enum mapistore_error mapistore_mgmt_registered_message (struct mapistore_mgmt_context *mgmt_ctx, const char *backend, const char *sysuser, const char *username, const char *folder, const char *rootURI, const char *message)
 
_PUBLIC_ struct mapistore_mgmt_users_list * mapistore_mgmt_registered_users (struct mapistore_mgmt_context *mgmt_ctx, const char *backend, const char *vuser)
 
_PUBLIC_ enum mapistore_error mapistore_mgmt_release (struct mapistore_mgmt_context *mgmt_ctx)
 
_PUBLIC_ enum mapistore_error mapistore_mgmt_set_verbosity (struct mapistore_mgmt_context *mgmt_ctx, bool verbose)
 

Detailed Description

Provides mapistore management routine for administrative/services tools.

Using this interface virtually restrict mapistore features to the specific management functions subset.

Function Documentation

_PUBLIC_ enum mapistore_error mapistore_mgmt_generate_uri ( struct mapistore_mgmt_context *  mgmt_ctx,
const char *  backend,
const char *  username,
const char *  folder,
const char *  message,
const char *  rootURI,
char **  uri 
)

Register the mapping between a system user and a backend user for a specific backend.

Parameters
conn_infopointer to the connection information
backendthe name of the backend
vuserthe name of the matching user in the backend
Returns
MAPISTORE_SUCCESS on success, otherwise MAPISTORE error

Unregister the mapping between a system user and a backend user for a specific backend.

Parameters
conn_infopointer to the connection information
backendthe name of the backend
vuserthe name of the matching user in the backend
Returns
MAPISTORE_SUCCESS on success, otherwise MAPISTORE error

Retrieves a partial or complete URI from the backend depending on the specified parameters. This function is used by the mapistore management interface to get from backend either the expected URI for further registration or a partial (backend compliant) URI for partial search.

Parameters
mgmt_ctxPointer to the mapistore management context
backendthe name of the backend
usernamethe name of the user in the backend
folderthe name of the folder in the backend
messagethe name of the message in the backend
uripointer on pointer to the URI to return
Note
The returned uri is allocated and needs to be free'd using talloc_free() upon end of use.
Returns
MAPISTORE_SUCCESS on success, otherwise MAPISTORE error

References mapistore_backend_delete_context(), mapistore_backend_lookup_by_name(), MAPISTORE_ERR_INVALID_PARAMETER, MAPISTORE_ERR_NOT_INITIALIZED, and MAPISTORE_SUCCESS.

Referenced by mapistore_mgmt_register_message(), and mapistore_mgmt_registered_message().

_PUBLIC_ struct mapistore_mgmt_context* mapistore_mgmt_init ( struct mapistore_context *  mstore_ctx)

Initialize a mapistore manager context.

Parameters
mstore_ctxPointer to an existing mapistore_context
Returns
allocated mapistore_mgmt context on success, otherwise NULL

TODO: fix signal handler before restoring this code sa.sa_sigaction = mgmt_ipc_notif_handler; sigemptyset(&sa.sa_mask); sa.sa_flags = SA_SIGINFO; if (sigaction(SIGIO, &sa, NULL) == -1) { perror("sigaction"); talloc_free(mgmt_ctx); return NULL; } se.sigev_notify = SIGEV_SIGNAL; se.sigev_signo = SIGIO; se.sigev_value.sival_ptr = (void *) mgmt_ctx; if (mq_notify(mgmt_ctx->mq_ipc, &se) == -1) { perror("mq_notify"); talloc_free(mgmt_ctx); return NULL; }

_PUBLIC_ enum mapistore_error mapistore_mgmt_register_message ( struct mapistore_mgmt_context *  mgmt_ctx,
const char *  backend,
const char *  sysuser,
uint64_t  mid,
const char *  rootURI,
const char *  messageID,
char **  registered_uri 
)

Register a message in the indexing database of the user

Parameters
mgmt_ctxPointer to the mapistore management context
backendthe backend for which we register the message
sysuserthe name of the openchage user
midthe message ID to register
uripartial URI without message extension
messageIDthe message identifier in the backend
registered_uripointer on pointer to the registered MAPIStore URI
Returns
MAPISTORE_SUCCESS on success, otherwise MAPISTORE error

References mapistore_indexing_add(), mapistore_mgmt_generate_uri(), and MAPISTORE_SUCCESS.

_PUBLIC_ enum mapistore_error mapistore_mgmt_registered_backend ( struct mapistore_mgmt_context *  mgmt_ctx,
const char *  backend 
)

Check if the specified backend is registered in mapistore

Parameters
mgmt_ctxpointer to the mapistore management context
backendpointer to the backend name
Returns
MAPISTORE_SUCCESS on success, otherwise MAPISTORE error

References mapistore_backend_registered(), MAPISTORE_ERR_INVALID_DATA, MAPISTORE_ERR_INVALID_PARAMETER, MAPISTORE_ERR_MSG_SEND, MAPISTORE_ERR_NOT_INITIALIZED, and MAPISTORE_SUCCESS.

_PUBLIC_ enum mapistore_error mapistore_mgmt_registered_folder_subscription ( struct mapistore_mgmt_context *  mgmt_ctx,
const char *  username,
const char *  folderURI,
uint16_t  NotificationFlags 
)

Check if the subscription described by NotificationFlags has been registered for specified folder.

Parameters
mgmt_ctxpointer to the mapistore management context
usernamethe username to lookup
folderURIthe mapistore URI to lookup
NotificationFlagsthe subscription type
Returns
MAPISTORE_SUCCESS on success, otherwise MAPISTORE error

References MAPISTORE_ERR_INVALID_DATA, MAPISTORE_ERR_INVALID_PARAMETER, MAPISTORE_ERR_MSG_SEND, MAPISTORE_ERR_NOT_FOUND, MAPISTORE_ERR_NOT_INITIALIZED, and MAPISTORE_SUCCESS.

Referenced by mapistore_mgmt_send_newmail_notification().

_PUBLIC_ enum mapistore_error mapistore_mgmt_registered_message ( struct mapistore_mgmt_context *  mgmt_ctx,
const char *  backend,
const char *  sysuser,
const char *  username,
const char *  folder,
const char *  rootURI,
const char *  message 
)

Check if a message is already registered within indexing database for the user.

Parameters
mgmt_ctxPointer to the mapistore management context
backendthe name of the backend
sysuserthe name of the mapistore user (openchange)
usernamethe name of the user on the remote system the backend manages
folderthe name of the folder on the remote system the backend manages
messagethe name of the message on the remote system the backend manages
Returns
true if the message is registered, otherwise false

References mapistore_indexing_add(), mapistore_mgmt_generate_uri(), and MAPISTORE_SUCCESS.

_PUBLIC_ struct mapistore_mgmt_users_list* mapistore_mgmt_registered_users ( struct mapistore_mgmt_context *  mgmt_ctx,
const char *  backend,
const char *  vuser 
)

Retrieve the list of registered usernames

Parameters
mgmt_ctxpointer to the mapistore management context
backendthe name of the backend to lookup
vuserthe name of the virtual user to lookup
Returns
Allocated mapistore management user list on success, otherwise NULL
_PUBLIC_ enum mapistore_error mapistore_mgmt_release ( struct mapistore_mgmt_context *  mgmt_ctx)

Release the mapistore management context and destory any data associated.

Parameters
mgmt_ctxpointer to the mapistore management context
Returns
MAPISTORE_SUCCESS on success, otherwise MAPISTORE error

References MAPISTORE_ERR_NOT_INITIALIZED, and MAPISTORE_SUCCESS.

_PUBLIC_ enum mapistore_error mapistore_mgmt_set_verbosity ( struct mapistore_mgmt_context *  mgmt_ctx,
bool  verbose 
)

Set mapistore management verbosity

Parameters
mgmt_ctxpointer to the mapistore management context
verboseboolean value that sets or unset verbosity
Returns
MAPISTORE_SUCCESS on success, otherwise MAPISTORE error

References MAPISTORE_ERR_NOT_INITIALIZED, and MAPISTORE_SUCCESS.


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/