[svn-commits] rmudgett: trunk r370887 - in /trunk/channels: chan_dahdi.c sig_ss7.c sig_ss7.h
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Tue Aug 7 19:15:58 CDT 2012
Author: rmudgett
Date: Tue Aug 7 19:15:54 2012
New Revision: 370887
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=370887
Log:
Convert sig_ss7 to use a global callback table.
Modified:
trunk/channels/chan_dahdi.c
trunk/channels/sig_ss7.c
trunk/channels/sig_ss7.h
Modified: trunk/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_dahdi.c?view=diff&rev=370887&r1=370886&r2=370887
==============================================================================
--- trunk/channels/chan_dahdi.c (original)
+++ trunk/channels/chan_dahdi.c Tue Aug 7 19:15:54 2012
@@ -3614,7 +3614,7 @@
#endif /* defined(HAVE_SS7) */
#if defined(HAVE_SS7)
-static struct sig_ss7_callback dahdi_ss7_callbacks =
+struct sig_ss7_callback sig_ss7_callbacks =
{
.lock_private = my_lock_private,
.unlock_private = my_unlock_private,
@@ -12653,7 +12653,7 @@
destroy_dahdi_pvt(tmp);
return NULL;
}
- ss7_chan = sig_ss7_chan_new(tmp, &dahdi_ss7_callbacks, &ss7->ss7);
+ ss7_chan = sig_ss7_chan_new(tmp, &ss7->ss7);
if (!ss7_chan) {
destroy_dahdi_pvt(tmp);
return NULL;
@@ -18855,7 +18855,6 @@
int x;
for (x = 0; x < NUM_SPANS; x++) {
if (linksets[x].ss7.ss7) {
- linksets[x].ss7.calls = &dahdi_ss7_callbacks;
if (ast_pthread_create(&linksets[x].ss7.master, NULL, ss7_linkset, &linksets[x].ss7)) {
ast_log(LOG_ERROR, "Unable to start SS7 linkset on span %d\n", x + 1);
return -1;
Modified: trunk/channels/sig_ss7.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/sig_ss7.c?view=diff&rev=370887&r1=370886&r2=370887
==============================================================================
--- trunk/channels/sig_ss7.c (original)
+++ trunk/channels/sig_ss7.c Tue Aug 7 19:15:54 2012
@@ -72,22 +72,22 @@
static void sig_ss7_unlock_private(struct sig_ss7_chan *p)
{
- if (p->calls->unlock_private) {
- p->calls->unlock_private(p->chan_pvt);
+ if (sig_ss7_callbacks.unlock_private) {
+ sig_ss7_callbacks.unlock_private(p->chan_pvt);
}
}
static void sig_ss7_lock_private(struct sig_ss7_chan *p)
{
- if (p->calls->lock_private) {
- p->calls->lock_private(p->chan_pvt);
+ if (sig_ss7_callbacks.lock_private) {
+ sig_ss7_callbacks.lock_private(p->chan_pvt);
}
}
static void sig_ss7_deadlock_avoidance_private(struct sig_ss7_chan *p)
{
- if (p->calls->deadlock_avoidance_private) {
- p->calls->deadlock_avoidance_private(p->chan_pvt);
+ if (sig_ss7_callbacks.deadlock_avoidance_private) {
+ sig_ss7_callbacks.deadlock_avoidance_private(p->chan_pvt);
} else {
/* Fallback to the old way if callback not present. */
sig_ss7_unlock_private(p);
@@ -99,53 +99,53 @@
void sig_ss7_set_alarm(struct sig_ss7_chan *p, int in_alarm)
{
p->inalarm = in_alarm;
- if (p->calls->set_alarm) {
- p->calls->set_alarm(p->chan_pvt, in_alarm);
+ if (sig_ss7_callbacks.set_alarm) {
+ sig_ss7_callbacks.set_alarm(p->chan_pvt, in_alarm);
}
}
static void sig_ss7_set_dialing(struct sig_ss7_chan *p, int is_dialing)
{
- if (p->calls->set_dialing) {
- p->calls->set_dialing(p->chan_pvt, is_dialing);
+ if (sig_ss7_callbacks.set_dialing) {
+ sig_ss7_callbacks.set_dialing(p->chan_pvt, is_dialing);
}
}
static void sig_ss7_set_digital(struct sig_ss7_chan *p, int is_digital)
{
- if (p->calls->set_digital) {
- p->calls->set_digital(p->chan_pvt, is_digital);
+ if (sig_ss7_callbacks.set_digital) {
+ sig_ss7_callbacks.set_digital(p->chan_pvt, is_digital);
}
}
static void sig_ss7_set_outgoing(struct sig_ss7_chan *p, int is_outgoing)
{
p->outgoing = is_outgoing;
- if (p->calls->set_outgoing) {
- p->calls->set_outgoing(p->chan_pvt, is_outgoing);
+ if (sig_ss7_callbacks.set_outgoing) {
+ sig_ss7_callbacks.set_outgoing(p->chan_pvt, is_outgoing);
}
}
static void sig_ss7_set_inservice(struct sig_ss7_chan *p, int is_inservice)
{
- if (p->calls->set_inservice) {
- p->calls->set_inservice(p->chan_pvt, is_inservice);
+ if (sig_ss7_callbacks.set_inservice) {
+ sig_ss7_callbacks.set_inservice(p->chan_pvt, is_inservice);
}
}
static void sig_ss7_set_locallyblocked(struct sig_ss7_chan *p, int is_blocked)
{
p->locallyblocked = is_blocked;
- if (p->calls->set_locallyblocked) {
- p->calls->set_locallyblocked(p->chan_pvt, is_blocked);
+ if (sig_ss7_callbacks.set_locallyblocked) {
+ sig_ss7_callbacks.set_locallyblocked(p->chan_pvt, is_blocked);
}
}
static void sig_ss7_set_remotelyblocked(struct sig_ss7_chan *p, int is_blocked)
{
p->remotelyblocked = is_blocked;
- if (p->calls->set_remotelyblocked) {
- p->calls->set_remotelyblocked(p->chan_pvt, is_blocked);
+ if (sig_ss7_callbacks.set_remotelyblocked) {
+ sig_ss7_callbacks.set_remotelyblocked(p->chan_pvt, is_blocked);
}
}
@@ -160,8 +160,8 @@
*/
static void sig_ss7_open_media(struct sig_ss7_chan *p)
{
- if (p->calls->open_media) {
- p->calls->open_media(p->chan_pvt);
+ if (sig_ss7_callbacks.open_media) {
+ sig_ss7_callbacks.open_media(p->chan_pvt);
}
}
@@ -178,7 +178,7 @@
{
struct ast_party_caller caller;
- if (p->calls->set_callerid) {
+ if (sig_ss7_callbacks.set_callerid) {
ast_party_caller_init(&caller);
caller.id.name.str = p->cid_name;
@@ -203,7 +203,7 @@
caller.ani.number.valid = 1;
caller.ani2 = p->cid_ani2;
- p->calls->set_callerid(p->chan_pvt, &caller);
+ sig_ss7_callbacks.set_callerid(p->chan_pvt, &caller);
}
}
@@ -219,8 +219,8 @@
*/
static void sig_ss7_set_dnid(struct sig_ss7_chan *p, const char *dnid)
{
- if (p->calls->set_dnid) {
- p->calls->set_dnid(p->chan_pvt, dnid);
+ if (sig_ss7_callbacks.set_dnid) {
+ sig_ss7_callbacks.set_dnid(p->chan_pvt, dnid);
}
}
@@ -228,8 +228,8 @@
{
int res;
- if (p->calls->play_tone) {
- res = p->calls->play_tone(p->chan_pvt, tone);
+ if (sig_ss7_callbacks.play_tone) {
+ res = sig_ss7_callbacks.play_tone(p->chan_pvt, tone);
} else {
res = -1;
}
@@ -238,8 +238,8 @@
static int sig_ss7_set_echocanceller(struct sig_ss7_chan *p, int enable)
{
- if (p->calls->set_echocanceller) {
- return p->calls->set_echocanceller(p->chan_pvt, enable);
+ if (sig_ss7_callbacks.set_echocanceller) {
+ return sig_ss7_callbacks.set_echocanceller(p->chan_pvt, enable);
}
return -1;
}
@@ -248,8 +248,8 @@
{
if (p->loopedback != enable) {
p->loopedback = enable;
- if (p->calls->set_loopback) {
- p->calls->set_loopback(p->chan_pvt, enable);
+ if (sig_ss7_callbacks.set_loopback) {
+ sig_ss7_callbacks.set_loopback(p->chan_pvt, enable);
}
}
}
@@ -258,8 +258,8 @@
{
struct ast_channel *ast;
- if (p->calls->new_ast_channel) {
- ast = p->calls->new_ast_channel(p->chan_pvt, state, ulaw, exten, requestor);
+ if (sig_ss7_callbacks.new_ast_channel) {
+ ast = sig_ss7_callbacks.new_ast_channel(p->chan_pvt, state, ulaw, exten, requestor);
} else {
return NULL;
}
@@ -283,8 +283,8 @@
static void sig_ss7_handle_link_exception(struct sig_ss7_linkset *linkset, int which)
{
- if (linkset->calls->handle_link_exception) {
- linkset->calls->handle_link_exception(linkset, which);
+ if (sig_ss7_callbacks.handle_link_exception) {
+ sig_ss7_callbacks.handle_link_exception(linkset, which);
}
}
@@ -362,8 +362,8 @@
struct ast_frame f = {AST_FRAME_CONTROL, };
struct sig_ss7_chan *p = ss7->pvts[chanpos];
- if (p->calls->queue_control) {
- p->calls->queue_control(p->chan_pvt, subclass);
+ if (sig_ss7_callbacks.queue_control) {
+ sig_ss7_callbacks.queue_control(p->chan_pvt, subclass);
}
f.subclass.integer = subclass;
@@ -1944,13 +1944,12 @@
* \since 1.8
*
* \param pvt_data Upper layer private data structure.
- * \param callback Callbacks to the upper layer.
* \param ss7 Controlling linkset for the channel.
*
* \retval sig_ss7_chan on success.
* \retval NULL on error.
*/
-struct sig_ss7_chan *sig_ss7_chan_new(void *pvt_data, struct sig_ss7_callback *callback, struct sig_ss7_linkset *ss7)
+struct sig_ss7_chan *sig_ss7_chan_new(void *pvt_data, struct sig_ss7_linkset *ss7)
{
struct sig_ss7_chan *pvt;
@@ -1959,7 +1958,6 @@
return pvt;
}
- pvt->calls = callback;
pvt->chan_pvt = pvt_data;
pvt->ss7 = ss7;
Modified: trunk/channels/sig_ss7.h
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/sig_ss7.h?view=diff&rev=370887&r1=370886&r2=370887
==============================================================================
--- trunk/channels/sig_ss7.h (original)
+++ trunk/channels/sig_ss7.h Tue Aug 7 19:15:54 2012
@@ -153,8 +153,10 @@
void (* const open_media)(void *pvt);
};
+/*! Global sig_ss7 callbacks to the upper layer. */
+extern struct sig_ss7_callback sig_ss7_callbacks;
+
struct sig_ss7_chan {
- struct sig_ss7_callback *calls;
void *chan_pvt; /*!< Private structure of the user of this module. */
struct sig_ss7_linkset *ss7;
struct ast_channel *owner;
@@ -250,7 +252,6 @@
struct sig_ss7_linkset {
pthread_t master; /*!< Thread of master */
ast_mutex_t lock; /*!< libss7 access lock */
- struct sig_ss7_callback *calls;
struct ss7 *ss7;
struct sig_ss7_chan *pvts[SIG_SS7_MAX_CHANNELS];/*!< Member channel pvt structs */
int fds[SIG_SS7_NUM_DCHANS];
@@ -291,7 +292,7 @@
int sig_ss7_indicate(struct sig_ss7_chan *p, struct ast_channel *chan, int condition, const void *data, size_t datalen);
struct ast_channel *sig_ss7_request(struct sig_ss7_chan *p, enum sig_ss7_law law, const struct ast_channel *requestor, int transfercapability);
void sig_ss7_chan_delete(struct sig_ss7_chan *doomed);
-struct sig_ss7_chan *sig_ss7_chan_new(void *pvt_data, struct sig_ss7_callback *callback, struct sig_ss7_linkset *ss7);
+struct sig_ss7_chan *sig_ss7_chan_new(void *pvt_data, struct sig_ss7_linkset *ss7);
void sig_ss7_init_linkset(struct sig_ss7_linkset *ss7);
void sig_ss7_cli_show_channels_header(int fd);
More information about the svn-commits
mailing list