[asterisk-commits] kpfleming: branch 1.4 r49676 - in /branches/1.4:
apps/ channels/ include/aste...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Fri Jan 5 15:16:34 MST 2007
Author: kpfleming
Date: Fri Jan 5 16:16:33 2007
New Revision: 49676
URL: http://svn.digium.com/view/asterisk?view=rev&rev=49676
Log:
reduce stack consumption for AMI and AMI/HTTP requests by nearly 20K in most cases
Modified:
branches/1.4/apps/app_meetme.c
branches/1.4/apps/app_queue.c
branches/1.4/apps/app_senddtmf.c
branches/1.4/apps/app_setcdruserfield.c
branches/1.4/channels/chan_agent.c
branches/1.4/channels/chan_iax2.c
branches/1.4/channels/chan_sip.c
branches/1.4/channels/chan_zap.c
branches/1.4/include/asterisk/jabber.h
branches/1.4/include/asterisk/manager.h
branches/1.4/main/config.c
branches/1.4/main/db.c
branches/1.4/main/manager.c
branches/1.4/res/res_features.c
branches/1.4/res/res_jabber.c
branches/1.4/res/res_monitor.c
branches/1.4/utils/astman.c
Modified: branches/1.4/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/apps/app_meetme.c?view=diff&rev=49676&r1=49675&r2=49676
==============================================================================
--- branches/1.4/apps/app_meetme.c (original)
+++ branches/1.4/apps/app_meetme.c Fri Jan 5 16:16:33 2007
@@ -2751,12 +2751,12 @@
return 0;
}
-static int meetmemute(struct mansession *s, struct message *m, int mute)
+static int meetmemute(struct mansession *s, const struct message *m, int mute)
{
struct ast_conference *conf;
struct ast_conf_user *user;
- char *confid = astman_get_header(m, "Meetme");
- char *userid = astman_get_header(m, "Usernum");
+ const char *confid = astman_get_header(m, "Meetme");
+ char *userid = ast_strdupa(astman_get_header(m, "Usernum"));
int userno;
if (ast_strlen_zero(confid)) {
@@ -2812,12 +2812,12 @@
return 0;
}
-static int action_meetmemute(struct mansession *s, struct message *m)
+static int action_meetmemute(struct mansession *s, const struct message *m)
{
return meetmemute(s, m, 1);
}
-static int action_meetmeunmute(struct mansession *s, struct message *m)
+static int action_meetmeunmute(struct mansession *s, const struct message *m)
{
return meetmemute(s, m, 0);
}
Modified: branches/1.4/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/apps/app_queue.c?view=diff&rev=49676&r1=49675&r2=49676
==============================================================================
--- branches/1.4/apps/app_queue.c (original)
+++ branches/1.4/apps/app_queue.c Fri Jan 5 16:16:33 2007
@@ -401,7 +401,7 @@
static AST_LIST_HEAD_STATIC(queues, call_queue);
-static int set_member_paused(char *queuename, char *interface, int paused);
+static int set_member_paused(const char *queuename, const char *interface, int paused);
static void rr_dep_warning(void)
{
@@ -613,7 +613,7 @@
return 0;
}
-static struct member *create_queue_member(char *interface, const char *membername, int penalty, int paused)
+static struct member *create_queue_member(const char *interface, const char *membername, int penalty, int paused)
{
struct member *cur;
@@ -686,7 +686,7 @@
q->wrapuptime = 0;
}
-static int add_to_interfaces(char *interface)
+static int add_to_interfaces(const char *interface)
{
struct member_interface *curint;
@@ -713,7 +713,7 @@
return 0;
}
-static int interface_exists_global(char *interface)
+static int interface_exists_global(const char *interface)
{
struct call_queue *q;
struct member *mem;
@@ -735,7 +735,7 @@
return ret;
}
-static int remove_from_interfaces(char *interface)
+static int remove_from_interfaces(const char *interface)
{
struct member_interface *curint;
@@ -1100,7 +1100,7 @@
return q;
}
-static struct call_queue *load_realtime_queue(char *queuename)
+static struct call_queue *load_realtime_queue(const char *queuename)
{
struct ast_variable *queue_vars;
struct ast_config *member_config = NULL;
@@ -2686,7 +2686,7 @@
return ast_waitfordigit(qe->chan, retrywait);
}
-static struct member *interface_exists(struct call_queue *q, char *interface)
+static struct member *interface_exists(struct call_queue *q, const char *interface)
{
struct member *mem;
@@ -2741,7 +2741,7 @@
ast_db_del(pm_family, pm_queue->name);
}
-static int remove_from_queue(char *queuename, char *interface)
+static int remove_from_queue(const char *queuename, const char *interface)
{
struct call_queue *q;
struct member *last_member, *look;
@@ -2795,7 +2795,7 @@
}
-static int add_to_queue(char *queuename, char *interface, char *membername, int penalty, int paused, int dump)
+static int add_to_queue(const char *queuename, const char *interface, const char *membername, int penalty, int paused, int dump)
{
struct call_queue *q;
struct member *new_member;
@@ -2846,7 +2846,7 @@
return res;
}
-static int set_member_paused(char *queuename, char *interface, int paused)
+static int set_member_paused(const char *queuename, const char *interface, int paused)
{
int found = 0;
struct call_queue *q;
@@ -4027,7 +4027,7 @@
/*!\brief callback to display queues status in manager
\addtogroup Group_AMI
*/
-static int manager_queues_show( struct mansession *s, struct message *m )
+static int manager_queues_show(struct mansession *s, const struct message *m)
{
char *a[] = { "queue", "show" };
@@ -4038,13 +4038,13 @@
}
/* Dump queue status */
-static int manager_queues_status( struct mansession *s, struct message *m )
+static int manager_queues_status(struct mansession *s, const struct message *m)
{
time_t now;
int pos;
- char *id = astman_get_header(m,"ActionID");
- char *queuefilter = astman_get_header(m,"Queue");
- char *memberfilter = astman_get_header(m,"Member");
+ const char *id = astman_get_header(m,"ActionID");
+ const char *queuefilter = astman_get_header(m,"Queue");
+ const char *memberfilter = astman_get_header(m,"Member");
char idText[256] = "";
struct call_queue *q;
struct queue_ent *qe;
@@ -4128,9 +4128,9 @@
return RESULT_SUCCESS;
}
-static int manager_add_queue_member(struct mansession *s, struct message *m)
-{
- char *queuename, *interface, *penalty_s, *paused_s, *membername;
+static int manager_add_queue_member(struct mansession *s, const struct message *m)
+{
+ const char *queuename, *interface, *penalty_s, *paused_s, *membername;
int paused, penalty = 0;
queuename = astman_get_header(m, "Queue");
@@ -4181,9 +4181,9 @@
return 0;
}
-static int manager_remove_queue_member(struct mansession *s, struct message *m)
-{
- char *queuename, *interface;
+static int manager_remove_queue_member(struct mansession *s, const struct message *m)
+{
+ const char *queuename, *interface;
queuename = astman_get_header(m, "Queue");
interface = astman_get_header(m, "Interface");
@@ -4212,9 +4212,9 @@
return 0;
}
-static int manager_pause_queue_member(struct mansession *s, struct message *m)
-{
- char *queuename, *interface, *paused_s;
+static int manager_pause_queue_member(struct mansession *s, const struct message *m)
+{
+ const char *queuename, *interface, *paused_s;
int paused;
interface = astman_get_header(m, "Interface");
Modified: branches/1.4/apps/app_senddtmf.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/apps/app_senddtmf.c?view=diff&rev=49676&r1=49675&r2=49676
==============================================================================
--- branches/1.4/apps/app_senddtmf.c (original)
+++ branches/1.4/apps/app_senddtmf.c Fri Jan 5 16:16:33 2007
@@ -94,10 +94,10 @@
" Channel: Channel name to send digit to\n"
" Digit: The dtmf digit to play\n";
-static int manager_play_dtmf(struct mansession *s, struct message *m)
+static int manager_play_dtmf(struct mansession *s, const struct message *m)
{
- char *channel = astman_get_header(m, "Channel");
- char *digit = astman_get_header(m, "Digit");
+ const char *channel = astman_get_header(m, "Channel");
+ const char *digit = astman_get_header(m, "Digit");
struct ast_channel *chan = ast_get_channel_by_name_locked(channel);
if (!chan) {
Modified: branches/1.4/apps/app_setcdruserfield.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/apps/app_setcdruserfield.c?view=diff&rev=49676&r1=49675&r2=49676
==============================================================================
--- branches/1.4/apps/app_setcdruserfield.c (original)
+++ branches/1.4/apps/app_setcdruserfield.c Fri Jan 5 16:16:33 2007
@@ -73,12 +73,12 @@
static char *appendcdruserfield_synopsis = "Append to the CDR user field";
-static int action_setcdruserfield(struct mansession *s, struct message *m)
+static int action_setcdruserfield(struct mansession *s, const struct message *m)
{
struct ast_channel *c = NULL;
- char *userfield = astman_get_header(m, "UserField");
- char *channel = astman_get_header(m, "Channel");
- char *append = astman_get_header(m, "Append");
+ const char *userfield = astman_get_header(m, "UserField");
+ const char *channel = astman_get_header(m, "Channel");
+ const char *append = astman_get_header(m, "Append");
if (ast_strlen_zero(channel)) {
astman_send_error(s, m, "No Channel specified");
Modified: branches/1.4/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_agent.c?view=diff&rev=49676&r1=49675&r2=49676
==============================================================================
--- branches/1.4/channels/chan_agent.c (original)
+++ branches/1.4/channels/chan_agent.c Fri Jan 5 16:16:33 2007
@@ -1395,9 +1395,9 @@
* \returns
* \sa action_agent_logoff(), action_agent_callback_login(), load_module().
*/
-static int action_agents(struct mansession *s, struct message *m)
-{
- char *id = astman_get_header(m,"ActionID");
+static int action_agents(struct mansession *s, const struct message *m)
+{
+ const char *id = astman_get_header(m,"ActionID");
char idText[256] = "";
char chanbuf[256];
struct agent_pvt *p;
@@ -1505,7 +1505,7 @@
}
-static int agent_logoff(char *agent, int soft)
+static int agent_logoff(const char *agent, int soft)
{
struct agent_pvt *p;
long logintime;
@@ -1556,10 +1556,10 @@
* \returns
* \sa action_agents(), action_agent_callback_login(), load_module().
*/
-static int action_agent_logoff(struct mansession *s, struct message *m)
-{
- char *agent = astman_get_header(m, "Agent");
- char *soft_s = astman_get_header(m, "Soft"); /* "true" is don't hangup */
+static int action_agent_logoff(struct mansession *s, const struct message *m)
+{
+ const char *agent = astman_get_header(m, "Agent");
+ const char *soft_s = astman_get_header(m, "Soft"); /* "true" is don't hangup */
int soft;
int ret; /* return value of agent_logoff */
@@ -2234,13 +2234,13 @@
* \returns
* \sa action_agents(), action_agent_logoff(), load_module().
*/
-static int action_agent_callback_login(struct mansession *s, struct message *m)
-{
- char *agent = astman_get_header(m, "Agent");
- char *exten = astman_get_header(m, "Exten");
- char *context = astman_get_header(m, "Context");
- char *wrapuptime_s = astman_get_header(m, "WrapupTime");
- char *ackcall_s = astman_get_header(m, "AckCall");
+static int action_agent_callback_login(struct mansession *s, const struct message *m)
+{
+ const char *agent = astman_get_header(m, "Agent");
+ const char *exten = astman_get_header(m, "Exten");
+ const char *context = astman_get_header(m, "Context");
+ const char *wrapuptime_s = astman_get_header(m, "WrapupTime");
+ const char *ackcall_s = astman_get_header(m, "AckCall");
struct agent_pvt *p;
int login_state = 0;
Modified: branches/1.4/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_iax2.c?view=diff&rev=49676&r1=49675&r2=49676
==============================================================================
--- branches/1.4/channels/chan_iax2.c (original)
+++ branches/1.4/channels/chan_iax2.c Fri Jan 5 16:16:33 2007
@@ -4187,7 +4187,7 @@
{
return __iax2_show_peers(0, fd, NULL, argc, argv);
}
-static int manager_iax2_show_netstats( struct mansession *s, struct message *m )
+static int manager_iax2_show_netstats(struct mansession *s, const struct message *m)
{
ast_cli_netstats(s, -1, 0);
astman_append(s, "\r\n");
@@ -4220,12 +4220,12 @@
}
/* JDG: callback to display iax peers in manager */
-static int manager_iax2_show_peers( struct mansession *s, struct message *m )
+static int manager_iax2_show_peers(struct mansession *s, const struct message *m)
{
char *a[] = { "iax2", "show", "users" };
int ret;
- char *id;
- id = astman_get_header(m,"ActionID");
+ const char *id = astman_get_header(m,"ActionID");
+
if (!ast_strlen_zero(id))
astman_append(s, "ActionID: %s\r\n",id);
ret = __iax2_show_peers(1, -1, s, 3, a );
Modified: branches/1.4/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_sip.c?view=diff&rev=49676&r1=49675&r2=49676
==============================================================================
--- branches/1.4/channels/chan_sip.c (original)
+++ branches/1.4/channels/chan_sip.c Fri Jan 5 16:16:33 2007
@@ -1335,8 +1335,7 @@
static char *nat2str(int nat) attribute_const;
static int peer_status(struct sip_peer *peer, char *status, int statuslen);
static int sip_show_users(int fd, int argc, char *argv[]);
-static int _sip_show_peers(int fd, int *total, struct mansession *s, struct message *m, int argc, char *argv[]);
-static int manager_sip_show_peers( struct mansession *s, struct message *m );
+static int _sip_show_peers(int fd, int *total, struct mansession *s, const struct message *m, int argc, const char *argv[]);
static int sip_show_peers(int fd, int argc, char *argv[]);
static int sip_show_objects(int fd, int argc, char *argv[]);
static void print_group(int fd, ast_group_t group, int crlf);
@@ -1346,10 +1345,8 @@
static void print_codec_to_cli(int fd, struct ast_codec_pref *pref);
static const char *domain_mode_to_text(const enum domain_mode mode);
static int sip_show_domains(int fd, int argc, char *argv[]);
-static int _sip_show_peer(int type, int fd, struct mansession *s, struct message *m, int argc, char *argv[]);
-static int manager_sip_show_peer( struct mansession *s, struct message *m);
+static int _sip_show_peer(int type, int fd, struct mansession *s, const struct message *m, int argc, const char *argv[]);
static int sip_show_peer(int fd, int argc, char *argv[]);
-static int _sip_show_peer(int type, int fd, struct mansession *s, struct message *m, int argc, char *argv[]);
static int sip_show_user(int fd, int argc, char *argv[]);
static int sip_show_registry(int fd, int argc, char *argv[]);
static int sip_show_settings(int fd, int argc, char *argv[]);
@@ -9394,10 +9391,10 @@
/*! \brief Show SIP peers in the manager API */
/* Inspired from chan_iax2 */
-static int manager_sip_show_peers( struct mansession *s, struct message *m )
-{
- char *id = astman_get_header(m,"ActionID");
- char *a[] = { "sip", "show", "peers" };
+static int manager_sip_show_peers(struct mansession *s, const struct message *m)
+{
+ const char *id = astman_get_header(m,"ActionID");
+ const char *a[] = {"sip", "show", "peers"};
char idtext[256] = "";
int total = 0;
@@ -9419,11 +9416,11 @@
/*! \brief CLI Show Peers command */
static int sip_show_peers(int fd, int argc, char *argv[])
{
- return _sip_show_peers(fd, NULL, NULL, NULL, argc, argv);
+ return _sip_show_peers(fd, NULL, NULL, NULL, argc, (const char **) argv);
}
/*! \brief _sip_show_peers: Execute sip show peers command */
-static int _sip_show_peers(int fd, int *total, struct mansession *s, struct message *m, int argc, char *argv[])
+static int _sip_show_peers(int fd, int *total, struct mansession *s, const struct message *m, int argc, const char *argv[])
{
regex_t regexbuf;
int havepattern = FALSE;
@@ -9437,7 +9434,7 @@
int peers_mon_offline = 0;
int peers_unmon_offline = 0;
int peers_unmon_online = 0;
- char *id;
+ const char *id;
char idtext[256] = "";
int realtimepeers;
@@ -9843,11 +9840,11 @@
" ActionID: <id> Optional action ID for this AMI transaction.\n";
/*! \brief Show SIP peers in the manager API */
-static int manager_sip_show_peer( struct mansession *s, struct message *m)
-{
- char *id = astman_get_header(m,"ActionID");
- char *a[4];
- char *peer;
+static int manager_sip_show_peer(struct mansession *s, const struct message *m)
+{
+ const char *id = astman_get_header(m,"ActionID");
+ const char *a[4];
+ const char *peer;
int ret;
peer = astman_get_header(m,"Peer");
@@ -9862,7 +9859,7 @@
if (!ast_strlen_zero(id))
astman_append(s, "ActionID: %s\r\n",id);
- ret = _sip_show_peer(1, -1, s, m, 4, a );
+ ret = _sip_show_peer(1, -1, s, m, 4, a);
astman_append(s, "\r\n\r\n" );
return ret;
}
@@ -9872,11 +9869,11 @@
/*! \brief Show one peer in detail */
static int sip_show_peer(int fd, int argc, char *argv[])
{
- return _sip_show_peer(0, fd, NULL, NULL, argc, argv);
+ return _sip_show_peer(0, fd, NULL, NULL, argc, (const char **) argv);
}
/*! \brief Show one peer in detail (main function) */
-static int _sip_show_peer(int type, int fd, struct mansession *s, struct message *m, int argc, char *argv[])
+static int _sip_show_peer(int type, int fd, struct mansession *s, const struct message *m, int argc, const char *argv[])
{
char status[30] = "";
char cbuf[256];
Modified: branches/1.4/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_zap.c?view=diff&rev=49676&r1=49675&r2=49676
==============================================================================
--- branches/1.4/channels/chan_zap.c (original)
+++ branches/1.4/channels/chan_zap.c Fri Jan 5 16:16:33 2007
@@ -9743,7 +9743,7 @@
return RESULT_SUCCESS;
}
-static int action_zaprestart(struct mansession *s, struct message *m)
+static int action_zaprestart(struct mansession *s, const struct message *m)
{
if (zap_restart() != 0) {
astman_send_error(s, m, "Failed rereading zaptel configuration");
@@ -10116,46 +10116,11 @@
return p;
}
-static int action_zapdndon(struct mansession *s, struct message *m)
-{
- struct zt_pvt *p = NULL;
- char *channel = astman_get_header(m, "ZapChannel");
- if (ast_strlen_zero(channel)) {
- astman_send_error(s, m, "No channel specified");
- return 0;
- }
- p = find_channel(atoi(channel));
- if (!p) {
- astman_send_error(s, m, "No such channel");
- return 0;
- }
- p->dnd = 1;
- astman_send_ack(s, m, "DND Enabled");
- return 0;
-}
-
-static int action_zapdndoff(struct mansession *s, struct message *m)
-{
- struct zt_pvt *p = NULL;
- char *channel = astman_get_header(m, "ZapChannel");
- if (ast_strlen_zero(channel)) {
- astman_send_error(s, m, "No channel specified");
- return 0;
- }
- p = find_channel(atoi(channel));
- if (!p) {
- astman_send_error(s, m, "No such channel");
- return 0;
- }
- p->dnd = 0;
- astman_send_ack(s, m, "DND Disabled");
- return 0;
-}
-
-static int action_transfer(struct mansession *s, struct message *m)
+static int action_zapdndon(struct mansession *s, const struct message *m)
{
struct zt_pvt *p = NULL;
- char *channel = astman_get_header(m, "ZapChannel");
+ const char *channel = astman_get_header(m, "ZapChannel");
+
if (ast_strlen_zero(channel)) {
astman_send_error(s, m, "No channel specified");
return 0;
@@ -10165,15 +10130,16 @@
astman_send_error(s, m, "No such channel");
return 0;
}
- zap_fake_event(p,TRANSFER);
- astman_send_ack(s, m, "ZapTransfer");
+ p->dnd = 1;
+ astman_send_ack(s, m, "DND Enabled");
return 0;
}
-static int action_transferhangup(struct mansession *s, struct message *m)
+static int action_zapdndoff(struct mansession *s, const struct message *m)
{
struct zt_pvt *p = NULL;
- char *channel = astman_get_header(m, "ZapChannel");
+ const char *channel = astman_get_header(m, "ZapChannel");
+
if (ast_strlen_zero(channel)) {
astman_send_error(s, m, "No channel specified");
return 0;
@@ -10183,23 +10149,18 @@
astman_send_error(s, m, "No such channel");
return 0;
}
- zap_fake_event(p,HANGUP);
- astman_send_ack(s, m, "ZapHangup");
+ p->dnd = 0;
+ astman_send_ack(s, m, "DND Disabled");
return 0;
}
-static int action_zapdialoffhook(struct mansession *s, struct message *m)
+static int action_transfer(struct mansession *s, const struct message *m)
{
struct zt_pvt *p = NULL;
- char *channel = astman_get_header(m, "ZapChannel");
- char *number = astman_get_header(m, "Number");
- int i;
+ const char *channel = astman_get_header(m, "ZapChannel");
+
if (ast_strlen_zero(channel)) {
astman_send_error(s, m, "No channel specified");
- return 0;
- }
- if (ast_strlen_zero(number)) {
- astman_send_error(s, m, "No number specified");
return 0;
}
p = find_channel(atoi(channel));
@@ -10207,6 +10168,50 @@
astman_send_error(s, m, "No such channel");
return 0;
}
+ zap_fake_event(p,TRANSFER);
+ astman_send_ack(s, m, "ZapTransfer");
+ return 0;
+}
+
+static int action_transferhangup(struct mansession *s, const struct message *m)
+{
+ struct zt_pvt *p = NULL;
+ const char *channel = astman_get_header(m, "ZapChannel");
+
+ if (ast_strlen_zero(channel)) {
+ astman_send_error(s, m, "No channel specified");
+ return 0;
+ }
+ p = find_channel(atoi(channel));
+ if (!p) {
+ astman_send_error(s, m, "No such channel");
+ return 0;
+ }
+ zap_fake_event(p,HANGUP);
+ astman_send_ack(s, m, "ZapHangup");
+ return 0;
+}
+
+static int action_zapdialoffhook(struct mansession *s, const struct message *m)
+{
+ struct zt_pvt *p = NULL;
+ const char *channel = astman_get_header(m, "ZapChannel");
+ const char *number = astman_get_header(m, "Number");
+ int i;
+
+ if (ast_strlen_zero(channel)) {
+ astman_send_error(s, m, "No channel specified");
+ return 0;
+ }
+ if (ast_strlen_zero(number)) {
+ astman_send_error(s, m, "No number specified");
+ return 0;
+ }
+ p = find_channel(atoi(channel));
+ if (!p) {
+ astman_send_error(s, m, "No such channel");
+ return 0;
+ }
if (!p->owner) {
astman_send_error(s, m, "Channel does not have it's owner");
return 0;
@@ -10219,10 +10224,10 @@
return 0;
}
-static int action_zapshowchannels(struct mansession *s, struct message *m)
+static int action_zapshowchannels(struct mansession *s, const struct message *m)
{
struct zt_pvt *tmp = NULL;
- char *id = astman_get_header(m, "ActionID");
+ const char *id = astman_get_header(m, "ActionID");
char idText[256] = "";
astman_send_ack(s, m, "Zapata channel status will follow");
Modified: branches/1.4/include/asterisk/jabber.h
URL: http://svn.digium.com/view/asterisk/branches/1.4/include/asterisk/jabber.h?view=diff&rev=49676&r1=49675&r2=49676
==============================================================================
--- branches/1.4/include/asterisk/jabber.h (original)
+++ branches/1.4/include/asterisk/jabber.h Fri Jan 5 16:16:33 2007
@@ -120,14 +120,14 @@
ASTOBJ_CONTAINER_COMPONENTS(struct aji_client);
};
-int ast_aji_send(struct aji_client *client, char *address, char *message);
+int ast_aji_send(struct aji_client *client, const char *address, const char *message);
int ast_aji_disconnect(struct aji_client *client);
int ast_aji_check_roster(void);
void ast_aji_increment_mid(char *mid);
int ast_aji_create_chat(struct aji_client *client,char *room, char *server, char *topic);
int ast_aji_invite_chat(struct aji_client *client, char *user, char *room, char *message);
int ast_aji_join_chat(struct aji_client *client,char *room);
-struct aji_client *ast_aji_get_client(char *name);
+struct aji_client *ast_aji_get_client(const char *name);
struct aji_client_container *ast_aji_get_clients(void);
#endif
Modified: branches/1.4/include/asterisk/manager.h
URL: http://svn.digium.com/view/asterisk/branches/1.4/include/asterisk/manager.h?view=diff&rev=49676&r1=49675&r2=49676
==============================================================================
--- branches/1.4/include/asterisk/manager.h (original)
+++ branches/1.4/include/asterisk/manager.h Fri Jan 5 16:16:33 2007
@@ -58,13 +58,12 @@
/* Export manager structures */
#define AST_MAX_MANHEADERS 80
-#define AST_MAX_MANHEADER_LEN 256
struct mansession;
struct message {
- int hdrcount;
- char headers[AST_MAX_MANHEADERS][AST_MAX_MANHEADER_LEN];
+ unsigned int hdrcount;
+ const char *headers[AST_MAX_MANHEADERS];
};
struct manager_action {
@@ -77,7 +76,7 @@
/*! Permission required for action. EVENT_FLAG_* */
int authority;
/*! Function to be called */
- int (*func)(struct mansession *s, struct message *m);
+ int (*func)(struct mansession *s, const struct message *m);
/*! For easy linking */
struct manager_action *next;
};
@@ -97,7 +96,7 @@
int ast_manager_register2(
const char *action,
int authority,
- int (*func)(struct mansession *s, struct message *m),
+ int (*func)(struct mansession *s, const struct message *m),
const char *synopsis,
const char *description);
@@ -111,27 +110,23 @@
\param event Event name
\param contents Contents of event
*/
-int manager_event(int category, const char *event, const char *contents, ...)
- __attribute__ ((format (printf, 3,4)));
+int __attribute__ ((format (printf, 3,4))) manager_event(int category, const char *event, const char *contents, ...);
/*! Get header from mananger transaction */
-char *astman_get_header(struct message *m, char *var);
+const char *astman_get_header(const struct message *m, char *var);
/*! Get a linked list of the Variable: headers */
-struct ast_variable *astman_get_variables(struct message *m);
+struct ast_variable *astman_get_variables(const struct message *m);
/*! Send error in manager transaction */
-void astman_send_error(struct mansession *s, struct message *m, char *error);
-void astman_send_response(struct mansession *s, struct message *m, char *resp, char *msg);
-void astman_send_ack(struct mansession *s, struct message *m, char *msg);
+void astman_send_error(struct mansession *s, const struct message *m, char *error);
+void astman_send_response(struct mansession *s, const struct message *m, char *resp, char *msg);
+void astman_send_ack(struct mansession *s, const struct message *m, char *msg);
-void astman_append(struct mansession *s, const char *fmt, ...)
- __attribute__ ((format (printf, 2, 3)));
-
+void __attribute__ ((format (printf, 2, 3))) astman_append(struct mansession *s, const char *fmt, ...);
/*! Called by Asterisk initialization */
int init_manager(void);
-/*! Called by Asterisk initialization */
int reload_manager(void);
#endif /* _ASTERISK_MANAGER_H */
Modified: branches/1.4/main/config.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/config.c?view=diff&rev=49676&r1=49675&r2=49676
==============================================================================
--- branches/1.4/main/config.c (original)
+++ branches/1.4/main/config.c Fri Jan 5 16:16:33 2007
@@ -855,7 +855,6 @@
lineno++;
if (fgets(buf, sizeof(buf), f)) {
if ( withcomments ) {
- ast_log(LOG_NOTICE, "moo\n");
CB_ADD(lline_buffer); /* add the current lline buffer to the comment buffer */
lline_buffer[0] = 0; /* erase the lline buffer */
}
Modified: branches/1.4/main/db.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/db.c?view=diff&rev=49676&r1=49675&r2=49676
==============================================================================
--- branches/1.4/main/db.c (original)
+++ branches/1.4/main/db.c Fri Jan 5 16:16:33 2007
@@ -519,11 +519,11 @@
database_deltree_usage },
};
-static int manager_dbput(struct mansession *s, struct message *m)
-{
- char *family = astman_get_header(m, "Family");
- char *key = astman_get_header(m, "Key");
- char *val = astman_get_header(m, "Val");
+static int manager_dbput(struct mansession *s, const struct message *m)
+{
+ const char *family = astman_get_header(m, "Family");
+ const char *key = astman_get_header(m, "Key");
+ const char *val = astman_get_header(m, "Val");
int res;
if (ast_strlen_zero(family)) {
@@ -539,7 +539,7 @@
return 0;
}
- res = ast_db_put(family, key, val);
+ res = ast_db_put(family, key, (char *) val);
if (res) {
astman_send_error(s, m, "Failed to update entry");
} else {
@@ -548,12 +548,12 @@
return 0;
}
-static int manager_dbget(struct mansession *s, struct message *m)
-{
- char *id = astman_get_header(m,"ActionID");
+static int manager_dbget(struct mansession *s, const struct message *m)
+{
+ const char *id = astman_get_header(m,"ActionID");
char idText[256] = "";
- char *family = astman_get_header(m, "Family");
- char *key = astman_get_header(m, "Key");
+ const char *family = astman_get_header(m, "Family");
+ const char *key = astman_get_header(m, "Key");
char tmp[256];
int res;
Modified: branches/1.4/main/manager.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/manager.c?view=diff&rev=49676&r1=49675&r2=49676
==============================================================================
--- branches/1.4/main/manager.c (original)
+++ branches/1.4/main/manager.c Fri Jan 5 16:16:33 2007
@@ -70,16 +70,16 @@
#include "asterisk/linkedlists.h"
struct fast_originate_helper {
- char tech[AST_MAX_MANHEADER_LEN];
- char data[AST_MAX_MANHEADER_LEN];
+ char tech[AST_MAX_EXTENSION];
+ char data[AST_MAX_EXTENSION];
int timeout;
char app[AST_MAX_APP];
- char appdata[AST_MAX_MANHEADER_LEN];
- char cid_name[AST_MAX_MANHEADER_LEN];
- char cid_num[AST_MAX_MANHEADER_LEN];
+ char appdata[AST_MAX_EXTENSION];
+ char cid_name[AST_MAX_EXTENSION];
+ char cid_num[AST_MAX_EXTENSION];
char context[AST_MAX_CONTEXT];
char exten[AST_MAX_EXTENSION];
- char idtext[AST_MAX_MANHEADER_LEN];
+ char idtext[AST_MAX_EXTENSION];
char account[AST_MAX_ACCOUNT_CODE];
int priority;
struct ast_variable *vars;
@@ -160,7 +160,7 @@
/*! Authorization for writing */
int writeperm;
/*! Buffer */
- char inbuf[AST_MAX_MANHEADER_LEN];
+ char inbuf[1024];
int inlen;
int send_events;
int displaysystemname; /*!< Add system name to manager responses and events */
@@ -675,7 +675,7 @@
free_session(s);
}
-char *astman_get_header(struct message *m, char *var)
+const char *astman_get_header(const struct message *m, char *var)
{
char cmp[80];
int x;
@@ -690,7 +690,7 @@
return "";
}
-struct ast_variable *astman_get_variables(struct message *m)
+struct ast_variable *astman_get_variables(const struct message *m)
{
int varlen, x, y;
struct ast_variable *head = NULL, *cur;
@@ -739,9 +739,9 @@
be read until either the current action finishes or get_input() obtains the session
lock.
*/
-void astman_send_error(struct mansession *s, struct message *m, char *error)
-{
- char *id = astman_get_header(m,"ActionID");
+void astman_send_error(struct mansession *s, const struct message *m, char *error)
+{
+ const char *id = astman_get_header(m,"ActionID");
astman_append(s, "Response: Error\r\n");
if (!ast_strlen_zero(id))
@@ -749,9 +749,9 @@
astman_append(s, "Message: %s\r\n\r\n", error);
}
-void astman_send_response(struct mansession *s, struct message *m, char *resp, char *msg)
-{
- char *id = astman_get_header(m,"ActionID");
+void astman_send_response(struct mansession *s, const struct message *m, char *resp, char *msg)
+{
+ const char *id = astman_get_header(m,"ActionID");
astman_append(s, "Response: %s\r\n", resp);
if (!ast_strlen_zero(id))
@@ -762,7 +762,7 @@
astman_append(s, "\r\n");
}
-void astman_send_ack(struct mansession *s, struct message *m, char *msg)
+void astman_send_ack(struct mansession *s, const struct message *m, char *msg)
{
astman_send_response(s, m, "Success", msg);
}
@@ -822,11 +822,11 @@
return ret ? atoi(string) : 0;
}
-static int ast_strings_to_mask(char *string)
+static int strings_to_mask(const char *string)
{
int x, ret = -1;
- x = ast_is_number(string);
+ x = ast_is_number((char *) string);
if (x)
ret = x;
@@ -853,9 +853,9 @@
Rather than braindead on,off this now can also accept a specific int mask value
or a ',' delim list of mask strings (the same as manager.conf) -anthm
*/
-static int set_eventmask(struct mansession *s, char *eventmask)
-{
- int maskint = ast_strings_to_mask(eventmask);
+static int set_eventmask(struct mansession *s, const char *eventmask)
+{
+ int maskint = strings_to_mask(eventmask);
ast_mutex_lock(&s->__lock);
if (maskint >= 0)
@@ -865,15 +865,15 @@
return maskint;
}
-static int authenticate(struct mansession *s, struct message *m)
+static int authenticate(struct mansession *s, const struct message *m)
{
struct ast_config *cfg;
char *cat;
- char *user = astman_get_header(m, "Username");
- char *pass = astman_get_header(m, "Secret");
- char *authtype = astman_get_header(m, "AuthType");
- char *key = astman_get_header(m, "Key");
- char *events = astman_get_header(m, "Events");
+ const char *user = astman_get_header(m, "Username");
+ const char *pass = astman_get_header(m, "Secret");
+ const char *authtype = astman_get_header(m, "AuthType");
+ const char *key = astman_get_header(m, "Key");
+ const char *events = astman_get_header(m, "Events");
cfg = ast_config_load("manager.conf");
if (!cfg)
@@ -969,7 +969,7 @@
" manager connection open.\n"
"Variables: NONE\n";
-static int action_ping(struct mansession *s, struct message *m)
+static int action_ping(struct mansession *s, const struct message *m)
{
astman_send_response(s, m, "Pong", NULL);
return 0;
@@ -981,16 +981,16 @@
"Variables:\n"
" Filename: Configuration filename (e.g. foo.conf)\n";
-static int action_getconfig(struct mansession *s, struct message *m)
+static int action_getconfig(struct mansession *s, const struct message *m)
{
struct ast_config *cfg;
- char *fn = astman_get_header(m, "Filename");
+ const char *fn = astman_get_header(m, "Filename");
int catcount = 0;
int lineno = 0;
char *category=NULL;
struct ast_variable *v;
char idText[256] = "";
- char *id = astman_get_header(m, "ActionID");
+ const char *id = astman_get_header(m, "ActionID");
if (!ast_strlen_zero(id))
snprintf(idText, sizeof(idText), "ActionID: %s\r\n", id);
@@ -1018,11 +1018,11 @@
}
-static void handle_updates(struct mansession *s, struct message *m, struct ast_config *cfg)
+static void handle_updates(struct mansession *s, const struct message *m, struct ast_config *cfg)
{
int x;
char hdr[40];
- char *action, *cat, *var, *value, *match;
+ const char *action, *cat, *var, *value, *match;
struct ast_category *category;
struct ast_variable *v;
@@ -1054,13 +1054,13 @@
}
} else if (!strcasecmp(action, "delcat")) {
if (!ast_strlen_zero(cat))
- ast_category_delete(cfg, cat);
+ ast_category_delete(cfg, (char *) cat);
} else if (!strcasecmp(action, "update")) {
if (!ast_strlen_zero(cat) && !ast_strlen_zero(var) && (category = ast_category_get(cfg, cat)))
- ast_variable_update(category, var, value, match);
+ ast_variable_update(category, (char *) var, (char *) value, (char *) match);
} else if (!strcasecmp(action, "delete")) {
if (!ast_strlen_zero(cat) && !ast_strlen_zero(var) && (category = ast_category_get(cfg, cat)))
- ast_variable_delete(category, var, match);
+ ast_variable_delete(category, (char *) var, (char *) match);
} else if (!strcasecmp(action, "append")) {
if (!ast_strlen_zero(cat) && !ast_strlen_zero(var) &&
(category = ast_category_get(cfg, cat)) &&
@@ -1086,15 +1086,15 @@
" Value-XXXXXX: Value to work on\n"
" Match-XXXXXX: Extra match required to match line\n";
-static int action_updateconfig(struct mansession *s, struct message *m)
+static int action_updateconfig(struct mansession *s, const struct message *m)
{
struct ast_config *cfg;
- char *sfn = astman_get_header(m, "SrcFilename");
- char *dfn = astman_get_header(m, "DstFilename");
+ const char *sfn = astman_get_header(m, "SrcFilename");
+ const char *dfn = astman_get_header(m, "DstFilename");
int res;
char idText[256] = "";
- char *id = astman_get_header(m, "ActionID");
- char *rld = astman_get_header(m, "Reload");
+ const char *id = astman_get_header(m, "ActionID");
+ const char *rld = astman_get_header(m, "Reload");
if (!ast_strlen_zero(id))
snprintf(idText, sizeof(idText), "ActionID: %s\r\n", id);
@@ -1131,15 +1131,15 @@
"Variables: \n"
" Timeout: Maximum time to wait for events\n";
-static int action_waitevent(struct mansession *s, struct message *m)
-{
- char *timeouts = astman_get_header(m, "Timeout");
+static int action_waitevent(struct mansession *s, const struct message *m)
+{
+ const char *timeouts = astman_get_header(m, "Timeout");
int timeout = -1, max;
int x;
int needexit = 0;
time_t now;
struct eventqent *eqe;
- char *id = astman_get_header(m,"ActionID");
+ const char *id = astman_get_header(m,"ActionID");
char idText[256] = "";
if (!ast_strlen_zero(id))
@@ -1218,12 +1218,12 @@
" action that is available to the user\n"
"Variables: NONE\n";
-static int action_listcommands(struct mansession *s, struct message *m)
+static int action_listcommands(struct mansession *s, const struct message *m)
{
struct manager_action *cur = first_action;
char idText[256] = "";
char temp[BUFSIZ];
- char *id = astman_get_header(m,"ActionID");
+ const char *id = astman_get_header(m,"ActionID");
if (!ast_strlen_zero(id))
snprintf(idText, sizeof(idText), "ActionID: %s\r\n", id);
@@ -1248,9 +1248,9 @@
" 'off' if no events should be sent,\n"
" 'system,call,log' to select which flags events should have to be sent.\n";
-static int action_events(struct mansession *s, struct message *m)
-{
- char *mask = astman_get_header(m, "EventMask");
+static int action_events(struct mansession *s, const struct message *m)
+{
+ const char *mask = astman_get_header(m, "EventMask");
int res;
res = set_eventmask(s, mask);
@@ -1266,7 +1266,7 @@
"Description: Logoff this manager session\n"
"Variables: NONE\n";
-static int action_logoff(struct mansession *s, struct message *m)
+static int action_logoff(struct mansession *s, const struct message *m)
{
astman_send_response(s, m, "Goodbye", "Thanks for all the fish.");
return -1;
@@ -1277,10 +1277,10 @@
"Variables: \n"
" Channel: The channel name to be hungup\n";
-static int action_hangup(struct mansession *s, struct message *m)
+static int action_hangup(struct mansession *s, const struct message *m)
{
struct ast_channel *c = NULL;
- char *name = astman_get_header(m, "Channel");
+ const char *name = astman_get_header(m, "Channel");
if (ast_strlen_zero(name)) {
astman_send_error(s, m, "No channel specified");
return 0;
@@ -1303,12 +1303,12 @@
" *Variable: Variable name\n"
" *Value: Value\n";
-static int action_setvar(struct mansession *s, struct message *m)
+static int action_setvar(struct mansession *s, const struct message *m)
{
struct ast_channel *c = NULL;
- char *name = astman_get_header(m, "Channel");
- char *varname = astman_get_header(m, "Variable");
- char *varval = astman_get_header(m, "Value");
+ const char *name = astman_get_header(m, "Channel");
+ const char *varname = astman_get_header(m, "Variable");
+ const char *varval = astman_get_header(m, "Value");
if (ast_strlen_zero(varname)) {
astman_send_error(s, m, "No variable specified");
@@ -1345,12 +1345,12 @@
" *Variable: Variable name\n"
" ActionID: Optional Action id for message matching.\n";
-static int action_getvar(struct mansession *s, struct message *m)
+static int action_getvar(struct mansession *s, const struct message *m)
{
struct ast_channel *c = NULL;
- char *name = astman_get_header(m, "Channel");
- char *varname = astman_get_header(m, "Variable");
- char *id = astman_get_header(m,"ActionID");
+ const char *name = astman_get_header(m, "Channel");
+ const char *varname = astman_get_header(m, "Variable");
+ const char *id = astman_get_header(m,"ActionID");
char *varval;
char workspace[1024];
@@ -1368,7 +1368,7 @@
}
if (varname[strlen(varname) - 1] == ')') {
- ast_func_read(c, varname, workspace, sizeof(workspace));
[... 529 lines stripped ...]
More information about the asterisk-commits
mailing list