summaryrefslogtreecommitdiff
path: root/channels/sig_ss7.c
diff options
context:
space:
mode:
authorTerry Wilson <twilson@digium.com>2012-01-09 22:15:50 +0000
committerTerry Wilson <twilson@digium.com>2012-01-09 22:15:50 +0000
commit04da92c3799e546fa4d84bdaeebd499fb64aea7a (patch)
tree9617b8b2d6d06f96ba27c0baefc5b93eb9e3bc5b /channels/sig_ss7.c
parent64d1b247c407de2af029392a6c32a99bf11c7ded (diff)
Replace direct access to channel name with accessor functions
There are many benefits to making the ast_channel an opaque handle, from increasing maintainability to presenting ways to kill masquerades. This patch kicks things off by taking things a field at a time, renaming the field to '__do_not_use_${fieldname}' and then writing setters/getters and converting the existing code to using them. When all fields are done, we can move ast_channel to a C file from channel.h and lop off the '__do_not_use_'. This patch sets up main/channel_interal_api.c to be the only file that actually accesses the ast_channel's fields directly. The intent would be for any API functions in channel.c to use the accessor functions. No more monkeying around with channel internals. We should use our own APIs. The interesting changes in this patch are the addition of channel_internal_api.c, the moving of the AST_DATA stuff from channel.c to channel_internal_api.c (note: the AST_DATA stuff will have to be reworked to use accessor functions when ast_channel is really opaque), and some re-working of the way channel iterators/callbacks are handled so as to avoid creating fake ast_channels on the stack to pass in matching data by directly accessing fields (since "name" is a stringfield and the fake channel doesn't init the stringfields, you can't use the ast_channel_name_set() function). I went with ast_channel_name(chan) for a getter, and ast_channel_name_set(chan, name) for a setter. The majority of the grunt-work for this change was done by writing a semantic patch using Coccinelle ( http://coccinelle.lip6.fr/ ). Review: https://reviewboard.asterisk.org/r/1655/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@350223 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/sig_ss7.c')
-rw-r--r--channels/sig_ss7.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/channels/sig_ss7.c b/channels/sig_ss7.c
index 616d6002a..a94188071 100644
--- a/channels/sig_ss7.c
+++ b/channels/sig_ss7.c
@@ -624,7 +624,7 @@ static void ss7_start_call(struct sig_ss7_chan *p, struct sig_ss7_linkset *links
ast_channel_unlock(c);
if (ast_pbx_start(c)) {
- ast_log(LOG_WARNING, "Unable to start PBX on %s (CIC %d)\n", c->name, p->cic);
+ ast_log(LOG_WARNING, "Unable to start PBX on %s (CIC %d)\n", ast_channel_name(c), p->cic);
ast_hangup(c);
} else {
ast_verb(3, "Accepting call to '%s' on CIC %d\n", p->exten, p->cic);
@@ -1679,7 +1679,7 @@ int sig_ss7_indicate(struct sig_ss7_chan *p, struct ast_channel *chan, int condi
}
break;
case AST_CONTROL_PROCEEDING:
- ast_debug(1,"Received AST_CONTROL_PROCEEDING on %s\n",chan->name);
+ ast_debug(1,"Received AST_CONTROL_PROCEEDING on %s\n",ast_channel_name(chan));
ss7_grab(p, p->ss7);
/* This IF sends the FAR for an answered ALEG call */
if (chan->_state == AST_STATE_UP && (p->rlt != 1)){
@@ -1697,7 +1697,7 @@ int sig_ss7_indicate(struct sig_ss7_chan *p, struct ast_channel *chan, int condi
res = 0;
break;
case AST_CONTROL_PROGRESS:
- ast_debug(1,"Received AST_CONTROL_PROGRESS on %s\n",chan->name);
+ ast_debug(1,"Received AST_CONTROL_PROGRESS on %s\n",ast_channel_name(chan));
ss7_grab(p, p->ss7);
if (!p->progress && p->call_level < SIG_SS7_CALL_LEVEL_ALERTING && !p->outgoing) {
p->progress = 1;/* No need to send inband-information progress again. */
@@ -1812,7 +1812,7 @@ void sig_ss7_cli_show_channels(int fd, struct sig_ss7_linkset *linkset)
pvt->remotelyblocked ? "Yes" : "No",
sig_ss7_call_level2str(pvt->call_level),
pvt->ss7call ? "Yes" : "No",
- pvt->owner ? pvt->owner->name : "");
+ pvt->owner ? ast_channel_name(pvt->owner) : "");
if (pvt->owner) {
ast_channel_unlock(pvt->owner);