[svn-commits] rmudgett: branch rmudgett/link_struct r2054 - /team/rmudgett/link_struct/
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Tue Oct 19 18:03:01 CDT 2010
Author: rmudgett
Date: Tue Oct 19 18:02:59 2010
New Revision: 2054
URL: http://svnview.digium.com/svn/libpri?view=rev&rev=2054
Log:
Partial support for dynamic interfaces with NFAS.
To have some support for dynamic interfaces, the master NFAS D channel
control structure will always exist even if it is abandoned/deleted by the
upper layer. The master/slave pointers ensure that the correct master
will be used.
Modified:
team/rmudgett/link_struct/pri.c
team/rmudgett/link_struct/pri_internal.h
Modified: team/rmudgett/link_struct/pri.c
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/link_struct/pri.c?view=diff&rev=2054&r1=2053&r2=2054
==============================================================================
--- team/rmudgett/link_struct/pri.c (original)
+++ team/rmudgett/link_struct/pri.c Tue Oct 19 18:02:59 2010
@@ -1646,11 +1646,43 @@
void pri_enslave(struct pri *master, struct pri *slave)
{
- if (master && slave) {
- slave->callpool = &master->localpool;
- slave->nfas = 1;
- master->nfas = 1;
- }
+ if (!master || !slave) {
+ return;
+ }
+
+ if (slave->master) {
+ struct pri *swp;
+
+ /* The slave already has a master */
+ if (master->master || master->slave) {
+ /* The new master has a master or it already has slaves. */
+ return;
+ }
+
+ /* Swap master and slave. */
+ swp = master;
+ master = slave;
+ slave = master;
+ }
+
+ /*
+ * To have some support for dynamic interfaces, the master NFAS
+ * D channel control structure will always exist even if it is
+ * abandoned/deleted by the upper layer. The master/slave
+ * pointers ensure that the correct master will be used.
+ */
+
+ master = PRI_NFAS_MASTER(master);
+ master->nfas = 1;
+ slave->nfas = 1;
+ slave->callpool = &master->localpool;
+
+ /* Link the slave to the master on the end of the master's list. */
+ slave->master = master;
+ slave->slave = NULL;
+ for (; master->slave; master = master->slave) {
+ }
+ master->slave = slave;
}
struct pri_sr *pri_sr_new(void)
Modified: team/rmudgett/link_struct/pri_internal.h
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/link_struct/pri_internal.h?view=diff&rev=2054&r1=2053&r2=2054
==============================================================================
--- team/rmudgett/link_struct/pri_internal.h (original)
+++ team/rmudgett/link_struct/pri_internal.h Tue Oct 19 18:02:59 2010
@@ -955,7 +955,6 @@
int q931_cc_timeout(struct pri *ctrl, struct pri_cc_record *cc_record, enum CC_EVENTS event);
void q931_cc_indirect(struct pri *ctrl, struct pri_cc_record *cc_record, void (*func)(struct pri *ctrl, q931_call *call, struct pri_cc_record *cc_record));
-#ifdef NFAS_SUPPORT_WILL_USE /* BUGBUG */
/*!
* \brief Get the NFAS master PRI control structure.
*
@@ -970,7 +969,6 @@
}
return ctrl;
}
-#endif /* NFAS_SUPPORT_WILL_USE */
/*!
* \brief Determine if layer 2 is in BRI NT PTMP mode.
More information about the svn-commits
mailing list