control.h

Go to the documentation of this file.
00001 /*
00002  * Asterisk -- An open source telephony toolkit.
00003  *
00004  * Copyright (C) 2013, Digium, Inc.
00005  *
00006  * David M. Lee, II <dlee@digium.com>
00007  *
00008  * See http://www.asterisk.org for more information about
00009  * the Asterisk project. Please do not directly contact
00010  * any of the maintainers of this project for assistance;
00011  * the project provides a web site, mailing lists and IRC
00012  * channels for your use.
00013  *
00014  * This program is free software, distributed under the terms of
00015  * the GNU General Public License Version 2. See the LICENSE file
00016  * at the top of the source tree.
00017  */
00018 
00019 #ifndef _ASTERISK_RES_STASIS_CONTROL_H
00020 #define _ASTERISK_RES_STASIS_CONTROL_H
00021 
00022 /*! \file
00023  *
00024  * \brief Internal API for the Stasis application controller.
00025  *
00026  * \author David M. Lee, II <dlee@digium.com>
00027  * \since 12
00028  */
00029 
00030 #include "asterisk/stasis_app.h"
00031 
00032 /*!
00033  * \brief Create a control object.
00034  *
00035  * \param channel Channel to control.
00036  * \param app stasis_app for which this control is being created.
00037  *
00038  * \return New control object.
00039  * \return \c NULL on error.
00040  */
00041 struct stasis_app_control *control_create(struct ast_channel *channel, struct stasis_app *app);
00042 
00043 /*!
00044  * \brief Dispatch all commands enqueued to this control.
00045  *
00046  * \param control Control object to dispatch.
00047  * \param chan Associated channel.
00048  * \return Number of commands executed
00049  */
00050 int control_dispatch_all(struct stasis_app_control *control,
00051    struct ast_channel *chan);
00052 
00053 /*!
00054  * \brief Blocks until \a control's command queue has a command available.
00055  *
00056  * \param control Control to block on.
00057  */
00058 void control_wait(struct stasis_app_control *control);
00059 
00060 /*!
00061  * \brief Returns the count of items in a control's command queue.
00062  *
00063  * \param control Control to count commands on
00064  *
00065  * \retval number of commands in the command que
00066  */
00067 int control_command_count(struct stasis_app_control *control);
00068 
00069 /*!
00070  * \brief Returns true if control_continue() has been called on this \a control.
00071  *
00072  * \param control Control to query.
00073  * \return True (non-zero) if control_continue() has been called.
00074  * \return False (zero) otherwise.
00075  */
00076 int control_is_done(struct stasis_app_control *control);
00077 
00078 void control_mark_done(struct stasis_app_control *control);
00079 
00080 /*!
00081  * \brief Dispatch all queued prestart commands
00082  *
00083  * \param control The control for chan
00084  * \param channel The channel on which commands should be executed
00085  *
00086  * \return The number of commands executed
00087  */
00088 int control_prestart_dispatch_all(struct stasis_app_control *control,
00089    struct ast_channel *chan);
00090 
00091 /*!
00092  * \brief Returns the pointer (non-reffed) to the app associated with this control
00093  *
00094  * \param control Control to query.
00095  *
00096  * \returns A pointer to the associated stasis_app
00097  */
00098 struct stasis_app *control_app(struct stasis_app_control *control);
00099 
00100 /*!
00101  * \brief Command callback for adding a channel to a bridge
00102  *
00103  * \param control The control for chan
00104  * \param channel The channel on which commands should be executed
00105  * \param bridge Data to be passed to the callback
00106  */
00107 int control_add_channel_to_bridge(
00108    struct stasis_app_control *control,
00109    struct ast_channel *chan, void *obj);
00110 
00111 
00112 #endif /* _ASTERISK_RES_STASIS_CONTROL_H */

Generated on Thu Apr 16 06:27:32 2015 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.6