mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-18 18:58:22 +00:00
ast_channel opaquification of pointers and integral types
Review: https://reviewboard.asterisk.org/r/1753/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@356042 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -307,12 +307,12 @@ static int func_channel_read(struct ast_channel *chan, const char *function,
|
||||
struct ast_format_cap *tmpcap;
|
||||
|
||||
if (!strcasecmp(data, "audionativeformat")) {
|
||||
if ((tmpcap = ast_format_cap_get_type(chan->nativeformats, AST_FORMAT_TYPE_AUDIO))) {
|
||||
if ((tmpcap = ast_format_cap_get_type(ast_channel_nativeformats(chan), AST_FORMAT_TYPE_AUDIO))) {
|
||||
ast_copy_string(buf, ast_getformatname_multiple(tmp, sizeof(tmp), tmpcap), len);
|
||||
tmpcap = ast_format_cap_destroy(tmpcap);
|
||||
}
|
||||
} else if (!strcasecmp(data, "videonativeformat")) {
|
||||
if ((tmpcap = ast_format_cap_get_type(chan->nativeformats, AST_FORMAT_TYPE_VIDEO))) {
|
||||
if ((tmpcap = ast_format_cap_get_type(ast_channel_nativeformats(chan), AST_FORMAT_TYPE_VIDEO))) {
|
||||
ast_copy_string(buf, ast_getformatname_multiple(tmp, sizeof(tmp), tmpcap), len);
|
||||
tmpcap = ast_format_cap_destroy(tmpcap);
|
||||
}
|
||||
@@ -326,8 +326,8 @@ static int func_channel_read(struct ast_channel *chan, const char *function,
|
||||
ast_copy_string(buf, ast_channel_trace_is_enabled(chan) ? "1" : "0", len);
|
||||
ast_channel_unlock(chan);
|
||||
#endif
|
||||
} else if (!strcasecmp(data, "tonezone") && chan->zone)
|
||||
locked_copy_string(chan, buf, chan->zone->country, len);
|
||||
} else if (!strcasecmp(data, "tonezone") && ast_channel_zone(chan))
|
||||
locked_copy_string(chan, buf, ast_channel_zone(chan)->country, len);
|
||||
else if (!strcasecmp(data, "language"))
|
||||
locked_copy_string(chan, buf, ast_channel_language(chan), len);
|
||||
else if (!strcasecmp(data, "musicclass"))
|
||||
@@ -337,9 +337,9 @@ static int func_channel_read(struct ast_channel *chan, const char *function,
|
||||
} else if (!strcasecmp(data, "parkinglot"))
|
||||
locked_copy_string(chan, buf, ast_channel_parkinglot(chan), len);
|
||||
else if (!strcasecmp(data, "state"))
|
||||
locked_copy_string(chan, buf, ast_state2str(chan->_state), len);
|
||||
locked_copy_string(chan, buf, ast_state2str(ast_channel_state(chan)), len);
|
||||
else if (!strcasecmp(data, "channeltype"))
|
||||
locked_copy_string(chan, buf, chan->tech->type, len);
|
||||
locked_copy_string(chan, buf, ast_channel_tech(chan)->type, len);
|
||||
else if (!strcasecmp(data, "accountcode"))
|
||||
locked_copy_string(chan, buf, ast_channel_accountcode(chan), len);
|
||||
else if (!strcasecmp(data, "checkhangup")) {
|
||||
@@ -376,7 +376,7 @@ static int func_channel_read(struct ast_channel *chan, const char *function,
|
||||
struct ast_channel *p;
|
||||
ast_channel_lock(chan);
|
||||
p = ast_bridged_channel(chan);
|
||||
if (p || chan->tech || chan->cdr) /* dummy channel? if so, we hid the peer name in the language */
|
||||
if (p || ast_channel_tech(chan) || ast_channel_cdr(chan)) /* dummy channel? if so, we hid the peer name in the language */
|
||||
ast_copy_string(buf, (p ? ast_channel_name(p) : ""), len);
|
||||
else {
|
||||
/* a dummy channel can still pass along bridged peer info via
|
||||
@@ -391,7 +391,7 @@ static int func_channel_read(struct ast_channel *chan, const char *function,
|
||||
} else if (!strcasecmp(data, "uniqueid")) {
|
||||
locked_copy_string(chan, buf, ast_channel_uniqueid(chan), len);
|
||||
} else if (!strcasecmp(data, "transfercapability")) {
|
||||
locked_copy_string(chan, buf, transfercapability_table[chan->transfercapability & 0x1f], len);
|
||||
locked_copy_string(chan, buf, transfercapability_table[ast_channel_transfercapability(chan) & 0x1f], len);
|
||||
} else if (!strcasecmp(data, "callgroup")) {
|
||||
char groupbuf[256];
|
||||
locked_copy_string(chan, buf, ast_print_group(groupbuf, sizeof(groupbuf), chan->callgroup), len);
|
||||
@@ -400,7 +400,7 @@ static int func_channel_read(struct ast_channel *chan, const char *function,
|
||||
locked_copy_string(chan, buf, ast_print_group(groupbuf, sizeof(groupbuf), chan->pickupgroup), len);
|
||||
} else if (!strcasecmp(data, "amaflags")) {
|
||||
char amabuf[256];
|
||||
snprintf(amabuf,sizeof(amabuf), "%d", chan->amaflags);
|
||||
snprintf(amabuf,sizeof(amabuf), "%d", ast_channel_amaflags(chan));
|
||||
locked_copy_string(chan, buf, amabuf, len);
|
||||
} else if (!strncasecmp(data, "secure_bridge_", 14)) {
|
||||
struct ast_datastore *ds;
|
||||
@@ -414,7 +414,7 @@ static int func_channel_read(struct ast_channel *chan, const char *function,
|
||||
}
|
||||
}
|
||||
ast_channel_unlock(chan);
|
||||
} else if (!chan->tech || !chan->tech->func_channel_read || chan->tech->func_channel_read(chan, function, data, buf, len)) {
|
||||
} else if (!ast_channel_tech(chan) || !ast_channel_tech(chan)->func_channel_read || ast_channel_tech(chan)->func_channel_read(chan, function, data, buf, len)) {
|
||||
ast_log(LOG_WARNING, "Unknown or unavailable item requested: '%s'\n", data);
|
||||
ret = -1;
|
||||
}
|
||||
@@ -441,13 +441,15 @@ static int func_channel_write_real(struct ast_channel *chan, const char *functio
|
||||
else if (!strcasecmp(data, "amaflags")) {
|
||||
ast_channel_lock(chan);
|
||||
if(isdigit(*value)) {
|
||||
sscanf(value, "%30d", &chan->amaflags);
|
||||
int amaflags;
|
||||
sscanf(value, "%30d", &amaflags);
|
||||
ast_channel_amaflags_set(chan, amaflags);
|
||||
} else if (!strcasecmp(value,"OMIT")){
|
||||
chan->amaflags = 1;
|
||||
ast_channel_amaflags_set(chan, 1);
|
||||
} else if (!strcasecmp(value,"BILLING")){
|
||||
chan->amaflags = 2;
|
||||
ast_channel_amaflags_set(chan, 2);
|
||||
} else if (!strcasecmp(value,"DOCUMENTATION")){
|
||||
chan->amaflags = 3;
|
||||
ast_channel_amaflags_set(chan, 3);
|
||||
}
|
||||
ast_channel_unlock(chan);
|
||||
} else if (!strcasecmp(data, "peeraccount"))
|
||||
@@ -476,10 +478,10 @@ static int func_channel_write_real(struct ast_channel *chan, const char *functio
|
||||
ret = -1;
|
||||
} else {
|
||||
ast_channel_lock(chan);
|
||||
if (chan->zone) {
|
||||
chan->zone = ast_tone_zone_unref(chan->zone);
|
||||
if (ast_channel_zone(chan)) {
|
||||
ast_channel_zone_set(chan, ast_tone_zone_unref(ast_channel_zone(chan)));
|
||||
}
|
||||
chan->zone = ast_tone_zone_ref(new_zone);
|
||||
ast_channel_zone_set(chan, ast_tone_zone_ref(new_zone));
|
||||
ast_channel_unlock(chan);
|
||||
new_zone = ast_tone_zone_unref(new_zone);
|
||||
}
|
||||
@@ -497,7 +499,7 @@ static int func_channel_write_real(struct ast_channel *chan, const char *functio
|
||||
unsigned short i;
|
||||
for (i = 0; i < 0x20; i++) {
|
||||
if (!strcasecmp(transfercapability_table[i], value) && strcmp(value, "UNK")) {
|
||||
chan->transfercapability = i;
|
||||
ast_channel_transfercapability_set(chan, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -532,8 +534,8 @@ static int func_channel_write_real(struct ast_channel *chan, const char *functio
|
||||
} else if (!strcasecmp(data, "secure_bridge_media")) {
|
||||
store->media = ast_true(value) ? 1 : 0;
|
||||
}
|
||||
} else if (!chan->tech->func_channel_write
|
||||
|| chan->tech->func_channel_write(chan, function, data, value)) {
|
||||
} else if (!ast_channel_tech(chan)->func_channel_write
|
||||
|| ast_channel_tech(chan)->func_channel_write(chan, function, data, value)) {
|
||||
ast_log(LOG_WARNING, "Unknown or unavailable item requested: '%s'\n",
|
||||
data);
|
||||
ret = -1;
|
||||
|
Reference in New Issue
Block a user