[asterisk-commits] kpfleming: trunk r49678 - in /trunk: ./ apps/ channels/ include/asterisk/ mai...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri Jan 5 15:43:19 MST 2007


Author: kpfleming
Date: Fri Jan  5 16:43:18 2007
New Revision: 49678

URL: http://svn.digium.com/view/asterisk?view=rev&rev=49678
Log:
Merged revisions 49676 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r49676 | kpfleming | 2007-01-05 16:16:33 -0600 (Fri, 05 Jan 2007) | 2 lines

reduce stack consumption for AMI and AMI/HTTP requests by nearly 20K in most cases

........

Modified:
    trunk/   (props changed)
    trunk/apps/app_meetme.c
    trunk/apps/app_queue.c
    trunk/apps/app_senddtmf.c
    trunk/channels/chan_agent.c
    trunk/channels/chan_iax2.c
    trunk/channels/chan_sip.c
    trunk/channels/chan_zap.c
    trunk/include/asterisk/jabber.h
    trunk/include/asterisk/manager.h
    trunk/main/config.c
    trunk/main/db.c
    trunk/main/manager.c
    trunk/main/pbx.c
    trunk/res/res_features.c
    trunk/res/res_jabber.c
    trunk/res/res_monitor.c
    trunk/utils/astman.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_meetme.c?view=diff&rev=49678&r1=49677&r2=49678
==============================================================================
--- trunk/apps/app_meetme.c (original)
+++ trunk/apps/app_meetme.c Fri Jan  5 16:43:18 2007
@@ -2773,12 +2773,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)) {
@@ -2834,12 +2834,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: trunk/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_queue.c?view=diff&rev=49678&r1=49677&r2=49678
==============================================================================
--- trunk/apps/app_queue.c (original)
+++ trunk/apps/app_queue.c Fri Jan  5 16:43:18 2007
@@ -408,7 +408,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 set_queue_result(struct ast_channel *chan, enum queue_result res)
 {
@@ -635,7 +635,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;
 	
@@ -711,7 +711,7 @@
 	q->wrapuptime = 0;
 }
 
-static int add_to_interfaces(char *interface)
+static int add_to_interfaces(const char *interface)
 {
 	struct member_interface *curint;
 
@@ -738,7 +738,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;
@@ -760,7 +760,7 @@
 	return ret;
 }
 
-static int remove_from_interfaces(char *interface)
+static int remove_from_interfaces(const char *interface)
 {
 	struct member_interface *curint;
 
@@ -1133,7 +1133,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;
@@ -2781,7 +2781,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;
 
@@ -2836,7 +2836,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;
@@ -2890,7 +2890,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;
@@ -2941,7 +2941,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;
@@ -4162,7 +4162,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" };
 
@@ -4173,14 +4173,14 @@
 }
 
 /* Dump summary of queue info */
-static int manager_queues_summary(struct mansession *s, struct message *m)
+static int manager_queues_summary(struct mansession *s, const struct message *m)
 {
 	time_t now;
 	int qmemcount = 0;
 	int qmemavail = 0;
 	int qchancount = 0;
-	char *id = astman_get_header(m, "ActionID");
-	char *queuefilter = astman_get_header(m, "Queue");
+	const char *id = astman_get_header(m, "ActionID");
+	const char *queuefilter = astman_get_header(m, "Queue");
 	char idText[256] = "";
 	struct call_queue *q;
 	struct queue_ent *qe;
@@ -4231,13 +4231,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;
@@ -4322,9 +4322,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");
@@ -4375,9 +4375,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");
@@ -4406,9 +4406,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");
@@ -4429,9 +4429,9 @@
 	return 0;
 }
 
-static int manager_queue_log_custom(struct mansession *s, struct message *m)
-{
-	char *queuename, *event, *message, *interface, *uniqueid;
+static int manager_queue_log_custom(struct mansession *s, const struct message *m)
+{
+	const char *queuename, *event, *message, *interface, *uniqueid;
 
 	queuename = astman_get_header(m, "Queue");
 	uniqueid = astman_get_header(m, "UniqueId");

Modified: trunk/apps/app_senddtmf.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_senddtmf.c?view=diff&rev=49678&r1=49677&r2=49678
==============================================================================
--- trunk/apps/app_senddtmf.c (original)
+++ trunk/apps/app_senddtmf.c Fri Jan  5 16:43:18 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: trunk/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_agent.c?view=diff&rev=49678&r1=49677&r2=49678
==============================================================================
--- trunk/channels/chan_agent.c (original)
+++ trunk/channels/chan_agent.c Fri Jan  5 16:43:18 2007
@@ -1389,9 +1389,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;
@@ -1499,7 +1499,7 @@
 
 }
 
-static int agent_logoff(char *agent, int soft)
+static int agent_logoff(const char *agent, int soft)
 {
 	struct agent_pvt *p;
 	long logintime;
@@ -1550,10 +1550,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 */
 

Modified: trunk/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_iax2.c?view=diff&rev=49678&r1=49677&r2=49678
==============================================================================
--- trunk/channels/chan_iax2.c (original)
+++ trunk/channels/chan_iax2.c Fri Jan  5 16:43:18 2007
@@ -4289,7 +4289,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");
@@ -4317,12 +4317,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: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=49678&r1=49677&r2=49678
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Fri Jan  5 16:43:18 2007
@@ -1356,8 +1356,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);
@@ -1367,10 +1366,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[]);
@@ -9614,10 +9611,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;
 
@@ -9640,11 +9637,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;
@@ -9658,7 +9655,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;
 
@@ -10064,11 +10061,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");
@@ -10083,7 +10080,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;
 }
@@ -10093,11 +10090,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: trunk/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_zap.c?view=diff&rev=49678&r1=49677&r2=49678
==============================================================================
--- trunk/channels/chan_zap.c (original)
+++ trunk/channels/chan_zap.c Fri Jan  5 16:43:18 2007
@@ -10682,7 +10682,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");
@@ -11077,46 +11077,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;
@@ -11126,15 +11091,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;
@@ -11144,23 +11110,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));
@@ -11168,6 +11129,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;
@@ -11180,10 +11185,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: trunk/include/asterisk/jabber.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/jabber.h?view=diff&rev=49678&r1=49677&r2=49678
==============================================================================
--- trunk/include/asterisk/jabber.h (original)
+++ trunk/include/asterisk/jabber.h Fri Jan  5 16:43:18 2007
@@ -122,14 +122,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: trunk/include/asterisk/manager.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/manager.h?view=diff&rev=49678&r1=49677&r2=49678
==============================================================================
--- trunk/include/asterisk/manager.h (original)
+++ trunk/include/asterisk/manager.h Fri Jan  5 16:43:18 2007
@@ -58,7 +58,6 @@
 
 /* Export manager structures */
 #define AST_MAX_MANHEADERS 80
-#define AST_MAX_MANHEADER_LEN 256
 
 /* Manager Helper Function */
 typedef int (*manager_hook_t)(int, const char *, char *); 
@@ -85,8 +84,8 @@
 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 {
@@ -99,7 +98,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;
 };
@@ -119,7 +118,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);
 
@@ -133,34 +132,32 @@
 	\param event	Event name
 	\param contents	Contents of event
 */
+
 /* XXX the parser in gcc 2.95 gets confused if you don't put a space
  * between the last arg before VA_ARGS and the comma */
 #define manager_event(category, event, contents , ...)	\
         __manager_event(category, event, __FILE__, __LINE__, __PRETTY_FUNCTION__, contents , ## __VA_ARGS__)
 
-int __manager_event(int category, const char *event,
-		const char *file, int line, const char *func, const char *contents, ...)
-	__attribute__ ((format (printf, 6,7)));
+int __attribute__ ((format(printf, 6, 7))) __manager_event(int category, const char *event,
+							   const char *file, int line, const char *func,
+							   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_listack(struct mansession *s, struct message *m, char *msg, char *listflag);
+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_send_listack(struct mansession *s, const struct message *m, char *msg, char *listflag);
 
-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: trunk/main/config.c
URL: http://svn.digium.com/view/asterisk/trunk/main/config.c?view=diff&rev=49678&r1=49677&r2=49678
==============================================================================
--- trunk/main/config.c (original)
+++ trunk/main/config.c Fri Jan  5 16:43:18 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: trunk/main/db.c
URL: http://svn.digium.com/view/asterisk/trunk/main/db.c?view=diff&rev=49678&r1=49677&r2=49678
==============================================================================
--- trunk/main/db.c (original)
+++ trunk/main/db.c Fri Jan  5 16:43:18 2007
@@ -522,11 +522,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)) {
@@ -542,7 +542,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 {
@@ -551,12 +551,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: trunk/main/manager.c
URL: http://svn.digium.com/view/asterisk/trunk/main/manager.c?view=diff&rev=49678&r1=49677&r2=49678
==============================================================================
--- trunk/main/manager.c (original)
+++ trunk/main/manager.c Fri Jan  5 16:43:18 2007
@@ -138,8 +138,8 @@
 	int authenticated;	/*!< Authentication status */
 	int readperm;		/*!< Authorization for reading */
 	int writeperm;		/*!< Authorization for writing */
-	char inbuf[AST_MAX_MANHEADER_LEN+1];	/*!< Buffer */
-		/* we use the extra byte to add a '\0' and simplify parsing */
+	char inbuf[1025];	/*!< Buffer */
+				/* we use the extra byte to add a '\0' and simplify parsing */
 	int inlen;		/*!< number of buffered bytes */
 	int send_events;	/*!<  XXX what ? */
 	struct eventqent *last_ev;	/*!< last event processed. */
@@ -356,7 +356,7 @@
  * A number returns itself, false returns 0, true returns all flags,
  * other strings return the flags that are set.
  */
-static int ast_strings_to_mask(const char *string)
+static int strings_to_mask(const char *string)
 {
 	const char *p;
 
@@ -671,12 +671,12 @@
 	free_session(s);
 }
 
-char *astman_get_header(struct message *m, char *var)
+const char *astman_get_header(const struct message *m, char *var)
 {
 	int x, l = strlen(var);
 
 	for (x = 0; x < m->hdrcount; x++) {
-		char *h = m->headers[x];
+		const char *h = m->headers[x];
 		if (!strncasecmp(var, h, l) && h[l] == ':' && h[l+1] == ' ')
 			return h + l + 2;
 	}
@@ -684,7 +684,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;
@@ -795,9 +795,9 @@
  * XXX MSG_MOREDATA should go to a header file.
  */
 #define MSG_MOREDATA	((char *)astman_send_response)
-static void astman_send_response_full(struct mansession *s, struct message *m, char *resp, char *msg, char *listflag)
-{
-	char *id = astman_get_header(m,"ActionID");
+static void astman_send_response_full(struct mansession *s, const struct message *m, char *resp, char *msg, char *listflag)
+{
+	const char *id = astman_get_header(m,"ActionID");
 
 	astman_append(s, "Response: %s\r\n", resp);
 	if (!ast_strlen_zero(id))
@@ -812,40 +812,39 @@
 		astman_append(s, "\r\n");
 }
 
-void astman_send_response(struct mansession *s, struct message *m, char *resp, char *msg)
+void astman_send_response(struct mansession *s, const struct message *m, char *resp, char *msg)
 {
 	astman_send_response_full(s, m, resp, msg, NULL);
 }
 
-void astman_send_error(struct mansession *s, struct message *m, char *error)
+void astman_send_error(struct mansession *s, const struct message *m, char *error)
 {
 	astman_send_response_full(s, m, "Error", error, NULL);
 }
 
-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_full(s, m, "Success", msg, NULL);
 }
 
-static void astman_start_ack(struct mansession *s, struct message *m)
+static void astman_start_ack(struct mansession *s, const struct message *m)
 {
 	astman_send_response_full(s, m, "Success", MSG_MOREDATA, NULL);
 }
 
-void astman_send_listack(struct mansession *s, struct message *m, char *msg, char *listflag)
+void astman_send_listack(struct mansession *s, const struct message *m, char *msg, char *listflag)
 {
 	astman_send_response_full(s, m, "Success", msg, listflag);
 }
-
 
 
 /*! \brief
    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)
@@ -862,9 +861,9 @@
  */
 
 /* helper function for action_login() */
-static int authenticate(struct mansession *s, struct message *m)
-{
-	char *user = astman_get_header(m, "Username");
+static int authenticate(struct mansession *s, const struct message *m)
+{
+	const char *user = astman_get_header(m, "Username");
 	int error = -1;
 	struct ast_ha *ha = NULL;
 	char *password = NULL;
@@ -928,7 +927,7 @@
 		}
 	}
 	if (!strcasecmp(astman_get_header(m, "AuthType"), "MD5")) {
-		char *key = astman_get_header(m, "Key");
+		const char *key = astman_get_header(m, "Key");
 		if (!ast_strlen_zero(key) && !ast_strlen_zero(s->challenge)) {
 			int x;
 			int len = 0;
@@ -946,7 +945,7 @@
 				error = 0;
 		}
 	} else if (password) {
-		char *pass = astman_get_header(m, "Secret");
+		const char *pass = astman_get_header(m, "Secret");
 		if (!strcmp(password, pass))
 			error = 0;
 	}
@@ -967,7 +966,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;
@@ -979,10 +978,10 @@
 "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;
@@ -1011,11 +1010,11 @@
 }
 
 /* helper function for action_updateconfig */
-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;
 
@@ -1047,13 +1046,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)) &&
@@ -1079,13 +1078,13 @@
 "   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 *rld = astman_get_header(m, "Reload");
+	const char *rld = astman_get_header(m, "Reload");
 
 	if (ast_strlen_zero(sfn) || ast_strlen_zero(dfn)) {
 		astman_send_error(s, m, "Filename not specified");
@@ -1119,13 +1118,13 @@
 "Variables: \n"
 "   Timeout: Maximum time (in seconds) to wait for events, -1 means forever.\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;
 	int x;
 	int needexit = 0;
-	char *id = astman_get_header(m,"ActionID");
+	const char *id = astman_get_header(m,"ActionID");
 	char idText[256] = "";
 
 	if (!ast_strlen_zero(id))
@@ -1219,7 +1218,7 @@
 "  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;
 	struct ast_str *temp = ast_str_alloca(BUFSIZ); /* XXX very large ? */
@@ -1245,9 +1244,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);
@@ -1263,13 +1262,13 @@
 "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;
 }
 
-static int action_login(struct mansession *s, struct message *m)
+static int action_login(struct mansession *s, const struct message *m)
 {
 	if (authenticate(s, m)) {
 		sleep(1);
@@ -1287,9 +1286,9 @@
 	return 0;
 }
 
-static int action_challenge(struct mansession *s, struct message *m)
-{
-	char *authtype = astman_get_header(m, "AuthType");
+static int action_challenge(struct mansession *s, const struct message *m)
+{
+	const char *authtype = astman_get_header(m, "AuthType");
 
 	if (!strcasecmp(authtype, "MD5")) {
 		if (ast_strlen_zero(s->challenge))
@@ -1309,10 +1308,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;
@@ -1335,12 +1334,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");
@@ -1377,11 +1376,11 @@
 "	*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");
+	const char *name = astman_get_header(m, "Channel");

[... 687 lines stripped ...]


More information about the asterisk-commits mailing list