OpenChange mapistore library 2.0 API Documentation

- Main Page
- Files

- File List
- Globals

Functions
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_info | pointer to the connection information
  backend | the name of the backend
  vuser | the 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_info | pointer to the connection information
  backend | the name of the backend
  vuser | the 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_ctx | Pointer to the mapistore management context
  backend | the name of the backend
  username | the name of the user in the backend
  folder | the name of the folder in the backend
  message | the name of the message in the backend
  uri | pointer 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 | ) |
| read

Initialize a mapistore manager context.

Parameters

  mstore_ctx | Pointer 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_ctx | Pointer to the mapistore management context
  backend | the backend for which we register the message
  sysuser | the name of the openchage user
  mid | the message ID to register
  uri | partial URI without message extension
  messageID | the message identifier in the backend
  registered_uri | pointer 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_ctx | pointer to the mapistore management context
  backend | pointer to the backend name

Returns
  MAPISTORE_SUCCESS on success, otherwise MAPISTORE error

References mapistore_backend_registered(), and MAPISTORE_ERR_INVALID_PARAMETER.

_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_ctx | pointer to the mapistore management context
  username | the username to lookup
  folderURI | the mapistore URI to lookup
  NotificationFlags | the subscription type

Returns
  MAPISTORE_SUCCESS on success, otherwise MAPISTORE error

References MAPISTORE_ERR_INVALID_PARAMETER, 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_ctx | Pointer to the mapistore management context
  backend | the name of the backend
  sysuser | the name of the mapistore user (openchange)
  username | the name of the user on the remote system the backend manages
  folder | the name of the folder on the remote system the backend manages
  message | the 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
| ) |  |
| read

Retrieve the list of registered usernames

Parameters

  mgmt_ctx | pointer to the mapistore management context
  backend | the name of the backend to lookup
  vuser | the 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_ctx | pointer 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_ctx | pointer to the mapistore management context
  verbose | boolean value that sets or unset verbosity

Returns
  MAPISTORE_SUCCESS on success, otherwise MAPISTORE error

References MAPISTORE_ERR_NOT_INITIALIZED, and MAPISTORE_SUCCESS.

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