123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226 |
- /*
- * Asterisk -- An open source telephony toolkit.
- *
- * Copyright (C) 2013, Digium, Inc.
- *
- * Richard Mudgett <rmudgett@digium.com>
- *
- * See http://www.asterisk.org for more information about
- * the Asterisk project. Please do not directly contact
- * any of the maintainers of this project for assistance;
- * the project provides a web site, mailing lists and IRC
- * channels for your use.
- *
- * This program is free software, distributed under the terms of
- * the GNU General Public License Version 2. See the LICENSE file
- * at the top of the source tree.
- */
- /*!
- * \file
- * \brief Core external MWI support.
- *
- * \author Richard Mudgett <rmudgett@digium.com>
- *
- * See Also:
- * \arg \ref AstCREDITS
- */
- #ifndef _ASTERISK_RES_MWI_EXTERNAL_H
- #define _ASTERISK_RES_MWI_EXTERNAL_H
- #if defined(__cplusplus) || defined(c_plusplus)
- extern "C"
- {
- #endif
- /* ------------------------------------------------------------------- */
- /*!
- * \brief Increase the external MWI resource module reference count.
- * \since 12.1.0
- *
- * \return Nothing
- */
- void ast_mwi_external_ref(void);
- /*!
- * \brief Decrease the external MWI resource module reference count.
- * \since 12.1.0
- *
- * \return Nothing
- */
- void ast_mwi_external_unref(void);
- struct ast_mwi_mailbox_object;
- /*! \brief Convienience unref function for mailbox object. */
- #define ast_mwi_mailbox_unref(mailbox) ao2_ref((struct ast_mwi_mailbox_object *) mailbox, -1)
- /*!
- * \brief Allocate an external MWI object.
- * \since 12.1.0
- *
- * \param mailbox_id Name of mailbox.
- *
- * \retval object on success. The object is an ao2 object.
- * \retval NULL on error.
- */
- struct ast_mwi_mailbox_object *ast_mwi_mailbox_alloc(const char *mailbox_id);
- /*!
- * \brief Get mailbox id.
- * \since 12.1.0
- *
- * \param mailbox Object to get id.
- *
- * \return mailbox_id of the object.
- *
- * \note This should never return NULL unless there is a bug in sorcery.
- */
- const char *ast_mwi_mailbox_get_id(const struct ast_mwi_mailbox_object *mailbox);
- /*!
- * \brief Get the number of new messages.
- * \since 12.1.0
- *
- * \param mailbox Object to get number of new messages.
- *
- * \return Number of new messages.
- */
- unsigned int ast_mwi_mailbox_get_msgs_new(const struct ast_mwi_mailbox_object *mailbox);
- /*!
- * \brief Get the number of old messages.
- * \since 12.1.0
- *
- * \param mailbox Object to get number of old messages.
- *
- * \return Number of old messages.
- */
- unsigned int ast_mwi_mailbox_get_msgs_old(const struct ast_mwi_mailbox_object *mailbox);
- /*!
- * \brief Copy the external MWI counts object.
- * \since 12.1.0
- *
- * \param mailbox What to copy.
- *
- * \retval copy on success. The object is an ao2 object.
- * \retval NULL on error.
- */
- struct ast_mwi_mailbox_object *ast_mwi_mailbox_copy(const struct ast_mwi_mailbox_object *mailbox);
- /*!
- * \brief Set the number of new messages.
- * \since 12.1.0
- *
- * \param mailbox Object to set number of new messages.
- * \param num_msgs Number of messages to set.
- *
- * \return Nothing
- */
- void ast_mwi_mailbox_set_msgs_new(struct ast_mwi_mailbox_object *mailbox, unsigned int num_msgs);
- /*!
- * \brief Set the number of old messages.
- * \since 12.1.0
- *
- * \param mailbox Object to set number of old messages.
- * \param num_msgs Number of messages to set.
- *
- * \return Nothing
- */
- void ast_mwi_mailbox_set_msgs_old(struct ast_mwi_mailbox_object *mailbox, unsigned int num_msgs);
- /*!
- * \brief Update the external MWI counts with the given object.
- * \since 12.1.0
- *
- * \param mailbox What to update.
- *
- * \retval 0 on success.
- * \retval -1 on error.
- */
- int ast_mwi_mailbox_update(struct ast_mwi_mailbox_object *mailbox);
- /*!
- * \brief Delete matching external MWI object.
- * \since 12.1.0
- *
- * \param mailbox_id Name of mailbox to delete.
- *
- * \retval 0 on success.
- * \retval -1 on error.
- */
- int ast_mwi_mailbox_delete(const char *mailbox_id);
- /*!
- * \brief Delete all external MWI objects selected by the regular expression.
- * \since 12.1.0
- *
- * \param regex Regular expression in extended syntax. (NULL is same as "")
- *
- * \note The provided regex is treated as extended case sensitive.
- *
- * \retval 0 on success.
- * \retval -1 on error.
- */
- int ast_mwi_mailbox_delete_by_regex(const char *regex);
- /*!
- * \brief Delete all external MWI objects.
- * \since 12.1.0
- *
- * \retval 0 on success.
- * \retval -1 on error.
- */
- int ast_mwi_mailbox_delete_all(void);
- /*!
- * \brief Get matching external MWI object.
- * \since 12.1.0
- *
- * \param mailbox_id Name of mailbox to retrieve.
- *
- * \retval requested mailbox on success. The object is an ao2 object.
- * \retval NULL on error or no mailbox.
- *
- * \note The object must be treated as read-only.
- */
- const struct ast_mwi_mailbox_object *ast_mwi_mailbox_get(const char *mailbox_id);
- /*!
- * \brief Get all external MWI objects selected by the regular expression.
- * \since 12.1.0
- *
- * \param regex Regular expression in extended syntax. (NULL is same as "")
- *
- * \note The provided regex is treated as extended case sensitive.
- *
- * \retval container of struct ast_mwi_mailbox_object on success.
- * \retval NULL on error.
- *
- * \note The objects in the container must be treated as read-only.
- */
- struct ao2_container *ast_mwi_mailbox_get_by_regex(const char *regex);
- /*!
- * \brief Get all external MWI objects.
- * \since 12.1.0
- *
- * \retval container of struct ast_mwi_mailbox_object on success.
- * \retval NULL on error.
- *
- * \note The objects in the container must be treated as read-only.
- */
- struct ao2_container *ast_mwi_mailbox_get_all(void);
- /* ------------------------------------------------------------------- */
- #if defined(__cplusplus) || defined(c_plusplus)
- }
- #endif
- #endif /* _ASTERISK_RES_MWI_EXTERNAL_H */
|