[svn-commits] rmudgett: trunk r218365 - /trunk/channels/chan_dahdi.c
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Mon Sep 14 15:08:15 CDT 2009
Author: rmudgett
Date: Mon Sep 14 15:08:11 2009
New Revision: 218365
URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=218365
Log:
Add support for multiple interface lists.
Also unlink the sig_pri_pri.pvts[] pointer in destroy_dahdi_pvt().
Modified:
trunk/channels/chan_dahdi.c
Modified: trunk/channels/chan_dahdi.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/channels/chan_dahdi.c?view=diff&rev=218365&r1=218364&r2=218365
==============================================================================
--- trunk/channels/chan_dahdi.c (original)
+++ trunk/channels/chan_dahdi.c Mon Sep 14 15:08:11 2009
@@ -681,6 +681,12 @@
mwisend_states mwisend_current;
};
+/*! Specify the lists dahdi_pvt can be put in. */
+enum DAHDI_IFLIST {
+ DAHDI_IFLIST_NONE, /*!< The dahdi_pvt is not in any list. */
+ DAHDI_IFLIST_MAIN, /*!< The dahdi_pvt is in the main interface list */
+};
+
struct dahdi_pvt {
ast_mutex_t lock;
struct callerid_state *cs;
@@ -716,6 +722,7 @@
/*! \brief Tx gain set by chan_dahdi.conf */
float txgain;
int tonezone; /*!< tone zone for this chan, or -1 for default */
+ enum DAHDI_IFLIST which_iflist; /*!< Which interface list is this structure listed? */
struct dahdi_pvt *next; /*!< Next channel in list */
struct dahdi_pvt *prev; /*!< Prev channel in list */
@@ -1248,8 +1255,8 @@
void *sig_pvt;
};
-static struct dahdi_pvt *iflist = NULL;
-static struct dahdi_pvt *ifend = NULL;
+static struct dahdi_pvt *iflist = NULL; /*!< Main interface list start */
+static struct dahdi_pvt *ifend = NULL; /*!< Main interface list end */
/*! \brief Channel configuration from chan_dahdi.conf .
* This struct is used for parsing the [channels] section of chan_dahdi.conf.
@@ -4691,6 +4698,8 @@
{
struct dahdi_pvt *cur;
+ pvt->which_iflist = DAHDI_IFLIST_MAIN;
+
/* Find place in middle of list for the new interface. */
for (cur = iflist; cur; cur = cur->next) {
if (pvt->channel < cur->channel) {
@@ -4754,16 +4763,58 @@
}
/* Node is no longer in the list. */
+ pvt->which_iflist = DAHDI_IFLIST_NONE;
pvt->prev = NULL;
pvt->next = NULL;
}
+#if defined(HAVE_PRI)
+/*!
+ * \internal
+ * \brief Unlink the channel interface from the PRI private pointer array.
+ * \since 1.6.3
+ *
+ * \param pvt chan_dahdi private interface structure to unlink.
+ *
+ * \return Nothing
+ */
+static void dahdi_unlink_pri_pvt(struct dahdi_pvt *pvt)
+{
+ unsigned idx;
+ struct sig_pri_pri *pri;
+
+ pri = pvt->pri;
+ if (!pri) {
+ /* Not PRI signaling so cannot be in a PRI private pointer array. */
+ return;
+ }
+ ast_mutex_lock(&pri->lock);
+ for (idx = 0; idx < pri->numchans; ++idx) {
+ if (pri->pvts[idx] == pvt->sig_pvt) {
+ pri->pvts[idx] = NULL;
+ ast_mutex_unlock(&pri->lock);
+ return;
+ }
+ }
+ ast_mutex_unlock(&pri->lock);
+}
+#endif /* defined(HAVE_PRI) */
+
static void destroy_dahdi_pvt(struct dahdi_pvt *pvt)
{
struct dahdi_pvt *p = pvt;
/* Remove channel from the list */
- dahdi_iflist_extract(p);
+#if defined(HAVE_PRI)
+ dahdi_unlink_pri_pvt(p);
+#endif /* defined(HAVE_PRI) */
+ switch (pvt->which_iflist) {
+ case DAHDI_IFLIST_NONE:
+ break;
+ case DAHDI_IFLIST_MAIN:
+ dahdi_iflist_extract(p);
+ break;
+ }
if (p->sig_pvt) {
if (analog_lib_handles(p->sig, 0, 0)) {
@@ -11014,8 +11065,7 @@
p.rxflashtime = 1;
p.starttime = 1;
p.debouncetime = 5;
- }
- if (!tmp->radio) {
+ } else {
p.channo = channel;
/* Override timing settings based on config file */
if (conf->timing.prewinktime >= 0)
@@ -11437,6 +11487,7 @@
return NULL;
}
*p = *src;
+ p->which_iflist = DAHDI_IFLIST_NONE;
p->next = NULL;
p->prev = NULL;
ast_mutex_init(&p->lock);
More information about the svn-commits
mailing list