[asterisk-commits] mvanbaak: branch group/appdocsxml r135716 - in /team/group/appdocsxml: ./ app...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Aug 5 13:14:22 CDT 2008
Author: mvanbaak
Date: Tue Aug 5 13:14:22 2008
New Revision: 135716
URL: http://svn.digium.com/view/asterisk?view=rev&rev=135716
Log:
resolve, reset, go
Added:
team/group/appdocsxml/include/asterisk/datastore.h
- copied unchanged from r135681, trunk/include/asterisk/datastore.h
team/group/appdocsxml/main/datastore.c
- copied unchanged from r135681, trunk/main/datastore.c
Modified:
team/group/appdocsxml/ (props changed)
team/group/appdocsxml/apps/app_chanspy.c
team/group/appdocsxml/apps/app_dial.c
team/group/appdocsxml/apps/app_queue.c
team/group/appdocsxml/apps/app_speech_utils.c
team/group/appdocsxml/apps/app_stack.c
team/group/appdocsxml/channels/chan_iax2.c
team/group/appdocsxml/funcs/func_enum.c
team/group/appdocsxml/funcs/func_global.c
team/group/appdocsxml/funcs/func_lock.c
team/group/appdocsxml/funcs/func_odbc.c
team/group/appdocsxml/funcs/func_speex.c
team/group/appdocsxml/funcs/func_volume.c
team/group/appdocsxml/include/asterisk/channel.h
team/group/appdocsxml/include/asterisk/manager.h
team/group/appdocsxml/main/Makefile
team/group/appdocsxml/main/audiohook.c
team/group/appdocsxml/main/channel.c
team/group/appdocsxml/main/manager.c
team/group/appdocsxml/main/pbx.c
team/group/appdocsxml/pbx/pbx_dundi.c
team/group/appdocsxml/pbx/pbx_lua.c
team/group/appdocsxml/res/res_agi.c
team/group/appdocsxml/res/res_smdi.c
Propchange: team/group/appdocsxml/
------------------------------------------------------------------------------
automerge = yes please
Propchange: team/group/appdocsxml/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Aug 5 13:14:22 2008
@@ -1,1 +1,1 @@
-/trunk:1-135655
+/trunk:1-135714
Modified: team/group/appdocsxml/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/apps/app_chanspy.c?view=diff&rev=135716&r1=135715&r2=135716
==============================================================================
--- team/group/appdocsxml/apps/app_chanspy.c (original)
+++ team/group/appdocsxml/apps/app_chanspy.c Tue Aug 5 13:14:22 2008
@@ -560,7 +560,7 @@
/* chanspy_ds->chan is NULL after this call */
chanspy_ds_destroy(datastore->data);
datastore->data = NULL;
- ast_channel_datastore_free(datastore);
+ ast_datastore_free(datastore);
}
ast_channel_unlock(chan);
}
@@ -576,7 +576,7 @@
ast_mutex_lock(&chanspy_ds->lock);
- if (!(datastore = ast_channel_datastore_alloc(&chanspy_ds_info, chanspy_ds->unique_id))) {
+ if (!(datastore = ast_datastore_alloc(&chanspy_ds_info, chanspy_ds->unique_id))) {
ast_mutex_unlock(&chanspy_ds->lock);
chanspy_ds = chanspy_ds_free(chanspy_ds);
ast_channel_unlock(chan);
Modified: team/group/appdocsxml/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/apps/app_dial.c?view=diff&rev=135716&r1=135715&r2=135716
==============================================================================
--- team/group/appdocsxml/apps/app_dial.c (original)
+++ team/group/appdocsxml/apps/app_dial.c Tue Aug 5 13:14:22 2008
@@ -1747,7 +1747,7 @@
ast_copy_flags64(peerflags, &opts, OPT_DTMF_EXIT | OPT_GO_ON | OPT_ORIGINAL_CLID | OPT_CALLER_HANGUP | OPT_IGNORE_FORWARDING);
/* Create datastore for channel dial features for caller */
- if (!(ds_caller_features = ast_channel_datastore_alloc(&dial_features_info, NULL))) {
+ if (!(ds_caller_features = ast_datastore_alloc(&dial_features_info, NULL))) {
ast_log(LOG_WARNING, "Unable to create channel datastore for dial features. Aborting!\n");
goto out;
}
@@ -1809,7 +1809,7 @@
if (datastore)
dialed_interfaces = datastore->data;
else {
- if (!(datastore = ast_channel_datastore_alloc(&dialed_interface_info, NULL))) {
+ if (!(datastore = ast_datastore_alloc(&dialed_interface_info, NULL))) {
ast_log(LOG_WARNING, "Unable to create channel datastore for dialed interfaces. Aborting!\n");
ast_free(tmp);
goto out;
@@ -1915,7 +1915,7 @@
ast_copy_string(tc->exten, chan->exten, sizeof(tc->exten));
/* Save callee features */
- if (!(ds_callee_features = ast_channel_datastore_alloc(&dial_features_info, NULL))) {
+ if (!(ds_callee_features = ast_datastore_alloc(&dial_features_info, NULL))) {
ast_log(LOG_WARNING, "Unable to create channel datastore for dial features. Aborting!\n");
ast_free(tmp);
goto out;
@@ -2017,7 +2017,7 @@
* datastore again, causing a crash
*/
if (!ast_channel_datastore_remove(chan, datastore))
- ast_channel_datastore_free(datastore);
+ ast_datastore_free(datastore);
if (!peer) {
if (result) {
res = result;
Modified: team/group/appdocsxml/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/apps/app_queue.c?view=diff&rev=135716&r1=135715&r2=135716
==============================================================================
--- team/group/appdocsxml/apps/app_queue.c (original)
+++ team/group/appdocsxml/apps/app_queue.c Tue Aug 5 13:14:22 2008
@@ -3120,7 +3120,7 @@
}
ast_channel_datastore_remove(new_chan, datastore);
- ast_channel_datastore_free(datastore);
+ ast_datastore_free(datastore);
}
/*! \brief mechanism to tell if a queue caller was atxferred by a queue member.
@@ -3147,7 +3147,7 @@
}
ast_channel_lock(qe->chan);
- if (!(ds = ast_channel_datastore_alloc(&queue_transfer_info, NULL))) {
+ if (!(ds = ast_datastore_alloc(&queue_transfer_info, NULL))) {
ast_channel_unlock(qe->chan);
ast_log(LOG_WARNING, "Unable to create transfer datastore. queue_log will not show attended transfer\n");
return;
@@ -3321,7 +3321,7 @@
goto out;
}
if (!datastore) {
- if (!(datastore = ast_channel_datastore_alloc(&dialed_interface_info, NULL))) {
+ if (!(datastore = ast_datastore_alloc(&dialed_interface_info, NULL))) {
ao2_ref(cur, -1);
ao2_unlock(qe->parent);
if (use_weight)
@@ -3423,7 +3423,7 @@
* datastore again, causing a crash
*/
if (datastore && !ast_channel_datastore_remove(qe->chan, datastore)) {
- ast_channel_datastore_free(datastore);
+ ast_datastore_free(datastore);
}
ao2_lock(qe->parent);
if (qe->parent->strategy == QUEUE_STRATEGY_RRMEMORY) {
@@ -3845,7 +3845,7 @@
transfer_ds = ast_channel_datastore_find(qe->chan, &queue_transfer_info, NULL);
if (transfer_ds) {
ast_channel_datastore_remove(qe->chan, transfer_ds);
- ast_channel_datastore_free(transfer_ds);
+ ast_datastore_free(transfer_ds);
}
ast_channel_unlock(qe->chan);
}
Modified: team/group/appdocsxml/apps/app_speech_utils.c
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/apps/app_speech_utils.c?view=diff&rev=135716&r1=135715&r2=135716
==============================================================================
--- team/group/appdocsxml/apps/app_speech_utils.c (original)
+++ team/group/appdocsxml/apps/app_speech_utils.c Tue Aug 5 13:14:22 2008
@@ -364,7 +364,7 @@
return 0;
}
- datastore = ast_channel_datastore_alloc(&speech_datastore, NULL);
+ datastore = ast_datastore_alloc(&speech_datastore, NULL);
if (datastore == NULL) {
ast_speech_destroy(speech);
pbx_builtin_setvar_helper(chan, "ERROR", "1");
Modified: team/group/appdocsxml/apps/app_stack.c
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/apps/app_stack.c?view=diff&rev=135716&r1=135715&r2=135716
==============================================================================
--- team/group/appdocsxml/apps/app_stack.c (original)
+++ team/group/appdocsxml/apps/app_stack.c Tue Aug 5 13:14:22 2008
@@ -242,7 +242,7 @@
if (!stack_store) {
ast_debug(1, "Channel %s has no datastore, so we're allocating one.\n", chan->name);
- stack_store = ast_channel_datastore_alloc(&stack_info, NULL);
+ stack_store = ast_datastore_alloc(&stack_info, NULL);
if (!stack_store) {
ast_log(LOG_ERROR, "Unable to allocate new datastore. Gosub will fail.\n");
return -1;
@@ -251,7 +251,7 @@
oldlist = ast_calloc(1, sizeof(*oldlist));
if (!oldlist) {
ast_log(LOG_ERROR, "Unable to allocate datastore list head. Gosub will fail.\n");
- ast_channel_datastore_free(stack_store);
+ ast_datastore_free(stack_store);
return -1;
}
Modified: team/group/appdocsxml/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/channels/chan_iax2.c?view=diff&rev=135716&r1=135715&r2=135716
==============================================================================
--- team/group/appdocsxml/channels/chan_iax2.c (original)
+++ team/group/appdocsxml/channels/chan_iax2.c Tue Aug 5 13:14:22 2008
@@ -6474,7 +6474,7 @@
struct ast_variable *var, *prev = NULL;
AST_LIST_HEAD(, ast_var_t) *varlist;
varlist = ast_calloc(1, sizeof(*varlist));
- variablestore = ast_channel_datastore_alloc(&iax2_variable_datastore_info, NULL);
+ variablestore = ast_datastore_alloc(&iax2_variable_datastore_info, NULL);
if (variablestore && varlist && p->owner) {
variablestore->data = varlist;
variablestore->inheritance = DATASTORE_INHERIT_FOREVER;
@@ -6499,7 +6499,7 @@
if (p->owner)
ast_log(LOG_ERROR, "Memory allocation error while processing IAX2 variables\n");
if (variablestore)
- ast_channel_datastore_free(variablestore);
+ ast_datastore_free(variablestore);
if (varlist)
ast_free(varlist);
}
@@ -7967,7 +7967,7 @@
struct ast_var_t *var;
if (!variablestore) {
- variablestore = ast_channel_datastore_alloc(&iax2_variable_datastore_info, NULL);
+ variablestore = ast_datastore_alloc(&iax2_variable_datastore_info, NULL);
if (!variablestore) {
ast_log(LOG_ERROR, "Memory allocation error\n");
return -1;
@@ -8362,7 +8362,7 @@
struct ast_variable *var, *prev = NULL;
AST_LIST_HEAD(, ast_var_t) *varlist;
varlist = ast_calloc(1, sizeof(*varlist));
- variablestore = ast_channel_datastore_alloc(&iax2_variable_datastore_info, NULL);
+ variablestore = ast_datastore_alloc(&iax2_variable_datastore_info, NULL);
if (variablestore && varlist) {
variablestore->data = varlist;
variablestore->inheritance = DATASTORE_INHERIT_FOREVER;
@@ -8386,7 +8386,7 @@
} else {
ast_log(LOG_ERROR, "Memory allocation error while processing IAX2 variables\n");
if (variablestore)
- ast_channel_datastore_free(variablestore);
+ ast_datastore_free(variablestore);
if (varlist)
ast_free(varlist);
}
@@ -9139,7 +9139,7 @@
struct ast_variable *var, *prev = NULL;
AST_LIST_HEAD(, ast_var_t) *varlist;
varlist = ast_calloc(1, sizeof(*varlist));
- variablestore = ast_channel_datastore_alloc(&iax2_variable_datastore_info, NULL);
+ variablestore = ast_datastore_alloc(&iax2_variable_datastore_info, NULL);
if (variablestore && varlist) {
variablestore->data = varlist;
variablestore->inheritance = DATASTORE_INHERIT_FOREVER;
@@ -9163,7 +9163,7 @@
} else {
ast_log(LOG_ERROR, "Memory allocation error while processing IAX2 variables\n");
if (variablestore)
- ast_channel_datastore_free(variablestore);
+ ast_datastore_free(variablestore);
if (varlist)
ast_free(varlist);
}
@@ -9203,7 +9203,7 @@
struct ast_variable *var, *prev = NULL;
AST_LIST_HEAD(, ast_var_t) *varlist;
varlist = ast_calloc(1, sizeof(*varlist));
- variablestore = ast_channel_datastore_alloc(&iax2_variable_datastore_info, NULL);
+ variablestore = ast_datastore_alloc(&iax2_variable_datastore_info, NULL);
if (variablestore && varlist) {
variablestore->data = varlist;
variablestore->inheritance = DATASTORE_INHERIT_FOREVER;
@@ -9227,7 +9227,7 @@
} else {
ast_log(LOG_ERROR, "Memory allocation error while processing IAX2 variables\n");
if (variablestore)
- ast_channel_datastore_free(variablestore);
+ ast_datastore_free(variablestore);
if (varlist)
ast_free(varlist);
}
Modified: team/group/appdocsxml/funcs/func_enum.c
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/funcs/func_enum.c?view=diff&rev=135716&r1=135715&r2=135716
==============================================================================
--- team/group/appdocsxml/funcs/func_enum.c (original)
+++ team/group/appdocsxml/funcs/func_enum.c Tue Aug 5 13:14:22 2008
@@ -189,7 +189,7 @@
snprintf(buf, len, "%u", erds->id);
- if (!(datastore = ast_channel_datastore_alloc(&enum_result_datastore_info, buf))) {
+ if (!(datastore = ast_datastore_alloc(&enum_result_datastore_info, buf))) {
ast_free(erds->context);
ast_free(erds);
goto finish;
Modified: team/group/appdocsxml/funcs/func_global.c
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/funcs/func_global.c?view=diff&rev=135716&r1=135715&r2=135716
==============================================================================
--- team/group/appdocsxml/funcs/func_global.c (original)
+++ team/group/appdocsxml/funcs/func_global.c Tue Aug 5 13:14:22 2008
@@ -158,7 +158,7 @@
ast_channel_lock(chan);
if (!(varstore = ast_channel_datastore_find(chan, &shared_variable_info, NULL))) {
- if (!(varstore = ast_channel_datastore_alloc(&shared_variable_info, NULL))) {
+ if (!(varstore = ast_datastore_alloc(&shared_variable_info, NULL))) {
ast_log(LOG_ERROR, "Unable to allocate new datastore. Shared variable not set.\n");
ast_channel_unlock(chan);
return -1;
@@ -166,7 +166,7 @@
if (!(varshead = ast_calloc(1, sizeof(*varshead)))) {
ast_log(LOG_ERROR, "Unable to allocate variable structure. Shared variable not set.\n");
- ast_channel_datastore_free(varstore);
+ ast_datastore_free(varstore);
ast_channel_unlock(chan);
return -1;
}
Modified: team/group/appdocsxml/funcs/func_lock.c
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/funcs/func_lock.c?view=diff&rev=135716&r1=135715&r2=135716
==============================================================================
--- team/group/appdocsxml/funcs/func_lock.c (original)
+++ team/group/appdocsxml/funcs/func_lock.c Tue Aug 5 13:14:22 2008
@@ -96,7 +96,7 @@
if (!lock_store) {
ast_debug(1, "Channel %s has no lock datastore, so we're allocating one.\n", chan->name);
- lock_store = ast_channel_datastore_alloc(&lock_info, NULL);
+ lock_store = ast_datastore_alloc(&lock_info, NULL);
if (!lock_store) {
ast_log(LOG_ERROR, "Unable to allocate new datastore. No locks will be obtained.\n");
return -1;
@@ -105,7 +105,7 @@
list = ast_calloc(1, sizeof(*list));
if (!list) {
ast_log(LOG_ERROR, "Unable to allocate datastore list head. %sLOCK will fail.\n", try ? "TRY" : "");
- ast_channel_datastore_free(lock_store);
+ ast_datastore_free(lock_store);
return -1;
}
Modified: team/group/appdocsxml/funcs/func_odbc.c
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/funcs/func_odbc.c?view=diff&rev=135716&r1=135715&r2=135716
==============================================================================
--- team/group/appdocsxml/funcs/func_odbc.c (original)
+++ team/group/appdocsxml/funcs/func_odbc.c Tue Aug 5 13:14:22 2008
@@ -480,7 +480,7 @@
struct ast_datastore *odbc_store;
uid = ast_atomic_fetchadd_int(&resultcount, +1) + 1;
snprintf(buf, len, "%d", uid);
- odbc_store = ast_channel_datastore_alloc(&odbc_info, buf);
+ odbc_store = ast_datastore_alloc(&odbc_info, buf);
if (!odbc_store) {
ast_log(LOG_ERROR, "Rows retrieved, but unable to store it in the channel. Results fail.\n");
odbc_datastore_free(resultset);
@@ -550,7 +550,7 @@
if (!row) {
/* Cleanup datastore */
ast_channel_datastore_remove(chan, store);
- ast_channel_datastore_free(store);
+ ast_datastore_free(store);
return -1;
}
pbx_builtin_setvar_helper(chan, "~ODBCFIELDS~", resultset->names);
@@ -584,7 +584,7 @@
if (!store) /* Already freed; no big deal. */
return 0;
ast_channel_datastore_remove(chan, store);
- ast_channel_datastore_free(store);
+ ast_datastore_free(store);
return 0;
}
Modified: team/group/appdocsxml/funcs/func_speex.c
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/funcs/func_speex.c?view=diff&rev=135716&r1=135715&r2=135716
==============================================================================
--- team/group/appdocsxml/funcs/func_speex.c (original)
+++ team/group/appdocsxml/funcs/func_speex.c Tue Aug 5 13:14:22 2008
@@ -151,12 +151,12 @@
if (!(datastore = ast_channel_datastore_find(chan, &speex_datastore, NULL))) {
ast_channel_unlock(chan);
- if (!(datastore = ast_channel_datastore_alloc(&speex_datastore, NULL))) {
+ if (!(datastore = ast_datastore_alloc(&speex_datastore, NULL))) {
return 0;
}
if (!(si = ast_calloc(1, sizeof(*si)))) {
- ast_channel_datastore_free(datastore);
+ ast_datastore_free(datastore);
return 0;
}
@@ -177,7 +177,7 @@
ast_log(LOG_ERROR, "Invalid argument provided to the %s function\n", cmd);
if (is_new) {
- ast_channel_datastore_free(datastore);
+ ast_datastore_free(datastore);
return -1;
}
}
@@ -237,7 +237,7 @@
ast_audiohook_detach(&si->audiohook);
}
- ast_channel_datastore_free(datastore);
+ ast_datastore_free(datastore);
}
if (is_new) {
Modified: team/group/appdocsxml/funcs/func_volume.c
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/funcs/func_volume.c?view=diff&rev=135716&r1=135715&r2=135716
==============================================================================
--- team/group/appdocsxml/funcs/func_volume.c (original)
+++ team/group/appdocsxml/funcs/func_volume.c Tue Aug 5 13:14:22 2008
@@ -106,10 +106,10 @@
if (!(datastore = ast_channel_datastore_find(chan, &volume_datastore, NULL))) {
/* Allocate a new datastore to hold the reference to this volume and audiohook information */
- if (!(datastore = ast_channel_datastore_alloc(&volume_datastore, NULL)))
+ if (!(datastore = ast_datastore_alloc(&volume_datastore, NULL)))
return 0;
if (!(vi = ast_calloc(1, sizeof(*vi)))) {
- ast_channel_datastore_free(datastore);
+ ast_datastore_free(datastore);
return 0;
}
ast_audiohook_init(&vi->audiohook, AST_AUDIOHOOK_TYPE_MANIPULATE, "Volume");
Modified: team/group/appdocsxml/include/asterisk/channel.h
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/include/asterisk/channel.h?view=diff&rev=135716&r1=135715&r2=135716
==============================================================================
--- team/group/appdocsxml/include/asterisk/channel.h (original)
+++ team/group/appdocsxml/include/asterisk/channel.h Tue Aug 5 13:14:22 2008
@@ -150,6 +150,7 @@
#include "asterisk/utils.h"
#include "asterisk/linkedlists.h"
#include "asterisk/stringfields.h"
+#include "asterisk/datastore.h"
#define DATASTORE_INHERIT_FOREVER INT_MAX
@@ -184,37 +185,6 @@
int (*generate)(struct ast_channel *chan, void *data, int len, int samples);
/*! This gets called when DTMF_END frames are read from the channel */
void (*digit)(struct ast_channel *chan, char digit);
-};
-
-/*! \brief Structure for a data store type */
-struct ast_datastore_info {
- const char *type; /*!< Type of data store */
- void *(*duplicate)(void *data); /*!< Duplicate item data (used for inheritance) */
- void (*destroy)(void *data); /*!< Destroy function */
- /*!
- * \brief Fix up channel references
- *
- * \arg data The datastore data
- * \arg old_chan The old channel owning the datastore
- * \arg new_chan The new channel owning the datastore
- *
- * This is exactly like the fixup callback of the channel technology interface.
- * It allows a datastore to fix any pointers it saved to the owning channel
- * in case that the owning channel has changed. Generally, this would happen
- * when the datastore is set to be inherited, and a masquerade occurs.
- *
- * \return nothing.
- */
- void (*chan_fixup)(void *data, struct ast_channel *old_chan, struct ast_channel *new_chan);
-};
-
-/*! \brief Structure for a channel data store */
-struct ast_datastore {
- const char *uid; /*!< Unique data store identifier */
- void *data; /*!< Contained data */
- const struct ast_datastore_info *info; /*!< Data store type information */
- unsigned int inheritance; /*!< Number of levels this item will continue to be inherited */
- AST_LIST_ENTRY(ast_datastore) entry; /*!< Used for easy linking */
};
/*! \brief Structure for all kinds of caller ID identifications.
@@ -653,16 +623,24 @@
};
/*!
- * \brief Create a channel datastore structure
- *
* \note None of the datastore API calls lock the ast_channel they are using.
* So, the channel should be locked before calling the functions that
* take a channel argument.
*/
-struct ast_datastore *ast_channel_datastore_alloc(const struct ast_datastore_info *info, const char *uid);
-
-/*! \brief Free a channel datastore structure */
-int ast_channel_datastore_free(struct ast_datastore *datastore);
+
+/*!
+ * \brief Create a channel data store object
+ * \deprecated You should use the ast_datastore_alloc() generic function instead.
+ */
+struct ast_datastore *ast_channel_datastore_alloc(const struct ast_datastore_info *info, const char *uid)
+ __attribute__ ((deprecated));
+
+/*!
+ * \brief Free a channel data store object
+ * \deprecated You should use the ast_datastore_free() generic function instead.
+ */
+int ast_channel_datastore_free(struct ast_datastore *datastore)
+ __attribute__ ((deprecated));
/*! \brief Inherit datastores from a parent to a child. */
int ast_channel_datastore_inherit(struct ast_channel *from, struct ast_channel *to);
@@ -695,6 +673,9 @@
*
* \note The datastore returned from this function must not be used if the
* reference to the channel is released.
+ *
+ * \retval pointer to the datastore if found
+ * \retval NULL if not found
*/
struct ast_datastore *ast_channel_datastore_find(struct ast_channel *chan, const struct ast_datastore_info *info, const char *uid);
Modified: team/group/appdocsxml/include/asterisk/manager.h
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/include/asterisk/manager.h?view=diff&rev=135716&r1=135715&r2=135716
==============================================================================
--- team/group/appdocsxml/include/asterisk/manager.h (original)
+++ team/group/appdocsxml/include/asterisk/manager.h Tue Aug 5 13:14:22 2008
@@ -21,6 +21,7 @@
#include "asterisk/network.h"
#include "asterisk/lock.h"
+#include "asterisk/datastore.h"
/*!
\file
@@ -212,4 +213,29 @@
/*! \brief Called by Asterisk module functions and the CLI command */
int reload_manager(void);
+/*!
+ * \brief Add a datastore to a session
+ *
+ * \retval 0 success
+ * \retval non-zero failure
+ */
+
+int astman_datastore_add(struct mansession *s, struct ast_datastore *datastore);
+
+/*!
+ * \brief Remove a datastore from a session
+ *
+ * \retval 0 success
+ * \retval non-zero failure
+ */
+int astman_datastore_remove(struct mansession *s, struct ast_datastore *datastore);
+
+/*!
+ * \brief Find a datastore on a session
+ *
+ * \retval pointer to the datastore if found
+ * \retval NULL if not found
+ */
+struct ast_datastore *astman_datastore_find(struct mansession *s, const struct ast_datastore_info *info, const char *uid);
+
#endif /* _ASTERISK_MANAGER_H */
Modified: team/group/appdocsxml/main/Makefile
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/main/Makefile?view=diff&rev=135716&r1=135715&r2=135716
==============================================================================
--- team/group/appdocsxml/main/Makefile (original)
+++ team/group/appdocsxml/main/Makefile Tue Aug 5 13:14:22 2008
@@ -28,7 +28,7 @@
cryptostub.o sha1.o http.o fixedjitterbuf.o abstract_jb.o \
strcompat.o threadstorage.o dial.o event.o adsistub.o audiohook.o \
astobj2.o hashtab.o global_datastores.o version.o \
- features.o taskprocessor.o timing.o xml.o
+ features.o taskprocessor.o timing.o datastore.o xml.o
# we need to link in the objects statically, not as a library, because
# otherwise modules will not have them available if none of the static
Modified: team/group/appdocsxml/main/audiohook.c
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/main/audiohook.c?view=diff&rev=135716&r1=135715&r2=135716
==============================================================================
--- team/group/appdocsxml/main/audiohook.c (original)
+++ team/group/appdocsxml/main/audiohook.c Tue Aug 5 13:14:22 2008
@@ -843,13 +843,13 @@
}
/* If we are not allowed to create a datastore or if we fail to create a datastore, bail out now as we have nothing for them */
- if (!create || !(datastore = ast_channel_datastore_alloc(&audiohook_volume_datastore, NULL))) {
+ if (!create || !(datastore = ast_datastore_alloc(&audiohook_volume_datastore, NULL))) {
return NULL;
}
/* Create a new audiohook_volume structure to contain our adjustments and audiohook */
if (!(audiohook_volume = ast_calloc(1, sizeof(*audiohook_volume)))) {
- ast_channel_datastore_free(datastore);
+ ast_datastore_free(datastore);
return NULL;
}
Modified: team/group/appdocsxml/main/channel.c
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/main/channel.c?view=diff&rev=135716&r1=135715&r2=135716
==============================================================================
--- team/group/appdocsxml/main/channel.c (original)
+++ team/group/appdocsxml/main/channel.c Tue Aug 5 13:14:22 2008
@@ -1294,7 +1294,7 @@
/* Get rid of each of the data stores on the channel */
while ((datastore = AST_LIST_REMOVE_HEAD(&chan->datastores, entry)))
/* Free the data store */
- ast_channel_datastore_free(datastore);
+ ast_datastore_free(datastore);
/* Lock and unlock the channel just to be sure nobody has it locked still
due to a reference that was stored in a datastore. (i.e. app_chanspy) */
@@ -1369,46 +1369,12 @@
struct ast_datastore *ast_channel_datastore_alloc(const struct ast_datastore_info *info, const char *uid)
{
- struct ast_datastore *datastore = NULL;
-
- /* Make sure we at least have type so we can identify this */
- if (!info) {
- return NULL;
- }
-
- /* Allocate memory for datastore and clear it */
- datastore = ast_calloc(1, sizeof(*datastore));
- if (!datastore) {
- return NULL;
- }
-
- datastore->info = info;
-
- datastore->uid = ast_strdup(uid);
-
- return datastore;
+ return ast_datastore_alloc(info, uid);
}
int ast_channel_datastore_free(struct ast_datastore *datastore)
{
- int res = 0;
-
- /* Using the destroy function (if present) destroy the data */
- if (datastore->info->destroy != NULL && datastore->data != NULL) {
- datastore->info->destroy(datastore->data);
- datastore->data = NULL;
- }
-
- /* Free allocated UID memory */
- if (datastore->uid != NULL) {
- ast_free((void *) datastore->uid);
- datastore->uid = NULL;
- }
-
- /* Finally free memory used by ourselves */
- ast_free(datastore);
-
- return res;
+ return ast_datastore_free(datastore);
}
int ast_channel_datastore_inherit(struct ast_channel *from, struct ast_channel *to)
@@ -1417,7 +1383,7 @@
AST_LIST_TRAVERSE(&from->datastores, datastore, entry) {
if (datastore->inheritance > 0) {
- datastore2 = ast_channel_datastore_alloc(datastore->info, datastore->uid);
+ datastore2 = ast_datastore_alloc(datastore->info, datastore->uid);
if (datastore2) {
datastore2->data = datastore->info->duplicate(datastore->data);
datastore2->inheritance = datastore->inheritance == DATASTORE_INHERIT_FOREVER ? DATASTORE_INHERIT_FOREVER : datastore->inheritance - 1;
@@ -1450,19 +1416,21 @@
return NULL;
AST_LIST_TRAVERSE_SAFE_BEGIN(&chan->datastores, datastore, entry) {
- if (datastore->info == info) {
- if (uid != NULL && datastore->uid != NULL) {
- if (!strcasecmp(uid, datastore->uid)) {
- /* Matched by type AND uid */
- break;
- }
- } else {
- /* Matched by type at least */
- break;
- }
- }
- }
- AST_LIST_TRAVERSE_SAFE_END
+ if (datastore->info != info) {
+ continue;
+ }
+
+ if (uid == NULL) {
+ /* matched by type only */
+ break;
+ }
+
+ if ((datastore->uid != NULL) && !strcasecmp(uid, datastore->uid)) {
+ /* Matched by type AND uid */
+ break;
+ }
+ }
+ AST_LIST_TRAVERSE_SAFE_END;
return datastore;
}
Modified: team/group/appdocsxml/main/manager.c
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/main/manager.c?view=diff&rev=135716&r1=135715&r2=135716
==============================================================================
--- team/group/appdocsxml/main/manager.c (original)
+++ team/group/appdocsxml/main/manager.c Tue Aug 5 13:14:22 2008
@@ -172,6 +172,7 @@
struct eventqent *last_ev; /*!< last event processed. */
int writetimeout; /*!< Timeout for ast_carefulwrite() */
int pending_event; /*!< Pending events indicator in case when waiting_thread is NULL */
+ AST_LIST_HEAD_NOLOCK(mansession_datastores, ast_datastore) datastores; /*!< Data stores on the session */
AST_LIST_ENTRY(mansession) list;
};
@@ -786,6 +787,14 @@
static void free_session(struct mansession *s)
{
struct eventqent *eqe = s->last_ev;
+ struct ast_datastore *datastore;
+
+ /* Get rid of each of the data stores on the session */
+ while ((datastore = AST_LIST_REMOVE_HEAD(&s->datastores, entry))) {
+ /* Free the data store */
+ ast_datastore_free(datastore);
+ }
+
if (s->f != NULL)
fclose(s->f);
ast_mutex_destroy(&s->__lock);
@@ -3092,18 +3101,21 @@
ast_mutex_init(&s->__lock);
s->send_events = -1;
+ /* Hook to the tail of the event queue */
+ s->last_ev = grab_last();
+
/* these fields duplicate those in the 'ser' structure */
s->fd = ser->fd;
s->f = ser->f;
s->sin = ser->requestor;
+ AST_LIST_HEAD_INIT_NOLOCK(&s->datastores);
+
AST_LIST_LOCK(&sessions);
AST_LIST_INSERT_HEAD(&sessions, s, list);
ast_atomic_fetchadd_int(&num_sessions, 1);
AST_LIST_UNLOCK(&sessions);
- /* Hook to the tail of the event queue */
- s->last_ev = grab_last();
- s->f = ser->f;
+
astman_append(s, "Asterisk Call Manager/%s\r\n", AMI_VERSION); /* welcome prompt */
for (;;) {
if ((res = do_message(s)) < 0)
@@ -3729,6 +3741,7 @@
*/
while ((s->managerid = rand() ^ (unsigned long) s) == 0);
s->last_ev = grab_last();
+ AST_LIST_HEAD_INIT_NOLOCK(&s->datastores);
AST_LIST_LOCK(&sessions);
AST_LIST_INSERT_HEAD(&sessions, s, list);
ast_atomic_fetchadd_int(&num_sessions, 1);
@@ -4258,3 +4271,42 @@
{
return __init_manager(1);
}
+
+int astman_datastore_add(struct mansession *s, struct ast_datastore *datastore)
+{
+ AST_LIST_INSERT_HEAD(&s->datastores, datastore, entry);
+
+ return 0;
+}
+
+int astman_datastore_remove(struct mansession *s, struct ast_datastore *datastore)
+{
+ return AST_LIST_REMOVE(&s->datastores, datastore, entry) ? 0 : -1;
+}
+
+struct ast_datastore *astman_datastore_find(struct mansession *s, const struct ast_datastore_info *info, const char *uid)
+{
+ struct ast_datastore *datastore = NULL;
+
+ if (info == NULL)
+ return NULL;
+
+ AST_LIST_TRAVERSE_SAFE_BEGIN(&s->datastores, datastore, entry) {
+ if (datastore->info != info) {
+ continue;
+ }
+
+ if (uid == NULL) {
+ /* matched by type only */
+ break;
+ }
+
+ if ((datastore->uid != NULL) && !strcasecmp(uid, datastore->uid)) {
+ /* Matched by type AND uid */
+ break;
+ }
+ }
+ AST_LIST_TRAVERSE_SAFE_END;
+
+ return datastore;
+}
Modified: team/group/appdocsxml/main/pbx.c
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/main/pbx.c?view=diff&rev=135716&r1=135715&r2=135716
==============================================================================
--- team/group/appdocsxml/main/pbx.c (original)
+++ team/group/appdocsxml/main/pbx.c Tue Aug 5 13:14:22 2008
@@ -2571,17 +2571,17 @@
struct pbx_exception *exception = NULL;
if (!ds) {
- ds = ast_channel_datastore_alloc(&exception_store_info, NULL);
+ ds = ast_datastore_alloc(&exception_store_info, NULL);
if (!ds)
return -1;
exception = ast_calloc(1, sizeof(struct pbx_exception));
if (!exception) {
- ast_channel_datastore_free(ds);
+ ast_datastore_free(ds);
return -1;
}
if (ast_string_field_init(exception, 128)) {
ast_free(exception);
- ast_channel_datastore_free(ds);
+ ast_datastore_free(ds);
return -1;
}
ds->data = exception;
Modified: team/group/appdocsxml/pbx/pbx_dundi.c
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/pbx/pbx_dundi.c?view=diff&rev=135716&r1=135715&r2=135716
==============================================================================
--- team/group/appdocsxml/pbx/pbx_dundi.c (original)
+++ team/group/appdocsxml/pbx/pbx_dundi.c Tue Aug 5 13:14:22 2008
@@ -3956,7 +3956,7 @@
drds->id = ast_atomic_fetchadd_int((int *) &dundi_result_id, 1);
snprintf(buf, len, "%u", drds->id);
- if (!(datastore = ast_channel_datastore_alloc(&dundi_result_datastore_info, buf))) {
+ if (!(datastore = ast_datastore_alloc(&dundi_result_datastore_info, buf))) {
drds_destroy(drds);
ast_module_user_remove(u);
return -1;
Modified: team/group/appdocsxml/pbx/pbx_lua.c
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/pbx/pbx_lua.c?view=diff&rev=135716&r1=135715&r2=135716
==============================================================================
--- team/group/appdocsxml/pbx/pbx_lua.c (original)
+++ team/group/appdocsxml/pbx/pbx_lua.c Tue Aug 5 13:14:22 2008
@@ -988,7 +988,7 @@
if (!datastore) {
/* nothing found, allocate a new lua state */
- datastore = ast_channel_datastore_alloc(&lua_datastore, NULL);
+ datastore = ast_datastore_alloc(&lua_datastore, NULL);
if (!datastore) {
ast_log(LOG_ERROR, "Error allocation channel datastore for lua_State\n");
return NULL;
@@ -996,7 +996,7 @@
datastore->data = luaL_newstate();
if (!datastore->data) {
- ast_channel_datastore_free(datastore);
+ ast_datastore_free(datastore);
ast_log(LOG_ERROR, "Error allocating lua_State, no memory\n");
return NULL;
}
@@ -1015,7 +1015,7 @@
ast_channel_datastore_remove(chan, datastore);
ast_channel_unlock(chan);
- ast_channel_datastore_free(datastore);
+ ast_datastore_free(datastore);
return NULL;
}
}
Modified: team/group/appdocsxml/res/res_agi.c
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/res/res_agi.c?view=diff&rev=135716&r1=135715&r2=135716
==============================================================================
--- team/group/appdocsxml/res/res_agi.c (original)
+++ team/group/appdocsxml/res/res_agi.c Tue Aug 5 13:14:22 2008
@@ -255,14 +255,14 @@
/* the channel has never been on Async AGI,
let's allocate it's datastore */
- datastore = ast_channel_datastore_alloc(&agi_commands_datastore_info, "AGI");
+ datastore = ast_datastore_alloc(&agi_commands_datastore_info, "AGI");
if (!datastore) {
return -1;
}
agi_cmds_list = ast_calloc(1, sizeof(*agi_cmds_list));
if (!agi_cmds_list) {
ast_log(LOG_ERROR, "Unable to allocate Async AGI commands list.\n");
- ast_channel_datastore_free(datastore);
+ ast_datastore_free(datastore);
return -1;
}
datastore->data = agi_cmds_list;
Modified: team/group/appdocsxml/res/res_smdi.c
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/res/res_smdi.c?view=diff&rev=135716&r1=135715&r2=135716
==============================================================================
--- team/group/appdocsxml/res/res_smdi.c (original)
+++ team/group/appdocsxml/res/res_smdi.c Tue Aug 5 13:14:22 2008
@@ -1162,7 +1162,7 @@
smd->id = ast_atomic_fetchadd_int((int *) &smdi_msg_id, 1);
snprintf(buf, len, "%u", smd->id);
- if (!(datastore = ast_channel_datastore_alloc(&smdi_msg_datastore_info, buf)))
+ if (!(datastore = ast_datastore_alloc(&smdi_msg_datastore_info, buf)))
goto return_error;
datastore->data = smd;
More information about the asterisk-commits
mailing list