From mohamed.kallel@pivasoftware.com Tue Sep  4 10:28:38 2012
Received: with ECARTIS (v1.0.0; list freecwmp); Tue, 04 Sep 2012 10:28:42 +0200 (CEST)
Received: from moutng.kundenserver.de ([212.227.17.10]:56253 "EHLO
        moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1903365Ab2IDI2h (ORCPT
        <rfc822;freecwmp@linux-mips.org>); Tue, 4 Sep 2012 10:28:37 +0200
Received: from [192.168.1.133] ([41.224.250.29])
        by mrelayeu.kundenserver.de (node=mreu0) with ESMTP (Nemesis)
        id 0MRyX8-1T2mtI1Pw2-00THEX; Tue, 04 Sep 2012 10:28:31 +0200
Message-ID: <5045BBAB.1040207@pivasoftware.com>
Date:   Tue, 04 Sep 2012 09:28:27 +0100
From:   KALLEL Mohamed <mohamed.kallel@pivasoftware.com>
User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:15.0) Gecko/20120824 Thunderbird/15.0
MIME-Version: 1.0
To:     freecwmp@linux-mips.org, freecwmp@lukaperkov.net
Subject: Re: patch for the freecwmp project
References: <50334294.9020508@pivasoftware.com> <20120828122841.GA8612@w500.iskon.local>
In-Reply-To: <20120828122841.GA8612@w500.iskon.local>
Content-Type: multipart/mixed;
 boundary="------------030008050900010402020506"
X-Provags-ID: V02:K0:nUDLFJ7/IkbLzj0zKYPXsNIJ7IMxJWBtzBfWBl8gtC8
 DRqgXplU8hqcOtt/Rn0RvSQ3raDGF0BU8DcWGZ4U1wAwF/WP4u
 ujTNe5oq0ksw8W6oqEiMrxobAOWxySwK0z+uunBwmyYF30Wp3o
 r9fgYYjLoy0LvMmQ2675/lMGObu9HrQREmu8n/TtVCMRlAhfuu
 4tJB0M79fGK2E3QvIqA6UwFA/3xFIJvNUDRak8naLM6qI0Vezn
 GM5IeU0bADnVFt7hPWrArKiN8W3+scoJq/XXrfG+ttAkjJaRca
 Ei9fQHtbQmSodfj2PC3GxN2K/Zoq1ACTGikh81xFumcr3r70H4
 40t/C19+1eWmDczEUxOtsk5LpQDYZwmVfrYu0mABh
Return-Path: <mohamed.kallel@pivasoftware.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s freecwmp"> (uid 0)
X-Orcpt: rfc822;freecwmp@linux-mips.org
Original-Recipient: rfc822;freecwmp@linux-mips.org
X-archive-position: 58
X-ecartis-version: Ecartis v1.0.0
Sender: freecwmp-bounce@linux-mips.org
Errors-to: freecwmp-bounce@linux-mips.org
X-original-sender: mohamed.kallel@pivasoftware.com
Precedence: bulk
X-list: freecwmp

This is a multi-part message in MIME format.
--------------030008050900010402020506
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

Hi Luka

Following your response concerning my patch, please find attached the 
patch updated with Jonas remarks and your remarks.

Note: the fact of removing the bootstrap event from the list and from 
the config (after the send success of the inform) is not added in this 
patch. Also the add of boot event and the bootstrap event in the 
start-up of the equipment is not added in this patch.
Both behaviours should be added in the future patches

Regards
Mohamed

Le 28/08/2012 13:28, Luka Perkov a écrit :
> Hi Mohamed,
>
> On Tue, Aug 21, 2012 at 09:11:00AM +0100, KALLEL Mohamed wrote:
>> I'm Mohamed KALLEL and I'm interested in your freecwmp project.
> Welcome aboard!
>
>> And I want to contribute in the development with the following patch
>> (patch attached with this email).
> Thank you. I'll try to merge it this week, for now I'll give some quick
> comments bellow.
>
>> The patch allow to support many events in the inform message. the
>> old behavior support only one event in the inform message
>> this patch allow to add the boot event (with the bootstarp event) in
>> the inform message.
>> the patch is based on the revision: *6d074ab*
>>
>> Mohamed KALLEL
>>
>>
>> diff --git a/bin/Makefile.am b/bin/Makefile.am
>> index aa4db87..d7abfe2 100644
>> --- a/bin/Makefile.am
>> +++ b/bin/Makefile.am
>> @@ -7,6 +7,8 @@ freecwmpd_SOURCES =		\
>>   	../src/config.c		\
>>   	../src/cwmp/cwmp.h	\
>>   	../src/cwmp/cwmp.c	\
>> +	../src/cwmp/event.h	\
>> +	../src/cwmp/event.c	\
>>   	../src/cwmp/external.h	\
>>   	../src/cwmp/external.c	\
>>   	../src/http/b64.h	\
>> diff --git a/ext/openwrt/config/freecwmp b/ext/openwrt/config/freecwmp
>> index 05dd3be..e6f126d 100644
>> --- a/ext/openwrt/config/freecwmp
>> +++ b/ext/openwrt/config/freecwmp
>> @@ -2,7 +2,8 @@ config local
>>   	option interface eth0
>>   	option port 7547
>>   	option ubus_socket /var/run/ubus.sock
>> -	option event bootstrap
>> +	list event bootstrap
>> +	list event boot
> I think we could leave this out and by default if there is no event list
> we use this two options (bootstrap and boot).
>
>>   config acs
>>   	option scheme http
>> diff --git a/src/config.c b/src/config.c
>> index ad7a86e..abc621c 100644
>> --- a/src/config.c
>> +++ b/src/config.c
>> @@ -12,6 +12,7 @@
>>   
>>   #include "config.h"
>>   #include "cwmp/cwmp.h"
>> +#include "cwmp/event.h"
>>   
>>   static bool first_run = true;
>>   static struct uci_context *uci_ctx;
>> @@ -27,13 +28,14 @@ config_free_local(void) {
>>   	FREE(config->local->port);
>>   	FREE(config->local->ubus_socket);
>>   	FREE(config->local);
>> +	event_remove_all_events();
>>   }
>>   
>>   static int
>>   config_init_local(void)
>>   {
>>   	struct uci_section *s;
>> -	struct uci_element *e;
>> +	struct uci_element *e,*ie;
>>   
>>   	uci_foreach_element(&uci_freecwmp->sections, e) {
>>   		s = uci_to_section(e);
>> @@ -69,14 +71,20 @@ section_found:
>>   			goto next;
>>   		}
>>   
>> -		if (!strcmp((uci_to_option(e))->e.name, "event")) {
>> -			if (!strcasecmp("bootstrap", uci_to_option(e)->v.string))
>> -				config->local->event = BOOTSTRAP;
>> +		if (!strcmp((uci_to_option(e))->e.name, "event") && (uci_to_option(e))->type == UCI_TYPE_LIST) {
>> +			uci_foreach_element(&((uci_to_option(e))->v.list), ie)
>> +			{
>> +				if((ie != NULL)&&(ie->name!=NULL))
>> +				{
>> +					if (!strcasecmp("bootstrap", ie->name))
>> +						event_add_event(BOOTSTRAP,NULL);
>>   
>> -			if (!strcasecmp("boot", uci_to_option(e)->v.string))
>> -				config->local->event = BOOT;
>> +					if (!strcasecmp("boot", ie->name))
>> +						event_add_event(BOOT,NULL);
>>   
>> -			DD("freecwmp.@local[0].event=%s\n", uci_to_option(e)->v.string);
>> +					DD("freecwmp.@local[0].event=%s\n", ie->name);
> I'm not sure if this output will be the same as the one from uci. I'll
> double check.
>
>> +				}
>> +			}
>>   		}
>>   
>>   next:
>> diff --git a/src/config.h b/src/config.h
>> index 0bfc096..718d9bc 100644
>> --- a/src/config.h
>> +++ b/src/config.h
>> @@ -45,7 +45,6 @@ struct local {
>>   	char *interface;
>>   	char *port;
>>   	char *ubus_socket;
>> -	int event;
>>   };
>>   
>>   struct core_config {
>> diff --git a/src/cwmp/cwmp.c b/src/cwmp/cwmp.c
>> index 7ba851a..d6a0e49 100644
>> --- a/src/cwmp/cwmp.c
>> +++ b/src/cwmp/cwmp.c
>> @@ -12,6 +12,7 @@
>>   #include <libubox/uloop.h>
>>   
>>   #include "cwmp.h"
>> +#include "event.h"
>>   #include "external.h"
>>   #include "../freecwmp.h"
>>   #include "../config.h"
>> @@ -20,7 +21,7 @@
>>   
>>   static struct cwmp
>>   {
>> -	enum cwmp_event_code event_code;
>> +	struct list_head *event_list;
>>   	struct uloop_timeout connection_request_t;
>>   	struct uloop_timeout periodic_inform_t;
>>   	int8_t periodic_inform_enabled;
>> @@ -45,7 +46,7 @@ cwmp_init(void)
>>   	cwmp.acs_connection_required = 0;
>>   	cwmp.periodic_inform_enabled = 0;
>>   	cwmp.periodic_inform_interval = 0;
>> -	cwmp.event_code = config->local->event;
>> +	cwmp.event_list = &event_list;
>>   
>>   	status = cwmp_get_parameter_handler("InternetGatewayDevice.ManagementServer.PeriodicInformInterval", &c);
>>   	if (status == FC_SUCCESS && c) {
>> @@ -181,7 +182,7 @@ cwmp_periodic_inform(struct uloop_timeout *timeout)
>>   	if (cwmp.periodic_inform_enabled && cwmp.periodic_inform_interval) {
>>   		cwmp.periodic_inform_t.cb = cwmp_periodic_inform;
>>   		uloop_timeout_set(&cwmp.periodic_inform_t, cwmp.periodic_inform_interval * 1000);
>> -		cwmp.event_code = PERIODIC;
>> +		event_add_event(PERIODIC,NULL);
>>   	}
>>   
>>   	if (cwmp.periodic_inform_enabled)
>> @@ -405,7 +406,7 @@ cwmp_connection_request(void)
>>   
>>   	int8_t status;
>>   
>> -	cwmp.event_code = CONNECTION_REQUEST;
>> +	event_add_event(CONNECTION_REQUEST,NULL);
>>   	status = cwmp_inform();
>>   
>>   	FC_DEVEL_DEBUG("exit");
>> @@ -441,7 +442,7 @@ cwmp_add_notification(char *parameter, char *value)
>>   		n->value = strdup(value);
>>   	}
>>   
>> -	cwmp.event_code = VALUE_CHANGE;
>> +	event_add_event(VALUE_CHANGE,NULL);
>>   	if (!strncmp(c, "2", 1)) {
>>   		cwmp_inform();
>>   	}
>> @@ -488,7 +489,7 @@ cwmp_set_parameter_write_handler(char *name, char *value)
>>   	}
>>   
>>   	if((strcmp(name, "InternetGatewayDevice.ManagementServer.URL")) == 0) {
>> -		cwmp.event_code = VALUE_CHANGE;
>> +		event_add_event(VALUE_CHANGE,NULL);
>>   		cwmp.config_reload = true;
>>   		cwmp.acs_connection_required = 1;
>>   	}
>> @@ -657,12 +658,23 @@ done:
>>   }
>>   
>>   char *
>> -cwmp_get_event_code(void)
>> +cwmp_get_event_code(enum cwmp_get_order order)
>>   {
>>   	FC_DEVEL_DEBUG("enter");
>>   
>> -	char *cwmp_inform_event_code;
>> -	switch (cwmp.event_code) {
>> +	static struct list_head *ilist = NULL;
>> +	struct event *event;
>> +	char *cwmp_inform_event_code = NULL;
>> +
>> +	if (order == FIRST || ilist == NULL)
>> +	{
> Coding style tip:
>
> 	if (order == FIRST || ilist == NULL) {
>
> That goes for all your if's and for's...
>
>> +		ilist = cwmp.event_list;
>> +	}
>> +	ilist = ilist->next;
>> +	if (ilist != cwmp.event_list)
>> +	{
>> +		event = list_entry (ilist,struct event,list);
>> +		switch (event->code) {
>>   		case BOOT:
>>   			cwmp_inform_event_code = "1 BOOT";
>>   			break;
>> @@ -682,6 +694,7 @@ cwmp_get_event_code(void)
>>   		default:
>>   			cwmp_inform_event_code = "0 BOOTSTRAP";
>>   			break;
>> +		}
>>   	}
>>   
>>   	FC_DEVEL_DEBUG("exit");
>> diff --git a/src/cwmp/cwmp.h b/src/cwmp/cwmp.h
>> index 947539c..a1b3d8b 100644
>> --- a/src/cwmp/cwmp.h
>> +++ b/src/cwmp/cwmp.h
>> @@ -27,6 +27,12 @@ enum cwmp_event_code
>>   	AUTONOMOUS_TRANSFER_COMPLETE
>>   };
>>   
>> +enum cwmp_get_order
>> +{
>> +	FIRST = 0,
>> +	NEXT
>> +};
>> +
>>   struct notification {
>>   	struct list_head list;
>>   
>> @@ -55,7 +61,7 @@ int8_t cwmp_download_handler(char *url, char *size);
>>   int8_t cwmp_reboot_handler(void);
>>   int8_t cwmp_factory_reset_handler(void);
>>   int8_t cwmp_reload_changes(void);
>> -char * cwmp_get_event_code(void);
>> +char * cwmp_get_event_code(enum cwmp_get_order);
>>   int cwmp_get_retry_count(void);
>>   
>>   #endif
>> diff --git a/src/cwmp/event.c b/src/cwmp/event.c
>> index e69de29..561d413 100644
>> --- a/src/cwmp/event.c
>> +++ b/src/cwmp/event.c
> GPLv2 license header is missing...
>
> Also I'll see if this can go in some existing file.
>
>> @@ -0,0 +1,33 @@
>> +#include "event.h"
>> +#include "cwmp.h"
>> +#include "../freecwmp.h"
>> +LIST_HEAD(event_list);
>> +
>> +void
>> +event_add_event(uint8_t code, char *commandKey)
> Please name your variables like this command_key instead commandKey.
>
>> +{
>> +	struct event *event;
>> +
>> +	event = calloc(1,sizeof(struct event));
>> +	event->code = code;
>> +	event->commandKey = commandKey;
>> +	list_add (&(event->list), &(event_list));
>> +
>> +	FC_DEVEL_DEBUG("exit");
>> +}
>> +
>> +void
>> +event_remove_all_events()
>> +{
>> +	struct event *event;
>> +
>> +	FC_DEVEL_DEBUG("enter");
> I'm doing some cleanup so I'll get rid of FC_DEVEL_DEBUG in the near
> future. It's ok for now, I just wanted to give you heads up.
>
>> +
>> +	while (event_list.next != &event_list)
>> +	{
>> +		event = list_entry (event_list.next,struct event, list);
>> +		list_del(&event->list);
>> +		free(event);
>> +	}
>> +	FC_DEVEL_DEBUG("exit");
>> +}
>> diff --git a/src/cwmp/event.h b/src/cwmp/event.h
>> index e69de29..07afa8e 100644
>> --- a/src/cwmp/event.h
>> +++ b/src/cwmp/event.h
>> @@ -0,0 +1,18 @@
> GPLv2 license header is missing...
>
>> +#ifndef _FREECWMP_EVENT_H__
>> +#define _FREECWMP_EVENT_H__
>> +
>> +#include <stdint.h>
>> +#include <libubox/uloop.h>
>> +
>> +struct event
>> +{
>> +	struct list_head list;
>> +	char *commandKey;
>> +	uint8_t code;
>> +};
>> +
>> +void event_add_event(uint8_t code, char *commandKey);
>> +void event_remove_all_events();
>> +
>> +extern struct list_head event_list;
>> +#endif
>> diff --git a/src/cwmp/messages.h b/src/cwmp/messages.h
>> index 046fc82..eea86d1 100644
>> --- a/src/cwmp/messages.h
>> +++ b/src/cwmp/messages.h
>> @@ -29,11 +29,7 @@
>>   			"<ProductClass/>"									\
>>   			"<SerialNumber/>"									\
>>   		"</DeviceId>"											\
>> -		"<Event soap_enc:arrayType=\"cwmp:EventStruct[1]\">"						\
>> -			"<EventStruct>"										\
>> -				"<EventCode/>"									\
>> -				"<CommandKey/>"									\
>> -			"</EventStruct>"									\
>> +		"<Event soap_enc:arrayType=\"cwmp:EventStruct[0]\">"						\
>>   		"</Event>"											\
>>   		"<MaxEnvelopes>1</MaxEnvelopes>"								\
>>   		"<CurrentTime/>"										\
>> @@ -88,6 +84,11 @@
>>   "</soap_env:Body>"												\
>>   "</soap_env:Envelope>"
>>   
>> +#define CWMP_INFORM_EVENT_STRUCT \
>> +"<EventStruct>"			\
>> +	"<EventCode/>"		\
>> +	"<CommandKey/>"		\
>> +"</EventStruct>"
>>   
>>   #define CWMP_RESPONSE_MESSAGE \
>>   "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>"		\
>> diff --git a/src/xml/xml.c b/src/xml/xml.c
>> index 05424a5..c05cfc0 100644
>> --- a/src/xml/xml.c
>> +++ b/src/xml/xml.c
>> @@ -124,6 +124,40 @@ xml_exit(void)
>>   }
>>   
>>   int8_t
>> +xml_prepare_events_inform (mxml_node_t *tree)
>> +{
>> +	mxml_node_t *node, *event_node, *code_node;
>> +	char *c, buf[32];
>> +	uint8_t n = 0;
>> +
>> +
>> +	node = mxmlFindElement(tree, tree, "Event", NULL, NULL, MXML_DESCEND);
>> +
>> +	for (c = cwmp_get_event_code(FIRST); c!= NULL; c =  cwmp_get_event_code(NEXT))
>> +	{
>> +		event_node	= mxmlLoadString(NULL, CWMP_INFORM_EVENT_STRUCT, MXML_NO_CALLBACK);
>> +		if (!event_node)
>> +			return 0;
>> +		code_node	= mxmlFindElement(event_node, event_node, "EventCode", NULL, NULL, MXML_DESCEND);
>> +		if (!code_node)
>> +			return 0;
>> +		code_node	= mxmlNewText(code_node, 0, c);
>> +		if (!code_node)
>> +			return 0;
>> +		mxmlAdd (node,MXML_ADD_AFTER,MXML_ADD_TO_PARENT,event_node);
>> +		n++;
>> +	}
>> +
>> +	if (n)
>> +	{
>> +		sprintf (buf,"cwmp:EventStruct[%u]",n);
>> +		mxmlElementSetAttr(node, "soap_enc:arrayType", buf );	/* I - Attribute value */
>> +	}
>> +
>> +	return 1;
>> +}
>> +
>> +int8_t
>>   xml_prepare_inform_message(char **msg_out)
>>   {
>>   	FC_DEVEL_DEBUG("enter");
>> @@ -178,11 +212,7 @@ xml_prepare_inform_message(char **msg_out)
>>   	if (!busy_node)
>>   		goto error;
>>   
>> -	busy_node = mxmlFindElement(tree, tree, "EventCode", NULL, NULL, MXML_DESCEND);
>> -	if (!busy_node)
>> -		goto error;
>> -	busy_node = mxmlNewText(busy_node, 0, cwmp_get_event_code());
>> -	if (!busy_node)
>> +	if (!xml_prepare_events_inform (tree))
>>   		goto error;
>>   
>>   	busy_node = mxmlFindElement(tree, tree, "CurrentTime", NULL, NULL, MXML_DESCEND);
> That would be it for now. I'll try and merge your patch this week.
>
> I would also like to invite you to #freecwmp IRC channel on freenode.
>
> Regards,
> Luka
>


--------------030008050900010402020506
Content-Type: text/plain; charset=windows-1256;
 name="freecwmp20120904.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="freecwmp20120904.patch"

commit 53630745adf1171144137c244d085842be4871b5
Author: Mohamed <mohamed.kallel@pivasoftware.com>
Date:   Tue Sep 4 08:48:44 2012 +0100

    allow to support many events in the inform message. the old behavior
    support only one event in the inform message this patch allow to add the
    boot event (with the bootstarp event) in the inform message.

diff --git a/bin/Makefile.am b/bin/Makefile.am
index aa4db87..d7abfe2 100644
--- a/bin/Makefile.am
+++ b/bin/Makefile.am
@@ -7,6 +7,8 @@ freecwmpd_SOURCES =		\
 	../src/config.c		\
 	../src/cwmp/cwmp.h	\
 	../src/cwmp/cwmp.c	\
+	../src/cwmp/event.h	\
+	../src/cwmp/event.c	\
 	../src/cwmp/external.h	\
 	../src/cwmp/external.c	\
 	../src/http/b64.h	\
diff --git a/ext/openwrt/config/freecwmp b/ext/openwrt/config/freecwmp
index 05dd3be..e6f126d 100644
--- a/ext/openwrt/config/freecwmp
+++ b/ext/openwrt/config/freecwmp
@@ -2,7 +2,8 @@ config local
 	option interface eth0
 	option port 7547
 	option ubus_socket /var/run/ubus.sock
-	option event bootstrap
+	list event bootstrap
+	list event boot
 
 config acs
 	option scheme http
diff --git a/src/config.c b/src/config.c
index ad7a86e..9cb3f5b 100644
--- a/src/config.c
+++ b/src/config.c
@@ -12,6 +12,7 @@
 
 #include "config.h"
 #include "cwmp/cwmp.h"
+#include "cwmp/event.h"
 
 static bool first_run = true;
 static struct uci_context *uci_ctx;
@@ -27,13 +28,14 @@ config_free_local(void) {
 	FREE(config->local->port);
 	FREE(config->local->ubus_socket);
 	FREE(config->local);
+	event_remove_all_events();
 }
 
 static int
 config_init_local(void)
 {
 	struct uci_section *s;
-	struct uci_element *e;
+	struct uci_element *e, *ie;
 
 	uci_foreach_element(&uci_freecwmp->sections, e) {
 		s = uci_to_section(e);
@@ -69,14 +71,18 @@ section_found:
 			goto next;
 		}
 
-		if (!strcmp((uci_to_option(e))->e.name, "event")) {
-			if (!strcasecmp("bootstrap", uci_to_option(e)->v.string))
-				config->local->event = BOOTSTRAP;
+		if (!strcmp((uci_to_option(e))->e.name, "event") && (uci_to_option(e))->type == UCI_TYPE_LIST) {
+			uci_foreach_element(&((uci_to_option(e))->v.list), ie) {
+				if ((ie != NULL) && (ie->name != NULL)) {
+					if (!strcasecmp("bootstrap", ie->name))
+						event_add_event(BOOTSTRAP, NULL);
 
-			if (!strcasecmp("boot", uci_to_option(e)->v.string))
-				config->local->event = BOOT;
+					if (!strcasecmp("boot", ie->name))
+						event_add_event(BOOT, NULL);
 
-			DD("freecwmp.@local[0].event=%s\n", uci_to_option(e)->v.string);
+					DD("freecwmp.@local[0].event=%s\n", ie->name);
+				}
+			}
 		}
 
 next:
diff --git a/src/config.h b/src/config.h
index 0bfc096..718d9bc 100644
--- a/src/config.h
+++ b/src/config.h
@@ -45,7 +45,6 @@ struct local {
 	char *interface;
 	char *port;
 	char *ubus_socket;
-	int event;
 };
 
 struct core_config {
diff --git a/src/cwmp/cwmp.c b/src/cwmp/cwmp.c
index 7ba851a..d4975d7 100644
--- a/src/cwmp/cwmp.c
+++ b/src/cwmp/cwmp.c
@@ -12,6 +12,7 @@
 #include <libubox/uloop.h>
 
 #include "cwmp.h"
+#include "event.h"
 #include "external.h"
 #include "../freecwmp.h"
 #include "../config.h"
@@ -20,7 +21,7 @@
 
 static struct cwmp
 {
-	enum cwmp_event_code event_code;
+	struct list_head *event_list;
 	struct uloop_timeout connection_request_t;
 	struct uloop_timeout periodic_inform_t;
 	int8_t periodic_inform_enabled;
@@ -45,7 +46,7 @@ cwmp_init(void)
 	cwmp.acs_connection_required = 0;
 	cwmp.periodic_inform_enabled = 0;
 	cwmp.periodic_inform_interval = 0;
-	cwmp.event_code = config->local->event;
+	cwmp.event_list = &event_list;
 
 	status = cwmp_get_parameter_handler("InternetGatewayDevice.ManagementServer.PeriodicInformInterval", &c);
 	if (status == FC_SUCCESS && c) {
@@ -181,7 +182,7 @@ cwmp_periodic_inform(struct uloop_timeout *timeout)
 	if (cwmp.periodic_inform_enabled && cwmp.periodic_inform_interval) {
 		cwmp.periodic_inform_t.cb = cwmp_periodic_inform;
 		uloop_timeout_set(&cwmp.periodic_inform_t, cwmp.periodic_inform_interval * 1000);
-		cwmp.event_code = PERIODIC;
+		event_add_event(PERIODIC, NULL);
 	}
 
 	if (cwmp.periodic_inform_enabled)
@@ -405,7 +406,7 @@ cwmp_connection_request(void)
 
 	int8_t status;
 
-	cwmp.event_code = CONNECTION_REQUEST;
+	event_add_event(CONNECTION_REQUEST, NULL);
 	status = cwmp_inform();
 
 	FC_DEVEL_DEBUG("exit");
@@ -441,7 +442,7 @@ cwmp_add_notification(char *parameter, char *value)
 		n->value = strdup(value);
 	}
 
-	cwmp.event_code = VALUE_CHANGE;
+	event_add_event(VALUE_CHANGE, NULL);
 	if (!strncmp(c, "2", 1)) {
 		cwmp_inform();
 	}
@@ -488,7 +489,7 @@ cwmp_set_parameter_write_handler(char *name, char *value)
 	}
 
 	if((strcmp(name, "InternetGatewayDevice.ManagementServer.URL")) == 0) {
-		cwmp.event_code = VALUE_CHANGE;
+		event_add_event(VALUE_CHANGE, NULL);
 		cwmp.config_reload = true;
 		cwmp.acs_connection_required = 1; 
 	}
@@ -656,13 +657,19 @@ done:
 	return status;
 }
 
+struct list_head *
+cwmp_get_event_list_head()
+{
+	return cwmp.event_list;
+}
+
 char *
-cwmp_get_event_code(void)
+cwmp_get_event_code(enum cwmp_event_code event_code)
 {
 	FC_DEVEL_DEBUG("enter");
 
 	char *cwmp_inform_event_code;
-	switch (cwmp.event_code) {
+	switch (event_code) {
 		case BOOT:
 			cwmp_inform_event_code = "1 BOOT";
 			break;
diff --git a/src/cwmp/cwmp.h b/src/cwmp/cwmp.h
index 947539c..ca52a49 100644
--- a/src/cwmp/cwmp.h
+++ b/src/cwmp/cwmp.h
@@ -55,7 +55,8 @@ int8_t cwmp_download_handler(char *url, char *size);
 int8_t cwmp_reboot_handler(void);
 int8_t cwmp_factory_reset_handler(void);
 int8_t cwmp_reload_changes(void);
-char * cwmp_get_event_code(void);
+char * cwmp_get_event_code(enum cwmp_event_code);
+struct list_head * cwmp_get_event_list_head();
 int cwmp_get_retry_count(void);
 
 #endif
diff --git a/src/cwmp/event.c b/src/cwmp/event.c
new file mode 100644
index 0000000..e741645
--- /dev/null
+++ b/src/cwmp/event.c
@@ -0,0 +1,82 @@
+/*
+ *	This program is free software: you can redistribute it and/or modify
+ *	it under the terms of the GNU General Public License as published by
+ *	the Free Software Foundation, either version 2 of the License, or
+ *	(at your option) any later version.
+ *
+ *	Copyright (C) 2011-2012 Luka Perkov <freecwmp@lukaperkov.net>
+ */
+
+#include <pthread.h>
+
+#include "event.h"
+#include "cwmp.h"
+#include "../freecwmp.h"
+LIST_HEAD(event_list);
+static pthread_mutex_t mutex_event_list;
+
+void
+event_init()
+{
+	FC_DEVEL_DEBUG("enter");
+
+	pthread_mutex_init(&mutex_event_list, NULL);
+
+	FC_DEVEL_DEBUG("exit");
+}
+
+void
+event_add_event(uint8_t code, char *commandKey)
+{
+	FC_DEVEL_DEBUG("enter");
+
+	struct event *event;
+
+	pthread_mutex_lock(&mutex_event_list);
+	event = calloc(1, sizeof(struct event));
+	event->code = code;
+	if (commandKey!=NULL)
+		event->commandKey = strdup(commandKey);
+	list_add(&(event->list), &(event_list));
+	pthread_mutex_unlock(&mutex_event_list);
+
+	FC_DEVEL_DEBUG("exit");
+}
+
+void
+event_remove_all_events()
+{
+	struct event *event;
+
+	FC_DEVEL_DEBUG("enter");
+
+	pthread_mutex_lock(&mutex_event_list);
+	while (event_list.next != &event_list) {
+		event = list_entry(event_list.next, struct event, list);
+		list_del(&event->list);
+		if (event->commandKey!=NULL)
+			free(event->commandKey);
+		free(event);
+	}
+	pthread_mutex_unlock(&mutex_event_list);
+	FC_DEVEL_DEBUG("exit");
+}
+
+void
+event_list_head_mutex_lock()
+{
+	FC_DEVEL_DEBUG("enter");
+
+	pthread_mutex_lock(&mutex_event_list);
+
+	FC_DEVEL_DEBUG("exit");
+}
+void
+event_list_head_mutex_unlock()
+{
+	FC_DEVEL_DEBUG("enter");
+
+	pthread_mutex_unlock(&mutex_event_list);
+
+	FC_DEVEL_DEBUG("exit");
+}
diff --git a/src/cwmp/event.h b/src/cwmp/event.h
new file mode 100644
index 0000000..b404b3b
--- /dev/null
+++ b/src/cwmp/event.h
@@ -0,0 +1,30 @@
+/*
+ *	This program is free software: you can redistribute it and/or modify
+ *	it under the terms of the GNU General Public License as published by
+ *	the Free Software Foundation, either version 2 of the License, or
+ *	(at your option) any later version.
+ *
+ *	Copyright (C) 2011-2012 Luka Perkov <freecwmp@lukaperkov.net>
+ */
+
+#ifndef _FREECWMP_EVENT_H__
+#define _FREECWMP_EVENT_H__
+
+#include <stdint.h>
+#include <libubox/uloop.h>
+
+struct event
+{
+	struct list_head list;
+	char *commandKey;
+	uint8_t code;
+};
+
+void event_add_event(uint8_t code, char *commandKey);
+void event_remove_all_events();
+void event_init();
+void event_list_head_mutex_lock();
+void event_list_head_mutex_unlock();
+
+extern struct list_head event_list;
+#endif
diff --git a/src/cwmp/messages.h b/src/cwmp/messages.h
index 046fc82..24e6695 100644
--- a/src/cwmp/messages.h
+++ b/src/cwmp/messages.h
@@ -29,11 +29,7 @@
 			"<ProductClass/>"									\
 			"<SerialNumber/>"									\
 		"</DeviceId>"											\
-		"<Event soap_enc:arrayType=\"cwmp:EventStruct[1]\">"						\
-			"<EventStruct>"										\
-				"<EventCode/>"									\
-				"<CommandKey/>"									\
-			"</EventStruct>"									\
+		"<Event soap_enc:arrayType=\"cwmp:EventStruct[0]\">"						\
 		"</Event>"											\
 		"<MaxEnvelopes>1</MaxEnvelopes>"								\
 		"<CurrentTime/>"										\
diff --git a/src/freecwmp.c b/src/freecwmp.c
index f15cd75..db800c8 100644
--- a/src/freecwmp.c
+++ b/src/freecwmp.c
@@ -25,6 +25,7 @@
 #include "freecwmp.h"
 #include "config.h"
 #include "cwmp/cwmp.h"
+#include "cwmp/event.h"
 #include "ubus/ubus.h"
 
 static void freecwmp_kickoff(struct uloop_timeout *);
@@ -222,6 +223,8 @@ int main (int argc, char **argv)
 		}
 	}
 
+	event_init();
+
 	uloop_init();
 
 	if (config_load()) {
diff --git a/src/xml/xml.c b/src/xml/xml.c
index 05424a5..64932f4 100644
--- a/src/xml/xml.c
+++ b/src/xml/xml.c
@@ -12,6 +12,7 @@
 #include "../freecwmp.h"
 #include "../config.h"
 #include "../cwmp/cwmp.h"
+#include "../cwmp/event.h"
 #include "../cwmp/messages.h"
 #include "../mix/time.h"
 
@@ -124,6 +125,54 @@ xml_exit(void)
 }
 
 int8_t
+xml_prepare_events_inform (mxml_node_t *tree)
+{
+	mxml_node_t *node, *event_node, *cn;
+	char *c, buf[22];
+	uint8_t n = 0;
+	struct list_head *p, *elist = cwmp_get_event_list_head();
+	struct event *event;
+
+	node = mxmlFindElement(tree, tree, "Event", NULL, NULL, MXML_DESCEND);
+
+	event_list_head_mutex_lock();
+	list_for_each(p, elist) {
+		event = list_entry (p, struct event, list);
+		event_node = mxmlNewElement (node, "EventStruct");
+		if (!event_node)
+			goto error;
+		cn = mxmlNewElement (event_node, "EventCode");
+		if (!cn)
+			goto error;
+		cn = mxmlNewText(cn, 0, cwmp_get_event_code(event->code));
+		if (!cn)
+			goto error;
+		cn = mxmlNewElement (event_node, "CommandKey");
+		if (!cn)
+			goto error;
+		if (event->commandKey != NULL) {
+			cn = mxmlNewText(cn, 0, event->commandKey);
+			if (!cn)
+				goto error;
+		}
+		mxmlAdd(node, MXML_ADD_AFTER, MXML_ADD_TO_PARENT, event_node);
+		n++;
+	}
+
+	if (n) {
+		sprintf(buf,"cwmp:EventStruct[%u]", n);
+		mxmlElementSetAttr(node, "soap_enc:arrayType", buf);	/* I - Attribute value */
+	}
+
+	event_list_head_mutex_unlock();
+	return FC_SUCCESS;
+
+error:
+	event_list_head_mutex_unlock();
+	return FC_ERROR;
+}
+
+int8_t
 xml_prepare_inform_message(char **msg_out)
 {
 	FC_DEVEL_DEBUG("enter");
@@ -178,11 +227,7 @@ xml_prepare_inform_message(char **msg_out)
 	if (!busy_node)
 		goto error;
 
-	busy_node = mxmlFindElement(tree, tree, "EventCode", NULL, NULL, MXML_DESCEND);
-	if (!busy_node)
-		goto error;
-	busy_node = mxmlNewText(busy_node, 0, cwmp_get_event_code());
-	if (!busy_node)
+	if (xml_prepare_events_inform(tree) != FC_SUCCESS)
 		goto error;
 
 	busy_node = mxmlFindElement(tree, tree, "CurrentTime", NULL, NULL, MXML_DESCEND);

--------------030008050900010402020506--

From mohamed.kallel@pivasoftware.com Tue Sep 11 09:26:02 2012
Received: with ECARTIS (v1.0.0; list freecwmp); Tue, 11 Sep 2012 09:26:12 +0200 (CEST)
Received: from moutng.kundenserver.de ([212.227.126.187]:64521 "EHLO
        moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1903301Ab2IKH0C (ORCPT
        <rfc822;freecwmp@linux-mips.org>); Tue, 11 Sep 2012 09:26:02 +0200
Received: from [192.168.1.133] ([41.224.250.29])
        by mrelayeu.kundenserver.de (node=mreu4) with ESMTP (Nemesis)
        id 0MCT7F-1TKNGJ2Tqb-0098Zy; Tue, 11 Sep 2012 09:25:53 +0200
Message-ID: <504EE779.4040802@pivasoftware.com>
Date:   Tue, 11 Sep 2012 08:25:45 +0100
From:   KALLEL Mohamed <mohamed.kallel@pivasoftware.com>
User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:15.0) Gecko/20120824 Thunderbird/15.0
MIME-Version: 1.0
To:     luka.perkov@lukaperkov.net, freecwmp@linux-mips.org
Subject: Fwd: Re: patch for the freecwmp project
References: <5045BBAB.1040207@pivasoftware.com>
In-Reply-To: <5045BBAB.1040207@pivasoftware.com>
X-Forwarded-Message-Id: <5045BBAB.1040207@pivasoftware.com>
Content-Type: multipart/mixed;
 boundary="------------080801030809090505000308"
X-Provags-ID: V02:K0:72TzW+5Pp6dJsUGksOj9phq7AzDlCoKiwu9Vp0UjUzY
 hwfwl3XcyPqifRFR/efMwrtB5KvflJQ6JveZGUINrL6PHV5jA9
 S/Ye41EycZiQ79lPFPy+um6IOd9lL33nmaOKmnOgbP0xqHUiot
 lA3mJbZAnLXIwEEkMbAVQfY1xB/mXNqdUeMY04mj7TXapzw0Rv
 xK4UPgaAlEyBpndgztN/1IbrhTpeQOrJkLxtYcqXzAoxBe3bol
 49ZKEzPP2aKMoQZ5UQ74VdesAiwTr8xW2K+ppQLfI7TbzKcRcm
 8rhxUG0+M06ZbEyG9rby7xpCx4CA/DU/EJje6Anthx3e1a6A4R
 +di5hJjPawYXtiL+uLmLSmhr2LvsoQcbVJUUgNUwI
Return-Path: <mohamed.kallel@pivasoftware.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s freecwmp"> (uid 0)
X-Orcpt: rfc822;freecwmp@linux-mips.org
Original-Recipient: rfc822;freecwmp@linux-mips.org
X-archive-position: 59
X-ecartis-version: Ecartis v1.0.0
Sender: freecwmp-bounce@linux-mips.org
Errors-to: freecwmp-bounce@linux-mips.org
X-original-sender: mohamed.kallel@pivasoftware.com
Precedence: bulk
X-list: freecwmp

This is a multi-part message in MIME format.
--------------080801030809090505000308
Content-Type: multipart/alternative;
 boundary="------------030301030101060401040904"


--------------030301030101060401040904
Content-Type: text/plain; charset=windows-1256; format=flowed
Content-Transfer-Encoding: 8bit

Hi Luka

I'm waiting you feedback concerning the last patch I send. I can not go 
ahead in the next patch (complete the support of many events) without 
getting your git repesotory updated with my last patch I send
Could you please send to me you your feed back (what ever positive or 
negative)

Regards


-------- Message original --------
Sujet: 	Re: patch for the freecwmp project
Date : 	Tue, 04 Sep 2012 09:28:27 +0100
De : 	KALLEL Mohamed <mohamed.kallel@pivasoftware.com>
Pour : 	freecwmp@linux-mips.org, freecwmp@lukaperkov.net



Hi Luka

Following your response concerning my patch, please find attached the
patch updated with Jonas remarks and your remarks.

Note: the fact of removing the bootstrap event from the list and from
the config (after the send success of the inform) is not added in this
patch. Also the add of boot event and the bootstrap event in the
start-up of the equipment is not added in this patch.
Both behaviours should be added in the future patches

Regards
Mohamed

Le 28/08/2012 13:28, Luka Perkov a écrit :
> Hi Mohamed,
>
> On Tue, Aug 21, 2012 at 09:11:00AM +0100, KALLEL Mohamed wrote:
>> I'm Mohamed KALLEL and I'm interested in your freecwmp project.
> Welcome aboard!
>
>> And I want to contribute in the development with the following patch
>> (patch attached with this email).
> Thank you. I'll try to merge it this week, for now I'll give some quick
> comments bellow.
>
>> The patch allow to support many events in the inform message. the
>> old behavior support only one event in the inform message
>> this patch allow to add the boot event (with the bootstarp event) in
>> the inform message.
>> the patch is based on the revision: *6d074ab*
>>
>> Mohamed KALLEL
>>
>>
>> diff --git a/bin/Makefile.am b/bin/Makefile.am
>> index aa4db87..d7abfe2 100644
>> --- a/bin/Makefile.am
>> +++ b/bin/Makefile.am
>> @@ -7,6 +7,8 @@ freecwmpd_SOURCES =		\
>>   	../src/config.c		\
>>   	../src/cwmp/cwmp.h	\
>>   	../src/cwmp/cwmp.c	\
>> +	../src/cwmp/event.h	\
>> +	../src/cwmp/event.c	\
>>   	../src/cwmp/external.h	\
>>   	../src/cwmp/external.c	\
>>   	../src/http/b64.h	\
>> diff --git a/ext/openwrt/config/freecwmp b/ext/openwrt/config/freecwmp
>> index 05dd3be..e6f126d 100644
>> --- a/ext/openwrt/config/freecwmp
>> +++ b/ext/openwrt/config/freecwmp
>> @@ -2,7 +2,8 @@ config local
>>   	option interface eth0
>>   	option port 7547
>>   	option ubus_socket /var/run/ubus.sock
>> -	option event bootstrap
>> +	list event bootstrap
>> +	list event boot
> I think we could leave this out and by default if there is no event list
> we use this two options (bootstrap and boot).
>
>>   config acs
>>   	option scheme http
>> diff --git a/src/config.c b/src/config.c
>> index ad7a86e..abc621c 100644
>> --- a/src/config.c
>> +++ b/src/config.c
>> @@ -12,6 +12,7 @@
>>
>>   #include "config.h"
>>   #include "cwmp/cwmp.h"
>> +#include "cwmp/event.h"
>>
>>   static bool first_run = true;
>>   static struct uci_context *uci_ctx;
>> @@ -27,13 +28,14 @@ config_free_local(void) {
>>   	FREE(config->local->port);
>>   	FREE(config->local->ubus_socket);
>>   	FREE(config->local);
>> +	event_remove_all_events();
>>   }
>>
>>   static int
>>   config_init_local(void)
>>   {
>>   	struct uci_section *s;
>> -	struct uci_element *e;
>> +	struct uci_element *e,*ie;
>>
>>   	uci_foreach_element(&uci_freecwmp->sections, e) {
>>   		s = uci_to_section(e);
>> @@ -69,14 +71,20 @@ section_found:
>>   			goto next;
>>   		}
>>
>> -		if (!strcmp((uci_to_option(e))->e.name, "event")) {
>> -			if (!strcasecmp("bootstrap", uci_to_option(e)->v.string))
>> -				config->local->event = BOOTSTRAP;
>> +		if (!strcmp((uci_to_option(e))->e.name, "event") && (uci_to_option(e))->type == UCI_TYPE_LIST) {
>> +			uci_foreach_element(&((uci_to_option(e))->v.list), ie)
>> +			{
>> +				if((ie != NULL)&&(ie->name!=NULL))
>> +				{
>> +					if (!strcasecmp("bootstrap", ie->name))
>> +						event_add_event(BOOTSTRAP,NULL);
>>
>> -			if (!strcasecmp("boot", uci_to_option(e)->v.string))
>> -				config->local->event = BOOT;
>> +					if (!strcasecmp("boot", ie->name))
>> +						event_add_event(BOOT,NULL);
>>
>> -			DD("freecwmp.@local[0].event=%s\n", uci_to_option(e)->v.string);
>> +					DD("freecwmp.@local[0].event=%s\n", ie->name);
> I'm not sure if this output will be the same as the one from uci. I'll
> double check.
>
>> +				}
>> +			}
>>   		}
>>
>>   next:
>> diff --git a/src/config.h b/src/config.h
>> index 0bfc096..718d9bc 100644
>> --- a/src/config.h
>> +++ b/src/config.h
>> @@ -45,7 +45,6 @@ struct local {
>>   	char *interface;
>>   	char *port;
>>   	char *ubus_socket;
>> -	int event;
>>   };
>>
>>   struct core_config {
>> diff --git a/src/cwmp/cwmp.c b/src/cwmp/cwmp.c
>> index 7ba851a..d6a0e49 100644
>> --- a/src/cwmp/cwmp.c
>> +++ b/src/cwmp/cwmp.c
>> @@ -12,6 +12,7 @@
>>   #include <libubox/uloop.h>
>>
>>   #include "cwmp.h"
>> +#include "event.h"
>>   #include "external.h"
>>   #include "../freecwmp.h"
>>   #include "../config.h"
>> @@ -20,7 +21,7 @@
>>
>>   static struct cwmp
>>   {
>> -	enum cwmp_event_code event_code;
>> +	struct list_head *event_list;
>>   	struct uloop_timeout connection_request_t;
>>   	struct uloop_timeout periodic_inform_t;
>>   	int8_t periodic_inform_enabled;
>> @@ -45,7 +46,7 @@ cwmp_init(void)
>>   	cwmp.acs_connection_required = 0;
>>   	cwmp.periodic_inform_enabled = 0;
>>   	cwmp.periodic_inform_interval = 0;
>> -	cwmp.event_code = config->local->event;
>> +	cwmp.event_list = &event_list;
>>
>>   	status = cwmp_get_parameter_handler("InternetGatewayDevice.ManagementServer.PeriodicInformInterval", &c);
>>   	if (status == FC_SUCCESS && c) {
>> @@ -181,7 +182,7 @@ cwmp_periodic_inform(struct uloop_timeout *timeout)
>>   	if (cwmp.periodic_inform_enabled && cwmp.periodic_inform_interval) {
>>   		cwmp.periodic_inform_t.cb = cwmp_periodic_inform;
>>   		uloop_timeout_set(&cwmp.periodic_inform_t, cwmp.periodic_inform_interval * 1000);
>> -		cwmp.event_code = PERIODIC;
>> +		event_add_event(PERIODIC,NULL);
>>   	}
>>
>>   	if (cwmp.periodic_inform_enabled)
>> @@ -405,7 +406,7 @@ cwmp_connection_request(void)
>>
>>   	int8_t status;
>>
>> -	cwmp.event_code = CONNECTION_REQUEST;
>> +	event_add_event(CONNECTION_REQUEST,NULL);
>>   	status = cwmp_inform();
>>
>>   	FC_DEVEL_DEBUG("exit");
>> @@ -441,7 +442,7 @@ cwmp_add_notification(char *parameter, char *value)
>>   		n->value = strdup(value);
>>   	}
>>
>> -	cwmp.event_code = VALUE_CHANGE;
>> +	event_add_event(VALUE_CHANGE,NULL);
>>   	if (!strncmp(c, "2", 1)) {
>>   		cwmp_inform();
>>   	}
>> @@ -488,7 +489,7 @@ cwmp_set_parameter_write_handler(char *name, char *value)
>>   	}
>>
>>   	if((strcmp(name, "InternetGatewayDevice.ManagementServer.URL")) == 0) {
>> -		cwmp.event_code = VALUE_CHANGE;
>> +		event_add_event(VALUE_CHANGE,NULL);
>>   		cwmp.config_reload = true;
>>   		cwmp.acs_connection_required = 1;
>>   	}
>> @@ -657,12 +658,23 @@ done:
>>   }
>>
>>   char *
>> -cwmp_get_event_code(void)
>> +cwmp_get_event_code(enum cwmp_get_order order)
>>   {
>>   	FC_DEVEL_DEBUG("enter");
>>
>> -	char *cwmp_inform_event_code;
>> -	switch (cwmp.event_code) {
>> +	static struct list_head *ilist = NULL;
>> +	struct event *event;
>> +	char *cwmp_inform_event_code = NULL;
>> +
>> +	if (order == FIRST || ilist == NULL)
>> +	{
> Coding style tip:
>
> 	if (order == FIRST || ilist == NULL) {
>
> That goes for all your if's and for's...
>
>> +		ilist = cwmp.event_list;
>> +	}
>> +	ilist = ilist->next;
>> +	if (ilist != cwmp.event_list)
>> +	{
>> +		event = list_entry (ilist,struct event,list);
>> +		switch (event->code) {
>>   		case BOOT:
>>   			cwmp_inform_event_code = "1 BOOT";
>>   			break;
>> @@ -682,6 +694,7 @@ cwmp_get_event_code(void)
>>   		default:
>>   			cwmp_inform_event_code = "0 BOOTSTRAP";
>>   			break;
>> +		}
>>   	}
>>
>>   	FC_DEVEL_DEBUG("exit");
>> diff --git a/src/cwmp/cwmp.h b/src/cwmp/cwmp.h
>> index 947539c..a1b3d8b 100644
>> --- a/src/cwmp/cwmp.h
>> +++ b/src/cwmp/cwmp.h
>> @@ -27,6 +27,12 @@ enum cwmp_event_code
>>   	AUTONOMOUS_TRANSFER_COMPLETE
>>   };
>>
>> +enum cwmp_get_order
>> +{
>> +	FIRST = 0,
>> +	NEXT
>> +};
>> +
>>   struct notification {
>>   	struct list_head list;
>>
>> @@ -55,7 +61,7 @@ int8_t cwmp_download_handler(char *url, char *size);
>>   int8_t cwmp_reboot_handler(void);
>>   int8_t cwmp_factory_reset_handler(void);
>>   int8_t cwmp_reload_changes(void);
>> -char * cwmp_get_event_code(void);
>> +char * cwmp_get_event_code(enum cwmp_get_order);
>>   int cwmp_get_retry_count(void);
>>
>>   #endif
>> diff --git a/src/cwmp/event.c b/src/cwmp/event.c
>> index e69de29..561d413 100644
>> --- a/src/cwmp/event.c
>> +++ b/src/cwmp/event.c
> GPLv2 license header is missing...
>
> Also I'll see if this can go in some existing file.
>
>> @@ -0,0 +1,33 @@
>> +#include "event.h"
>> +#include "cwmp.h"
>> +#include "../freecwmp.h"
>> +LIST_HEAD(event_list);
>> +
>> +void
>> +event_add_event(uint8_t code, char *commandKey)
> Please name your variables like this command_key instead commandKey.
>
>> +{
>> +	struct event *event;
>> +
>> +	event = calloc(1,sizeof(struct event));
>> +	event->code = code;
>> +	event->commandKey = commandKey;
>> +	list_add (&(event->list), &(event_list));
>> +
>> +	FC_DEVEL_DEBUG("exit");
>> +}
>> +
>> +void
>> +event_remove_all_events()
>> +{
>> +	struct event *event;
>> +
>> +	FC_DEVEL_DEBUG("enter");
> I'm doing some cleanup so I'll get rid of FC_DEVEL_DEBUG in the near
> future. It's ok for now, I just wanted to give you heads up.
>
>> +
>> +	while (event_list.next != &event_list)
>> +	{
>> +		event = list_entry (event_list.next,struct event, list);
>> +		list_del(&event->list);
>> +		free(event);
>> +	}
>> +	FC_DEVEL_DEBUG("exit");
>> +}
>> diff --git a/src/cwmp/event.h b/src/cwmp/event.h
>> index e69de29..07afa8e 100644
>> --- a/src/cwmp/event.h
>> +++ b/src/cwmp/event.h
>> @@ -0,0 +1,18 @@
> GPLv2 license header is missing...
>
>> +#ifndef _FREECWMP_EVENT_H__
>> +#define _FREECWMP_EVENT_H__
>> +
>> +#include <stdint.h>
>> +#include <libubox/uloop.h>
>> +
>> +struct event
>> +{
>> +	struct list_head list;
>> +	char *commandKey;
>> +	uint8_t code;
>> +};
>> +
>> +void event_add_event(uint8_t code, char *commandKey);
>> +void event_remove_all_events();
>> +
>> +extern struct list_head event_list;
>> +#endif
>> diff --git a/src/cwmp/messages.h b/src/cwmp/messages.h
>> index 046fc82..eea86d1 100644
>> --- a/src/cwmp/messages.h
>> +++ b/src/cwmp/messages.h
>> @@ -29,11 +29,7 @@
>>   			"<ProductClass/>"									\
>>   			"<SerialNumber/>"									\
>>   		"</DeviceId>"											\
>> -		"<Event soap_enc:arrayType=\"cwmp:EventStruct[1]\">"						\
>> -			"<EventStruct>"										\
>> -				"<EventCode/>"									\
>> -				"<CommandKey/>"									\
>> -			"</EventStruct>"									\
>> +		"<Event soap_enc:arrayType=\"cwmp:EventStruct[0]\">"						\
>>   		"</Event>"											\
>>   		"<MaxEnvelopes>1</MaxEnvelopes>"								\
>>   		"<CurrentTime/>"										\
>> @@ -88,6 +84,11 @@
>>   "</soap_env:Body>"												\
>>   "</soap_env:Envelope>"
>>
>> +#define CWMP_INFORM_EVENT_STRUCT \
>> +"<EventStruct>"			\
>> +	"<EventCode/>"		\
>> +	"<CommandKey/>"		\
>> +"</EventStruct>"
>>
>>   #define CWMP_RESPONSE_MESSAGE \
>>   "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>"		\
>> diff --git a/src/xml/xml.c b/src/xml/xml.c
>> index 05424a5..c05cfc0 100644
>> --- a/src/xml/xml.c
>> +++ b/src/xml/xml.c
>> @@ -124,6 +124,40 @@ xml_exit(void)
>>   }
>>
>>   int8_t
>> +xml_prepare_events_inform (mxml_node_t *tree)
>> +{
>> +	mxml_node_t *node, *event_node, *code_node;
>> +	char *c, buf[32];
>> +	uint8_t n = 0;
>> +
>> +
>> +	node = mxmlFindElement(tree, tree, "Event", NULL, NULL, MXML_DESCEND);
>> +
>> +	for (c = cwmp_get_event_code(FIRST); c!= NULL; c =  cwmp_get_event_code(NEXT))
>> +	{
>> +		event_node	= mxmlLoadString(NULL, CWMP_INFORM_EVENT_STRUCT, MXML_NO_CALLBACK);
>> +		if (!event_node)
>> +			return 0;
>> +		code_node	= mxmlFindElement(event_node, event_node, "EventCode", NULL, NULL, MXML_DESCEND);
>> +		if (!code_node)
>> +			return 0;
>> +		code_node	= mxmlNewText(code_node, 0, c);
>> +		if (!code_node)
>> +			return 0;
>> +		mxmlAdd (node,MXML_ADD_AFTER,MXML_ADD_TO_PARENT,event_node);
>> +		n++;
>> +	}
>> +
>> +	if (n)
>> +	{
>> +		sprintf (buf,"cwmp:EventStruct[%u]",n);
>> +		mxmlElementSetAttr(node, "soap_enc:arrayType", buf );	/* I - Attribute value */
>> +	}
>> +
>> +	return 1;
>> +}
>> +
>> +int8_t
>>   xml_prepare_inform_message(char **msg_out)
>>   {
>>   	FC_DEVEL_DEBUG("enter");
>> @@ -178,11 +212,7 @@ xml_prepare_inform_message(char **msg_out)
>>   	if (!busy_node)
>>   		goto error;
>>
>> -	busy_node = mxmlFindElement(tree, tree, "EventCode", NULL, NULL, MXML_DESCEND);
>> -	if (!busy_node)
>> -		goto error;
>> -	busy_node = mxmlNewText(busy_node, 0, cwmp_get_event_code());
>> -	if (!busy_node)
>> +	if (!xml_prepare_events_inform (tree))
>>   		goto error;
>>
>>   	busy_node = mxmlFindElement(tree, tree, "CurrentTime", NULL, NULL, MXML_DESCEND);
> That would be it for now. I'll try and merge your patch this week.
>
> I would also like to invite you to #freecwmp IRC channel on freenode.
>
> Regards,
> Luka
>






--------------030301030101060401040904
Content-Type: text/html; charset=windows-1256
Content-Transfer-Encoding: 8bit

<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=windows-1256">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi Luka<br>
    <br>
    I'm waiting you feedback concerning the last patch I send. I can not
    go ahead in the next patch (complete the support of many events)
    without getting your git repesotory updated with my last patch I
    send<br>
    Could you please send to me you your feed back (what ever positive
    or negative)<br>
    <br>
    Regards<br>
    <div class="moz-forward-container">
      <div class="moz-signature">
      </div>
      <br>
      <br>
      -------- Message original --------
      <table class="moz-email-headers-table" border="0" cellpadding="0"
        cellspacing="0">
        <tbody>
          <tr>
            <th align="RIGHT" nowrap="nowrap" valign="BASELINE">Sujet: </th>
            <td>Re: patch for the freecwmp project</td>
          </tr>
          <tr>
            <th align="RIGHT" nowrap="nowrap" valign="BASELINE">Date : </th>
            <td>Tue, 04 Sep 2012 09:28:27 +0100</td>
          </tr>
          <tr>
            <th align="RIGHT" nowrap="nowrap" valign="BASELINE">De : </th>
            <td>KALLEL Mohamed <a class="moz-txt-link-rfc2396E" href="mailto:mohamed.kallel@pivasoftware.com">&lt;mohamed.kallel@pivasoftware.com&gt;</a></td>
          </tr>
          <tr>
            <th align="RIGHT" nowrap="nowrap" valign="BASELINE">Pour : </th>
            <td><a class="moz-txt-link-abbreviated" href="mailto:freecwmp@linux-mips.org">freecwmp@linux-mips.org</a>, <a class="moz-txt-link-abbreviated" href="mailto:freecwmp@lukaperkov.net">freecwmp@lukaperkov.net</a></td>
          </tr>
        </tbody>
      </table>
      <br>
      <br>
      <pre>Hi Luka

Following your response concerning my patch, please find attached the 
patch updated with Jonas remarks and your remarks.

Note: the fact of removing the bootstrap event from the list and from 
the config (after the send success of the inform) is not added in this 
patch. Also the add of boot event and the bootstrap event in the 
start-up of the equipment is not added in this patch.
Both behaviours should be added in the future patches

Regards
Mohamed

Le 28/08/2012 13:28, Luka Perkov a écrit :
&gt; Hi Mohamed,
&gt;
&gt; On Tue, Aug 21, 2012 at 09:11:00AM +0100, KALLEL Mohamed wrote:
&gt;&gt; I'm Mohamed KALLEL and I'm interested in your freecwmp project.
&gt; Welcome aboard!
&gt;
&gt;&gt; And I want to contribute in the development with the following patch
&gt;&gt; (patch attached with this email).
&gt; Thank you. I'll try to merge it this week, for now I'll give some quick
&gt; comments bellow.
&gt;
&gt;&gt; The patch allow to support many events in the inform message. the
&gt;&gt; old behavior support only one event in the inform message
&gt;&gt; this patch allow to add the boot event (with the bootstarp event) in
&gt;&gt; the inform message.
&gt;&gt; the patch is based on the revision: *6d074ab*
&gt;&gt;
&gt;&gt; Mohamed KALLEL
&gt;&gt;
&gt;&gt;
&gt;&gt; diff --git a/bin/Makefile.am b/bin/Makefile.am
&gt;&gt; index aa4db87..d7abfe2 100644
&gt;&gt; --- a/bin/Makefile.am
&gt;&gt; +++ b/bin/Makefile.am
&gt;&gt; @@ -7,6 +7,8 @@ freecwmpd_SOURCES =		\
&gt;&gt;   	../src/config.c		\
&gt;&gt;   	../src/cwmp/cwmp.h	\
&gt;&gt;   	../src/cwmp/cwmp.c	\
&gt;&gt; +	../src/cwmp/event.h	\
&gt;&gt; +	../src/cwmp/event.c	\
&gt;&gt;   	../src/cwmp/external.h	\
&gt;&gt;   	../src/cwmp/external.c	\
&gt;&gt;   	../src/http/b64.h	\
&gt;&gt; diff --git a/ext/openwrt/config/freecwmp b/ext/openwrt/config/freecwmp
&gt;&gt; index 05dd3be..e6f126d 100644
&gt;&gt; --- a/ext/openwrt/config/freecwmp
&gt;&gt; +++ b/ext/openwrt/config/freecwmp
&gt;&gt; @@ -2,7 +2,8 @@ config local
&gt;&gt;   	option interface eth0
&gt;&gt;   	option port 7547
&gt;&gt;   	option ubus_socket /var/run/ubus.sock
&gt;&gt; -	option event bootstrap
&gt;&gt; +	list event bootstrap
&gt;&gt; +	list event boot
&gt; I think we could leave this out and by default if there is no event list
&gt; we use this two options (bootstrap and boot).
&gt;
&gt;&gt;   config acs
&gt;&gt;   	option scheme http
&gt;&gt; diff --git a/src/config.c b/src/config.c
&gt;&gt; index ad7a86e..abc621c 100644
&gt;&gt; --- a/src/config.c
&gt;&gt; +++ b/src/config.c
&gt;&gt; @@ -12,6 +12,7 @@
&gt;&gt;   
&gt;&gt;   #include "config.h"
&gt;&gt;   #include "cwmp/cwmp.h"
&gt;&gt; +#include "cwmp/event.h"
&gt;&gt;   
&gt;&gt;   static bool first_run = true;
&gt;&gt;   static struct uci_context *uci_ctx;
&gt;&gt; @@ -27,13 +28,14 @@ config_free_local(void) {
&gt;&gt;   	FREE(config-&gt;local-&gt;port);
&gt;&gt;   	FREE(config-&gt;local-&gt;ubus_socket);
&gt;&gt;   	FREE(config-&gt;local);
&gt;&gt; +	event_remove_all_events();
&gt;&gt;   }
&gt;&gt;   
&gt;&gt;   static int
&gt;&gt;   config_init_local(void)
&gt;&gt;   {
&gt;&gt;   	struct uci_section *s;
&gt;&gt; -	struct uci_element *e;
&gt;&gt; +	struct uci_element *e,*ie;
&gt;&gt;   
&gt;&gt;   	uci_foreach_element(&amp;uci_freecwmp-&gt;sections, e) {
&gt;&gt;   		s = uci_to_section(e);
&gt;&gt; @@ -69,14 +71,20 @@ section_found:
&gt;&gt;   			goto next;
&gt;&gt;   		}
&gt;&gt;   
&gt;&gt; -		if (!strcmp((uci_to_option(e))-&gt;e.name, "event")) {
&gt;&gt; -			if (!strcasecmp("bootstrap", uci_to_option(e)-&gt;v.string))
&gt;&gt; -				config-&gt;local-&gt;event = BOOTSTRAP;
&gt;&gt; +		if (!strcmp((uci_to_option(e))-&gt;e.name, "event") &amp;&amp; (uci_to_option(e))-&gt;type == UCI_TYPE_LIST) {
&gt;&gt; +			uci_foreach_element(&amp;((uci_to_option(e))-&gt;v.list), ie)
&gt;&gt; +			{
&gt;&gt; +				if((ie != NULL)&amp;&amp;(ie-&gt;name!=NULL))
&gt;&gt; +				{
&gt;&gt; +					if (!strcasecmp("bootstrap", ie-&gt;name))
&gt;&gt; +						event_add_event(BOOTSTRAP,NULL);
&gt;&gt;   
&gt;&gt; -			if (!strcasecmp("boot", uci_to_option(e)-&gt;v.string))
&gt;&gt; -				config-&gt;local-&gt;event = BOOT;
&gt;&gt; +					if (!strcasecmp("boot", ie-&gt;name))
&gt;&gt; +						event_add_event(BOOT,NULL);
&gt;&gt;   
&gt;&gt; -			DD(<a class="moz-txt-link-rfc2396E" href="mailto:freecwmp.@local[0].event=%s\n">"freecwmp.@local[0].event=%s\n"</a>, uci_to_option(e)-&gt;v.string);
&gt;&gt; +					DD(<a class="moz-txt-link-rfc2396E" href="mailto:freecwmp.@local[0].event=%s\n">"freecwmp.@local[0].event=%s\n"</a>, ie-&gt;name);
&gt; I'm not sure if this output will be the same as the one from uci. I'll
&gt; double check.
&gt;
&gt;&gt; +				}
&gt;&gt; +			}
&gt;&gt;   		}
&gt;&gt;   
&gt;&gt;   next:
&gt;&gt; diff --git a/src/config.h b/src/config.h
&gt;&gt; index 0bfc096..718d9bc 100644
&gt;&gt; --- a/src/config.h
&gt;&gt; +++ b/src/config.h
&gt;&gt; @@ -45,7 +45,6 @@ struct local {
&gt;&gt;   	char *interface;
&gt;&gt;   	char *port;
&gt;&gt;   	char *ubus_socket;
&gt;&gt; -	int event;
&gt;&gt;   };
&gt;&gt;   
&gt;&gt;   struct core_config {
&gt;&gt; diff --git a/src/cwmp/cwmp.c b/src/cwmp/cwmp.c
&gt;&gt; index 7ba851a..d6a0e49 100644
&gt;&gt; --- a/src/cwmp/cwmp.c
&gt;&gt; +++ b/src/cwmp/cwmp.c
&gt;&gt; @@ -12,6 +12,7 @@
&gt;&gt;   #include &lt;libubox/uloop.h&gt;
&gt;&gt;   
&gt;&gt;   #include "cwmp.h"
&gt;&gt; +#include "event.h"
&gt;&gt;   #include "external.h"
&gt;&gt;   #include "../freecwmp.h"
&gt;&gt;   #include "../config.h"
&gt;&gt; @@ -20,7 +21,7 @@
&gt;&gt;   
&gt;&gt;   static struct cwmp
&gt;&gt;   {
&gt;&gt; -	enum cwmp_event_code event_code;
&gt;&gt; +	struct list_head *event_list;
&gt;&gt;   	struct uloop_timeout connection_request_t;
&gt;&gt;   	struct uloop_timeout periodic_inform_t;
&gt;&gt;   	int8_t periodic_inform_enabled;
&gt;&gt; @@ -45,7 +46,7 @@ cwmp_init(void)
&gt;&gt;   	cwmp.acs_connection_required = 0;
&gt;&gt;   	cwmp.periodic_inform_enabled = 0;
&gt;&gt;   	cwmp.periodic_inform_interval = 0;
&gt;&gt; -	cwmp.event_code = config-&gt;local-&gt;event;
&gt;&gt; +	cwmp.event_list = &amp;event_list;
&gt;&gt;   
&gt;&gt;   	status = cwmp_get_parameter_handler("InternetGatewayDevice.ManagementServer.PeriodicInformInterval", &amp;c);
&gt;&gt;   	if (status == FC_SUCCESS &amp;&amp; c) {
&gt;&gt; @@ -181,7 +182,7 @@ cwmp_periodic_inform(struct uloop_timeout *timeout)
&gt;&gt;   	if (cwmp.periodic_inform_enabled &amp;&amp; cwmp.periodic_inform_interval) {
&gt;&gt;   		cwmp.periodic_inform_t.cb = cwmp_periodic_inform;
&gt;&gt;   		uloop_timeout_set(&amp;cwmp.periodic_inform_t, cwmp.periodic_inform_interval * 1000);
&gt;&gt; -		cwmp.event_code = PERIODIC;
&gt;&gt; +		event_add_event(PERIODIC,NULL);
&gt;&gt;   	}
&gt;&gt;   
&gt;&gt;   	if (cwmp.periodic_inform_enabled)
&gt;&gt; @@ -405,7 +406,7 @@ cwmp_connection_request(void)
&gt;&gt;   
&gt;&gt;   	int8_t status;
&gt;&gt;   
&gt;&gt; -	cwmp.event_code = CONNECTION_REQUEST;
&gt;&gt; +	event_add_event(CONNECTION_REQUEST,NULL);
&gt;&gt;   	status = cwmp_inform();
&gt;&gt;   
&gt;&gt;   	FC_DEVEL_DEBUG("exit");
&gt;&gt; @@ -441,7 +442,7 @@ cwmp_add_notification(char *parameter, char *value)
&gt;&gt;   		n-&gt;value = strdup(value);
&gt;&gt;   	}
&gt;&gt;   
&gt;&gt; -	cwmp.event_code = VALUE_CHANGE;
&gt;&gt; +	event_add_event(VALUE_CHANGE,NULL);
&gt;&gt;   	if (!strncmp(c, "2", 1)) {
&gt;&gt;   		cwmp_inform();
&gt;&gt;   	}
&gt;&gt; @@ -488,7 +489,7 @@ cwmp_set_parameter_write_handler(char *name, char *value)
&gt;&gt;   	}
&gt;&gt;   
&gt;&gt;   	if((strcmp(name, "InternetGatewayDevice.ManagementServer.URL")) == 0) {
&gt;&gt; -		cwmp.event_code = VALUE_CHANGE;
&gt;&gt; +		event_add_event(VALUE_CHANGE,NULL);
&gt;&gt;   		cwmp.config_reload = true;
&gt;&gt;   		cwmp.acs_connection_required = 1;
&gt;&gt;   	}
&gt;&gt; @@ -657,12 +658,23 @@ done:
&gt;&gt;   }
&gt;&gt;   
&gt;&gt;   char *
&gt;&gt; -cwmp_get_event_code(void)
&gt;&gt; +cwmp_get_event_code(enum cwmp_get_order order)
&gt;&gt;   {
&gt;&gt;   	FC_DEVEL_DEBUG("enter");
&gt;&gt;   
&gt;&gt; -	char *cwmp_inform_event_code;
&gt;&gt; -	switch (cwmp.event_code) {
&gt;&gt; +	static struct list_head *ilist = NULL;
&gt;&gt; +	struct event *event;
&gt;&gt; +	char *cwmp_inform_event_code = NULL;
&gt;&gt; +
&gt;&gt; +	if (order == FIRST || ilist == NULL)
&gt;&gt; +	{
&gt; Coding style tip:
&gt;
&gt; 	if (order == FIRST || ilist == NULL) {
&gt;
&gt; That goes for all your if's and for's...
&gt;
&gt;&gt; +		ilist = cwmp.event_list;
&gt;&gt; +	}
&gt;&gt; +	ilist = ilist-&gt;next;
&gt;&gt; +	if (ilist != cwmp.event_list)
&gt;&gt; +	{
&gt;&gt; +		event = list_entry (ilist,struct event,list);
&gt;&gt; +		switch (event-&gt;code) {
&gt;&gt;   		case BOOT:
&gt;&gt;   			cwmp_inform_event_code = "1 BOOT";
&gt;&gt;   			break;
&gt;&gt; @@ -682,6 +694,7 @@ cwmp_get_event_code(void)
&gt;&gt;   		default:
&gt;&gt;   			cwmp_inform_event_code = "0 BOOTSTRAP";
&gt;&gt;   			break;
&gt;&gt; +		}
&gt;&gt;   	}
&gt;&gt;   
&gt;&gt;   	FC_DEVEL_DEBUG("exit");
&gt;&gt; diff --git a/src/cwmp/cwmp.h b/src/cwmp/cwmp.h
&gt;&gt; index 947539c..a1b3d8b 100644
&gt;&gt; --- a/src/cwmp/cwmp.h
&gt;&gt; +++ b/src/cwmp/cwmp.h
&gt;&gt; @@ -27,6 +27,12 @@ enum cwmp_event_code
&gt;&gt;   	AUTONOMOUS_TRANSFER_COMPLETE
&gt;&gt;   };
&gt;&gt;   
&gt;&gt; +enum cwmp_get_order
&gt;&gt; +{
&gt;&gt; +	FIRST = 0,
&gt;&gt; +	NEXT
&gt;&gt; +};
&gt;&gt; +
&gt;&gt;   struct notification {
&gt;&gt;   	struct list_head list;
&gt;&gt;   
&gt;&gt; @@ -55,7 +61,7 @@ int8_t cwmp_download_handler(char *url, char *size);
&gt;&gt;   int8_t cwmp_reboot_handler(void);
&gt;&gt;   int8_t cwmp_factory_reset_handler(void);
&gt;&gt;   int8_t cwmp_reload_changes(void);
&gt;&gt; -char * cwmp_get_event_code(void);
&gt;&gt; +char * cwmp_get_event_code(enum cwmp_get_order);
&gt;&gt;   int cwmp_get_retry_count(void);
&gt;&gt;   
&gt;&gt;   #endif
&gt;&gt; diff --git a/src/cwmp/event.c b/src/cwmp/event.c
&gt;&gt; index e69de29..561d413 100644
&gt;&gt; --- a/src/cwmp/event.c
&gt;&gt; +++ b/src/cwmp/event.c
&gt; GPLv2 license header is missing...
&gt;
&gt; Also I'll see if this can go in some existing file.
&gt;
&gt;&gt; @@ -0,0 +1,33 @@
&gt;&gt; +#include "event.h"
&gt;&gt; +#include "cwmp.h"
&gt;&gt; +#include "../freecwmp.h"
&gt;&gt; +LIST_HEAD(event_list);
&gt;&gt; +
&gt;&gt; +void
&gt;&gt; +event_add_event(uint8_t code, char *commandKey)
&gt; Please name your variables like this command_key instead commandKey.
&gt;
&gt;&gt; +{
&gt;&gt; +	struct event *event;
&gt;&gt; +
&gt;&gt; +	event = calloc(1,sizeof(struct event));
&gt;&gt; +	event-&gt;code = code;
&gt;&gt; +	event-&gt;commandKey = commandKey;
&gt;&gt; +	list_add (&amp;(event-&gt;list), &amp;(event_list));
&gt;&gt; +
&gt;&gt; +	FC_DEVEL_DEBUG("exit");
&gt;&gt; +}
&gt;&gt; +
&gt;&gt; +void
&gt;&gt; +event_remove_all_events()
&gt;&gt; +{
&gt;&gt; +	struct event *event;
&gt;&gt; +
&gt;&gt; +	FC_DEVEL_DEBUG("enter");
&gt; I'm doing some cleanup so I'll get rid of FC_DEVEL_DEBUG in the near
&gt; future. It's ok for now, I just wanted to give you heads up.
&gt;
&gt;&gt; +
&gt;&gt; +	while (event_list.next != &amp;event_list)
&gt;&gt; +	{
&gt;&gt; +		event = list_entry (event_list.next,struct event, list);
&gt;&gt; +		list_del(&amp;event-&gt;list);
&gt;&gt; +		free(event);
&gt;&gt; +	}
&gt;&gt; +	FC_DEVEL_DEBUG("exit");
&gt;&gt; +}
&gt;&gt; diff --git a/src/cwmp/event.h b/src/cwmp/event.h
&gt;&gt; index e69de29..07afa8e 100644
&gt;&gt; --- a/src/cwmp/event.h
&gt;&gt; +++ b/src/cwmp/event.h
&gt;&gt; @@ -0,0 +1,18 @@
&gt; GPLv2 license header is missing...
&gt;
&gt;&gt; +#ifndef _FREECWMP_EVENT_H__
&gt;&gt; +#define _FREECWMP_EVENT_H__
&gt;&gt; +
&gt;&gt; +#include &lt;stdint.h&gt;
&gt;&gt; +#include &lt;libubox/uloop.h&gt;
&gt;&gt; +
&gt;&gt; +struct event
&gt;&gt; +{
&gt;&gt; +	struct list_head list;
&gt;&gt; +	char *commandKey;
&gt;&gt; +	uint8_t code;
&gt;&gt; +};
&gt;&gt; +
&gt;&gt; +void event_add_event(uint8_t code, char *commandKey);
&gt;&gt; +void event_remove_all_events();
&gt;&gt; +
&gt;&gt; +extern struct list_head event_list;
&gt;&gt; +#endif
&gt;&gt; diff --git a/src/cwmp/messages.h b/src/cwmp/messages.h
&gt;&gt; index 046fc82..eea86d1 100644
&gt;&gt; --- a/src/cwmp/messages.h
&gt;&gt; +++ b/src/cwmp/messages.h
&gt;&gt; @@ -29,11 +29,7 @@
&gt;&gt;   			"&lt;ProductClass/&gt;"									\
&gt;&gt;   			"&lt;SerialNumber/&gt;"									\
&gt;&gt;   		"&lt;/DeviceId&gt;"											\
&gt;&gt; -		"&lt;Event soap_enc:arrayType=\"cwmp:EventStruct[1]\"&gt;"						\
&gt;&gt; -			"&lt;EventStruct&gt;"										\
&gt;&gt; -				"&lt;EventCode/&gt;"									\
&gt;&gt; -				"&lt;CommandKey/&gt;"									\
&gt;&gt; -			"&lt;/EventStruct&gt;"									\
&gt;&gt; +		"&lt;Event soap_enc:arrayType=\"cwmp:EventStruct[0]\"&gt;"						\
&gt;&gt;   		"&lt;/Event&gt;"											\
&gt;&gt;   		"&lt;MaxEnvelopes&gt;1&lt;/MaxEnvelopes&gt;"								\
&gt;&gt;   		"&lt;CurrentTime/&gt;"										\
&gt;&gt; @@ -88,6 +84,11 @@
&gt;&gt;   "&lt;/soap_env:Body&gt;"												\
&gt;&gt;   "&lt;/soap_env:Envelope&gt;"
&gt;&gt;   
&gt;&gt; +#define CWMP_INFORM_EVENT_STRUCT \
&gt;&gt; +"&lt;EventStruct&gt;"			\
&gt;&gt; +	"&lt;EventCode/&gt;"		\
&gt;&gt; +	"&lt;CommandKey/&gt;"		\
&gt;&gt; +"&lt;/EventStruct&gt;"
&gt;&gt;   
&gt;&gt;   #define CWMP_RESPONSE_MESSAGE \
&gt;&gt;   "&lt;?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?&gt;"		\
&gt;&gt; diff --git a/src/xml/xml.c b/src/xml/xml.c
&gt;&gt; index 05424a5..c05cfc0 100644
&gt;&gt; --- a/src/xml/xml.c
&gt;&gt; +++ b/src/xml/xml.c
&gt;&gt; @@ -124,6 +124,40 @@ xml_exit(void)
&gt;&gt;   }
&gt;&gt;   
&gt;&gt;   int8_t
&gt;&gt; +xml_prepare_events_inform (mxml_node_t *tree)
&gt;&gt; +{
&gt;&gt; +	mxml_node_t *node, *event_node, *code_node;
&gt;&gt; +	char *c, buf[32];
&gt;&gt; +	uint8_t n = 0;
&gt;&gt; +
&gt;&gt; +
&gt;&gt; +	node = mxmlFindElement(tree, tree, "Event", NULL, NULL, MXML_DESCEND);
&gt;&gt; +
&gt;&gt; +	for (c = cwmp_get_event_code(FIRST); c!= NULL; c =  cwmp_get_event_code(NEXT))
&gt;&gt; +	{
&gt;&gt; +		event_node	= mxmlLoadString(NULL, CWMP_INFORM_EVENT_STRUCT, MXML_NO_CALLBACK);
&gt;&gt; +		if (!event_node)
&gt;&gt; +			return 0;
&gt;&gt; +		code_node	= mxmlFindElement(event_node, event_node, "EventCode", NULL, NULL, MXML_DESCEND);
&gt;&gt; +		if (!code_node)
&gt;&gt; +			return 0;
&gt;&gt; +		code_node	= mxmlNewText(code_node, 0, c);
&gt;&gt; +		if (!code_node)
&gt;&gt; +			return 0;
&gt;&gt; +		mxmlAdd (node,MXML_ADD_AFTER,MXML_ADD_TO_PARENT,event_node);
&gt;&gt; +		n++;
&gt;&gt; +	}
&gt;&gt; +
&gt;&gt; +	if (n)
&gt;&gt; +	{
&gt;&gt; +		sprintf (buf,"cwmp:EventStruct[%u]",n);
&gt;&gt; +		mxmlElementSetAttr(node, "soap_enc:arrayType", buf );	/* I - Attribute value */
&gt;&gt; +	}
&gt;&gt; +
&gt;&gt; +	return 1;
&gt;&gt; +}
&gt;&gt; +
&gt;&gt; +int8_t
&gt;&gt;   xml_prepare_inform_message(char **msg_out)
&gt;&gt;   {
&gt;&gt;   	FC_DEVEL_DEBUG("enter");
&gt;&gt; @@ -178,11 +212,7 @@ xml_prepare_inform_message(char **msg_out)
&gt;&gt;   	if (!busy_node)
&gt;&gt;   		goto error;
&gt;&gt;   
&gt;&gt; -	busy_node = mxmlFindElement(tree, tree, "EventCode", NULL, NULL, MXML_DESCEND);
&gt;&gt; -	if (!busy_node)
&gt;&gt; -		goto error;
&gt;&gt; -	busy_node = mxmlNewText(busy_node, 0, cwmp_get_event_code());
&gt;&gt; -	if (!busy_node)
&gt;&gt; +	if (!xml_prepare_events_inform (tree))
&gt;&gt;   		goto error;
&gt;&gt;   
&gt;&gt;   	busy_node = mxmlFindElement(tree, tree, "CurrentTime", NULL, NULL, MXML_DESCEND);
&gt; That would be it for now. I'll try and merge your patch this week.
&gt;
&gt; I would also like to invite you to #freecwmp IRC channel on freenode.
&gt;
&gt; Regards,
&gt; Luka
&gt;


</pre>
      <br>
      <br>
    </div>
    <br>
  </body>
</html>

--------------030301030101060401040904--

--------------080801030809090505000308
Content-Type: text/plain; charset=windows-1256;
 name="freecwmp20120904.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="freecwmp20120904.patch"

commit 53630745adf1171144137c244d085842be4871b5
Author: Mohamed <mohamed.kallel@pivasoftware.com>
Date:   Tue Sep 4 08:48:44 2012 +0100

    allow to support many events in the inform message. the old behavior
    support only one event in the inform message this patch allow to add the
    boot event (with the bootstarp event) in the inform message.

diff --git a/bin/Makefile.am b/bin/Makefile.am
index aa4db87..d7abfe2 100644
--- a/bin/Makefile.am
+++ b/bin/Makefile.am
@@ -7,6 +7,8 @@ freecwmpd_SOURCES =		\
 	../src/config.c		\
 	../src/cwmp/cwmp.h	\
 	../src/cwmp/cwmp.c	\
+	../src/cwmp/event.h	\
+	../src/cwmp/event.c	\
 	../src/cwmp/external.h	\
 	../src/cwmp/external.c	\
 	../src/http/b64.h	\
diff --git a/ext/openwrt/config/freecwmp b/ext/openwrt/config/freecwmp
index 05dd3be..e6f126d 100644
--- a/ext/openwrt/config/freecwmp
+++ b/ext/openwrt/config/freecwmp
@@ -2,7 +2,8 @@ config local
 	option interface eth0
 	option port 7547
 	option ubus_socket /var/run/ubus.sock
-	option event bootstrap
+	list event bootstrap
+	list event boot
 
 config acs
 	option scheme http
diff --git a/src/config.c b/src/config.c
index ad7a86e..9cb3f5b 100644
--- a/src/config.c
+++ b/src/config.c
@@ -12,6 +12,7 @@
 
 #include "config.h"
 #include "cwmp/cwmp.h"
+#include "cwmp/event.h"
 
 static bool first_run = true;
 static struct uci_context *uci_ctx;
@@ -27,13 +28,14 @@ config_free_local(void) {
 	FREE(config->local->port);
 	FREE(config->local->ubus_socket);
 	FREE(config->local);
+	event_remove_all_events();
 }
 
 static int
 config_init_local(void)
 {
 	struct uci_section *s;
-	struct uci_element *e;
+	struct uci_element *e, *ie;
 
 	uci_foreach_element(&uci_freecwmp->sections, e) {
 		s = uci_to_section(e);
@@ -69,14 +71,18 @@ section_found:
 			goto next;
 		}
 
-		if (!strcmp((uci_to_option(e))->e.name, "event")) {
-			if (!strcasecmp("bootstrap", uci_to_option(e)->v.string))
-				config->local->event = BOOTSTRAP;
+		if (!strcmp((uci_to_option(e))->e.name, "event") && (uci_to_option(e))->type == UCI_TYPE_LIST) {
+			uci_foreach_element(&((uci_to_option(e))->v.list), ie) {
+				if ((ie != NULL) && (ie->name != NULL)) {
+					if (!strcasecmp("bootstrap", ie->name))
+						event_add_event(BOOTSTRAP, NULL);
 
-			if (!strcasecmp("boot", uci_to_option(e)->v.string))
-				config->local->event = BOOT;
+					if (!strcasecmp("boot", ie->name))
+						event_add_event(BOOT, NULL);
 
-			DD("freecwmp.@local[0].event=%s\n", uci_to_option(e)->v.string);
+					DD("freecwmp.@local[0].event=%s\n", ie->name);
+				}
+			}
 		}
 
 next:
diff --git a/src/config.h b/src/config.h
index 0bfc096..718d9bc 100644
--- a/src/config.h
+++ b/src/config.h
@@ -45,7 +45,6 @@ struct local {
 	char *interface;
 	char *port;
 	char *ubus_socket;
-	int event;
 };
 
 struct core_config {
diff --git a/src/cwmp/cwmp.c b/src/cwmp/cwmp.c
index 7ba851a..d4975d7 100644
--- a/src/cwmp/cwmp.c
+++ b/src/cwmp/cwmp.c
@@ -12,6 +12,7 @@
 #include <libubox/uloop.h>
 
 #include "cwmp.h"
+#include "event.h"
 #include "external.h"
 #include "../freecwmp.h"
 #include "../config.h"
@@ -20,7 +21,7 @@
 
 static struct cwmp
 {
-	enum cwmp_event_code event_code;
+	struct list_head *event_list;
 	struct uloop_timeout connection_request_t;
 	struct uloop_timeout periodic_inform_t;
 	int8_t periodic_inform_enabled;
@@ -45,7 +46,7 @@ cwmp_init(void)
 	cwmp.acs_connection_required = 0;
 	cwmp.periodic_inform_enabled = 0;
 	cwmp.periodic_inform_interval = 0;
-	cwmp.event_code = config->local->event;
+	cwmp.event_list = &event_list;
 
 	status = cwmp_get_parameter_handler("InternetGatewayDevice.ManagementServer.PeriodicInformInterval", &c);
 	if (status == FC_SUCCESS && c) {
@@ -181,7 +182,7 @@ cwmp_periodic_inform(struct uloop_timeout *timeout)
 	if (cwmp.periodic_inform_enabled && cwmp.periodic_inform_interval) {
 		cwmp.periodic_inform_t.cb = cwmp_periodic_inform;
 		uloop_timeout_set(&cwmp.periodic_inform_t, cwmp.periodic_inform_interval * 1000);
-		cwmp.event_code = PERIODIC;
+		event_add_event(PERIODIC, NULL);
 	}
 
 	if (cwmp.periodic_inform_enabled)
@@ -405,7 +406,7 @@ cwmp_connection_request(void)
 
 	int8_t status;
 
-	cwmp.event_code = CONNECTION_REQUEST;
+	event_add_event(CONNECTION_REQUEST, NULL);
 	status = cwmp_inform();
 
 	FC_DEVEL_DEBUG("exit");
@@ -441,7 +442,7 @@ cwmp_add_notification(char *parameter, char *value)
 		n->value = strdup(value);
 	}
 
-	cwmp.event_code = VALUE_CHANGE;
+	event_add_event(VALUE_CHANGE, NULL);
 	if (!strncmp(c, "2", 1)) {
 		cwmp_inform();
 	}
@@ -488,7 +489,7 @@ cwmp_set_parameter_write_handler(char *name, char *value)
 	}
 
 	if((strcmp(name, "InternetGatewayDevice.ManagementServer.URL")) == 0) {
-		cwmp.event_code = VALUE_CHANGE;
+		event_add_event(VALUE_CHANGE, NULL);
 		cwmp.config_reload = true;
 		cwmp.acs_connection_required = 1; 
 	}
@@ -656,13 +657,19 @@ done:
 	return status;
 }
 
+struct list_head *
+cwmp_get_event_list_head()
+{
+	return cwmp.event_list;
+}
+
 char *
-cwmp_get_event_code(void)
+cwmp_get_event_code(enum cwmp_event_code event_code)
 {
 	FC_DEVEL_DEBUG("enter");
 
 	char *cwmp_inform_event_code;
-	switch (cwmp.event_code) {
+	switch (event_code) {
 		case BOOT:
 			cwmp_inform_event_code = "1 BOOT";
 			break;
diff --git a/src/cwmp/cwmp.h b/src/cwmp/cwmp.h
index 947539c..ca52a49 100644
--- a/src/cwmp/cwmp.h
+++ b/src/cwmp/cwmp.h
@@ -55,7 +55,8 @@ int8_t cwmp_download_handler(char *url, char *size);
 int8_t cwmp_reboot_handler(void);
 int8_t cwmp_factory_reset_handler(void);
 int8_t cwmp_reload_changes(void);
-char * cwmp_get_event_code(void);
+char * cwmp_get_event_code(enum cwmp_event_code);
+struct list_head * cwmp_get_event_list_head();
 int cwmp_get_retry_count(void);
 
 #endif
diff --git a/src/cwmp/event.c b/src/cwmp/event.c
new file mode 100644
index 0000000..e741645
--- /dev/null
+++ b/src/cwmp/event.c
@@ -0,0 +1,82 @@
+/*
+ *	This program is free software: you can redistribute it and/or modify
+ *	it under the terms of the GNU General Public License as published by
+ *	the Free Software Foundation, either version 2 of the License, or
+ *	(at your option) any later version.
+ *
+ *	Copyright (C) 2011-2012 Luka Perkov <freecwmp@lukaperkov.net>
+ */
+
+#include <pthread.h>
+
+#include "event.h"
+#include "cwmp.h"
+#include "../freecwmp.h"
+LIST_HEAD(event_list);
+static pthread_mutex_t mutex_event_list;
+
+void
+event_init()
+{
+	FC_DEVEL_DEBUG("enter");
+
+	pthread_mutex_init(&mutex_event_list, NULL);
+
+	FC_DEVEL_DEBUG("exit");
+}
+
+void
+event_add_event(uint8_t code, char *commandKey)
+{
+	FC_DEVEL_DEBUG("enter");
+
+	struct event *event;
+
+	pthread_mutex_lock(&mutex_event_list);
+	event = calloc(1, sizeof(struct event));
+	event->code = code;
+	if (commandKey!=NULL)
+		event->commandKey = strdup(commandKey);
+	list_add(&(event->list), &(event_list));
+	pthread_mutex_unlock(&mutex_event_list);
+
+	FC_DEVEL_DEBUG("exit");
+}
+
+void
+event_remove_all_events()
+{
+	struct event *event;
+
+	FC_DEVEL_DEBUG("enter");
+
+	pthread_mutex_lock(&mutex_event_list);
+	while (event_list.next != &event_list) {
+		event = list_entry(event_list.next, struct event, list);
+		list_del(&event->list);
+		if (event->commandKey!=NULL)
+			free(event->commandKey);
+		free(event);
+	}
+	pthread_mutex_unlock(&mutex_event_list);
+	FC_DEVEL_DEBUG("exit");
+}
+
+void
+event_list_head_mutex_lock()
+{
+	FC_DEVEL_DEBUG("enter");
+
+	pthread_mutex_lock(&mutex_event_list);
+
+	FC_DEVEL_DEBUG("exit");
+}
+void
+event_list_head_mutex_unlock()
+{
+	FC_DEVEL_DEBUG("enter");
+
+	pthread_mutex_unlock(&mutex_event_list);
+
+	FC_DEVEL_DEBUG("exit");
+}
diff --git a/src/cwmp/event.h b/src/cwmp/event.h
new file mode 100644
index 0000000..b404b3b
--- /dev/null
+++ b/src/cwmp/event.h
@@ -0,0 +1,30 @@
+/*
+ *	This program is free software: you can redistribute it and/or modify
+ *	it under the terms of the GNU General Public License as published by
+ *	the Free Software Foundation, either version 2 of the License, or
+ *	(at your option) any later version.
+ *
+ *	Copyright (C) 2011-2012 Luka Perkov <freecwmp@lukaperkov.net>
+ */
+
+#ifndef _FREECWMP_EVENT_H__
+#define _FREECWMP_EVENT_H__
+
+#include <stdint.h>
+#include <libubox/uloop.h>
+
+struct event
+{
+	struct list_head list;
+	char *commandKey;
+	uint8_t code;
+};
+
+void event_add_event(uint8_t code, char *commandKey);
+void event_remove_all_events();
+void event_init();
+void event_list_head_mutex_lock();
+void event_list_head_mutex_unlock();
+
+extern struct list_head event_list;
+#endif
diff --git a/src/cwmp/messages.h b/src/cwmp/messages.h
index 046fc82..24e6695 100644
--- a/src/cwmp/messages.h
+++ b/src/cwmp/messages.h
@@ -29,11 +29,7 @@
 			"<ProductClass/>"									\
 			"<SerialNumber/>"									\
 		"</DeviceId>"											\
-		"<Event soap_enc:arrayType=\"cwmp:EventStruct[1]\">"						\
-			"<EventStruct>"										\
-				"<EventCode/>"									\
-				"<CommandKey/>"									\
-			"</EventStruct>"									\
+		"<Event soap_enc:arrayType=\"cwmp:EventStruct[0]\">"						\
 		"</Event>"											\
 		"<MaxEnvelopes>1</MaxEnvelopes>"								\
 		"<CurrentTime/>"										\
diff --git a/src/freecwmp.c b/src/freecwmp.c
index f15cd75..db800c8 100644
--- a/src/freecwmp.c
+++ b/src/freecwmp.c
@@ -25,6 +25,7 @@
 #include "freecwmp.h"
 #include "config.h"
 #include "cwmp/cwmp.h"
+#include "cwmp/event.h"
 #include "ubus/ubus.h"
 
 static void freecwmp_kickoff(struct uloop_timeout *);
@@ -222,6 +223,8 @@ int main (int argc, char **argv)
 		}
 	}
 
+	event_init();
+
 	uloop_init();
 
 	if (config_load()) {
diff --git a/src/xml/xml.c b/src/xml/xml.c
index 05424a5..64932f4 100644
--- a/src/xml/xml.c
+++ b/src/xml/xml.c
@@ -12,6 +12,7 @@
 #include "../freecwmp.h"
 #include "../config.h"
 #include "../cwmp/cwmp.h"
+#include "../cwmp/event.h"
 #include "../cwmp/messages.h"
 #include "../mix/time.h"
 
@@ -124,6 +125,54 @@ xml_exit(void)
 }
 
 int8_t
+xml_prepare_events_inform (mxml_node_t *tree)
+{
+	mxml_node_t *node, *event_node, *cn;
+	char *c, buf[22];
+	uint8_t n = 0;
+	struct list_head *p, *elist = cwmp_get_event_list_head();
+	struct event *event;
+
+	node = mxmlFindElement(tree, tree, "Event", NULL, NULL, MXML_DESCEND);
+
+	event_list_head_mutex_lock();
+	list_for_each(p, elist) {
+		event = list_entry (p, struct event, list);
+		event_node = mxmlNewElement (node, "EventStruct");
+		if (!event_node)
+			goto error;
+		cn = mxmlNewElement (event_node, "EventCode");
+		if (!cn)
+			goto error;
+		cn = mxmlNewText(cn, 0, cwmp_get_event_code(event->code));
+		if (!cn)
+			goto error;
+		cn = mxmlNewElement (event_node, "CommandKey");
+		if (!cn)
+			goto error;
+		if (event->commandKey != NULL) {
+			cn = mxmlNewText(cn, 0, event->commandKey);
+			if (!cn)
+				goto error;
+		}
+		mxmlAdd(node, MXML_ADD_AFTER, MXML_ADD_TO_PARENT, event_node);
+		n++;
+	}
+
+	if (n) {
+		sprintf(buf,"cwmp:EventStruct[%u]", n);
+		mxmlElementSetAttr(node, "soap_enc:arrayType", buf);	/* I - Attribute value */
+	}
+
+	event_list_head_mutex_unlock();
+	return FC_SUCCESS;
+
+error:
+	event_list_head_mutex_unlock();
+	return FC_ERROR;
+}
+
+int8_t
 xml_prepare_inform_message(char **msg_out)
 {
 	FC_DEVEL_DEBUG("enter");
@@ -178,11 +227,7 @@ xml_prepare_inform_message(char **msg_out)
 	if (!busy_node)
 		goto error;
 
-	busy_node = mxmlFindElement(tree, tree, "EventCode", NULL, NULL, MXML_DESCEND);
-	if (!busy_node)
-		goto error;
-	busy_node = mxmlNewText(busy_node, 0, cwmp_get_event_code());
-	if (!busy_node)
+	if (xml_prepare_events_inform(tree) != FC_SUCCESS)
 		goto error;
 
 	busy_node = mxmlFindElement(tree, tree, "CurrentTime", NULL, NULL, MXML_DESCEND);


--------------080801030809090505000308--

From freecwmp@lukaperkov.net Tue Sep 11 19:34:37 2012
Received: with ECARTIS (v1.0.0; list freecwmp); Tue, 11 Sep 2012 19:34:43 +0200 (CEST)
Received: from mail-wi0-f177.google.com ([209.85.212.177]:40457 "EHLO
        mail-wi0-f177.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1903505Ab2IKReh (ORCPT
        <rfc822;freecwmp@linux-mips.org>); Tue, 11 Sep 2012 19:34:37 +0200
Received: by wibhn17 with SMTP id hn17so820625wib.6
        for <freecwmp@linux-mips.org>; Tue, 11 Sep 2012 10:34:31 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=google.com; s=20120113;
        h=date:from:to:cc:subject:message-id:mail-followup-to:references
         :mime-version:content-type:content-disposition:in-reply-to
         :user-agent:x-gm-message-state;
        bh=PBC1mpfezPKWRSNCeTKrVaJaHh/A/cj5XxTR9/hU53g=;
        b=ocHK8HMtIhfHvW1K0+Sm7ruf1loPoxNTxGHObu6fWr1GyylAVE46g/pPGB6Fl5KS2u
         IAyF29rPZfaxpIPJUYJeQ5DYEZlG76SczqHoItD0qjOrP8bfc7qzILDlmkx6DU6Iz9WL
         PsQnpL5OUvlrlIunHI/T3GOU2Qko/4M7kLs/mjriyAxCr6JUvhUS4wSMqglpNgW28dTd
         Iqqu2imrT07+4P52Fdf6A5AQANBsx3bghs5t7R3xaka2Hy6nbxbokpKkA85haefLsH4V
         hdwPqn0Er6aY/weOHKP0PGeY8hoYavQGx6+PIW+jwEzXYZjZoagpkyLDzrK7CD6JdBdT
         Fd1w==
Received: by 10.180.73.76 with SMTP id j12mr16487490wiv.11.1347384871294;
        Tue, 11 Sep 2012 10:34:31 -0700 (PDT)
Received: from localhost (213-191-157-163.dhcp.iskon.hr. [213.191.157.163])
        by mx.google.com with ESMTPS id cl8sm3493105wib.10.2012.09.11.10.34.28
        (version=TLSv1/SSLv3 cipher=OTHER);
        Tue, 11 Sep 2012 10:34:29 -0700 (PDT)
Date:   Tue, 11 Sep 2012 19:34:46 +0200
From:   Luka Perkov <freecwmp@lukaperkov.net>
To:     mohamed.kallel@pivasoftware.com
Cc:     freecwmp@linux-mips.org
Subject: Re: Fwd: Re: patch for the freecwmp project
Message-ID: <20120911173446.GB5103@w500.iskon.local>
Mail-Followup-To: mohamed.kallel@pivasoftware.com, freecwmp@linux-mips.org
References: <5045BBAB.1040207@pivasoftware.com>
 <504EE779.4040802@pivasoftware.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <504EE779.4040802@pivasoftware.com>
User-Agent: Mutt/1.5.21 (2010-09-15)
X-Gm-Message-State: ALoCoQmL6jvFuy6yZY8czFVeTxg7K/vQ6vqQ4HqFmhnJMMjAVddyHVWNIo3eiPwRlGDr28eZnXjB
Return-Path: <freecwmp@lukaperkov.net>
X-Envelope-To: <"|/home/ecartis/ecartis -s freecwmp"> (uid 0)
X-Orcpt: rfc822;freecwmp@linux-mips.org
Original-Recipient: rfc822;freecwmp@linux-mips.org
X-archive-position: 60
X-ecartis-version: Ecartis v1.0.0
Sender: freecwmp-bounce@linux-mips.org
Errors-to: freecwmp-bounce@linux-mips.org
X-original-sender: freecwmp@lukaperkov.net
Precedence: bulk
X-list: freecwmp

Hi Mohamed,

On Tue, Sep 11, 2012 at 08:25:45AM +0100, KALLEL Mohamed wrote:
> Hi Luka
> 
> I'm waiting you feedback concerning the last patch I send.

Yes you are right you did not get our feedback, sorry for that.

Thing is that most of the communication is done on #freecwmp channel. We
have already commented your patch there twice ;)

After I'm done with general changes in freecwmp I will manually merge
your patch and change it if needed.

> I can not go ahead in the next patch (complete the support of many
> events) without getting your git repesotory updated with my last patch
> I send

This is not true. You can continue working on your project using your
branch. Once you think your code is ready for merging rebase it using
upstream master branch and send us a patch.

> Could you please send to me you your feed back (what ever positive
> or negative)

I will merge it this week.

Regards,
Luka


From mohamed.kallel@pivasoftware.com Thu Sep 13 09:25:29 2012
Received: with ECARTIS (v1.0.0; list freecwmp); Thu, 13 Sep 2012 09:25:34 +0200 (CEST)
Received: from moutng.kundenserver.de ([212.227.17.9]:54396 "EHLO
        moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1903356Ab2IMHZ3 (ORCPT
        <rfc822;freecwmp@linux-mips.org>); Thu, 13 Sep 2012 09:25:29 +0200
Received: from [192.168.1.133] ([41.224.250.29])
        by mrelayeu.kundenserver.de (node=mrbap3) with ESMTP (Nemesis)
        id 0M25kJ-1TW3Wk3n8l-00u2t1; Thu, 13 Sep 2012 09:25:22 +0200
Message-ID: <50518A58.6080800@pivasoftware.com>
Date:   Thu, 13 Sep 2012 08:25:12 +0100
From:   KALLEL Mohamed <mohamed.kallel@pivasoftware.com>
User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:15.0) Gecko/20120907 Thunderbird/15.0.1
MIME-Version: 1.0
To:     freecwmp@linux-mips.org, luka.perkov@lukaperkov.net
Subject: Re: Fwd: Re: patch for the freecwmp project
References: <5045BBAB.1040207@pivasoftware.com> <504EE779.4040802@pivasoftware.com> <20120911173446.GB5103@w500.iskon.local>
In-Reply-To: <20120911173446.GB5103@w500.iskon.local>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
X-Provags-ID: V02:K0:rqN+6yFezrVBlhwQpFkExEb8QOn8IqOziu4LGcSi6p/
 WZyWxTAzdgFIDyhYouoQHQyQYOn0vRJ5QB7T/J7RriwLJogmY3
 pYszbpbobqMx3XwVrWG4JVzMJrFrRoDP/FyBQ5fqJ4ZQVosPaF
 xUV3fuxOmaCBwaZllk7VNTIaLOhX3ld9xD6lhIVNlCLmb0y9oD
 8MaNBj4wM+3KIIV0FDXwJ3nTYunsLReyrQhBN788/Wljwp6wQx
 1OUVdtVQvnZmHBkcXozG3Lt+5BnFVdQZBjXoFjXhEV8e4RNfpd
 jPrdSPpNVEU5KRsPURBbVEqQwUv1YHg8DT6SiCQFrNLvP88F0S
 L5Vg4xJwQyz2hZcqKGSqKNAWQOgL9+/5HhdvaP732
Return-Path: <mohamed.kallel@pivasoftware.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s freecwmp"> (uid 0)
X-Orcpt: rfc822;freecwmp@linux-mips.org
Original-Recipient: rfc822;freecwmp@linux-mips.org
X-archive-position: 61
X-ecartis-version: Ecartis v1.0.0
Sender: freecwmp-bounce@linux-mips.org
Errors-to: freecwmp-bounce@linux-mips.org
X-original-sender: mohamed.kallel@pivasoftware.com
Precedence: bulk
X-list: freecwmp

Hi Luka

Thank you for your response
Could you add this line "Contributed by Inteno Broadband Technology AB" 
to the commit message of my patch

Regards

Le 11/09/2012 18:34, Luka Perkov a écrit :
> Hi Mohamed,
>
> On Tue, Sep 11, 2012 at 08:25:45AM +0100, KALLEL Mohamed wrote:
>> Hi Luka
>>
>> I'm waiting you feedback concerning the last patch I send.
> Yes you are right you did not get our feedback, sorry for that.
>
> Thing is that most of the communication is done on #freecwmp channel. We
> have already commented your patch there twice ;)
>
> After I'm done with general changes in freecwmp I will manually merge
> your patch and change it if needed.
>
>> I can not go ahead in the next patch (complete the support of many
>> events) without getting your git repesotory updated with my last patch
>> I send
> This is not true. You can continue working on your project using your
> branch. Once you think your code is ready for merging rebase it using
> upstream master branch and send us a patch.
>
>> Could you please send to me you your feed back (what ever positive
>> or negative)
> I will merge it this week.
>
> Regards,
> Luka
>
>


From freecwmp@lukaperkov.net Fri Sep 14 01:29:50 2012
Received: with ECARTIS (v1.0.0; list freecwmp); Fri, 14 Sep 2012 01:29:54 +0200 (CEST)
Received: from mail-wg0-f43.google.com ([74.125.82.43]:40796 "EHLO
        mail-wg0-f43.google.com" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1903386Ab2IMX3u (ORCPT
        <rfc822;freecwmp@linux-mips.org>); Fri, 14 Sep 2012 01:29:50 +0200
Received: by wgbdq11 with SMTP id dq11so132131wgb.24
        for <freecwmp@linux-mips.org>; Thu, 13 Sep 2012 16:29:45 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=google.com; s=20120113;
        h=date:from:to:cc:subject:message-id:mail-followup-to:references
         :mime-version:content-type:content-disposition:in-reply-to
         :user-agent:x-gm-message-state;
        bh=Lr5RJMEP8CH54/vkkCC/xnj+CpRnyoKv17vnVIfQJZ4=;
        b=ONpnmyhuPY7iNBSFfYqH1+VMuVgooCNrNtbCq2T61Dml4p+u2waDXxPLnqREulAyf+
         CBVmBbDKfR1bSaDgl5WbWHQrZPqHBLIZl6qtbPslUG36RE0HOO9mIkX1ZJCpVN6NQMj1
         Xjgu6WCQM2O2Pv12VuzXN5WQv34egBaAysRBjlBRx5eEOhSeY4GB97e0opj3QfHGCp1W
         4T0fq+X5ZpC7pUhvh9BkZx2w6rEaHAyIWdOUreVR6r89IJRLokPBLkTMT3UalFVBgT0L
         r/BIjZwLpMBV83FdQlbPlrq4fzjA9nU1UBoTh8/5I7wYzj2AUZOiRzpaUy7IwyKCz6wk
         2WAg==
Received: by 10.216.241.198 with SMTP id g48mr389536wer.156.1347578985118;
        Thu, 13 Sep 2012 16:29:45 -0700 (PDT)
Received: from localhost (213-191-157-163.dhcp.iskon.hr. [213.191.157.163])
        by mx.google.com with ESMTPS id q4sm15843844wix.9.2012.09.13.16.29.43
        (version=TLSv1/SSLv3 cipher=OTHER);
        Thu, 13 Sep 2012 16:29:44 -0700 (PDT)
Date:   Fri, 14 Sep 2012 01:30:02 +0200
From:   Luka Perkov <freecwmp@lukaperkov.net>
To:     mohamed.kallel@pivasoftware.com
Cc:     freecwmp@linux-mips.org
Subject: Re: Fwd: Re: patch for the freecwmp project
Message-ID: <20120913233002.GB8376@w500.lan>
Mail-Followup-To: mohamed.kallel@pivasoftware.com, freecwmp@linux-mips.org
References: <5045BBAB.1040207@pivasoftware.com>
 <504EE779.4040802@pivasoftware.com>
 <20120911173446.GB5103@w500.iskon.local>
 <50518A58.6080800@pivasoftware.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <50518A58.6080800@pivasoftware.com>
User-Agent: Mutt/1.5.21 (2010-09-15)
X-Gm-Message-State: ALoCoQnC4SsI3gRaHAeZmqighm98nV3QVgxTrYQwXF3sL9Ffh6+Qj8pnBsirzrW2AyDLvglL3+93
Return-Path: <freecwmp@lukaperkov.net>
X-Envelope-To: <"|/home/ecartis/ecartis -s freecwmp"> (uid 0)
X-Orcpt: rfc822;freecwmp@linux-mips.org
Original-Recipient: rfc822;freecwmp@linux-mips.org
X-archive-position: 62
X-ecartis-version: Ecartis v1.0.0
Sender: freecwmp-bounce@linux-mips.org
Errors-to: freecwmp-bounce@linux-mips.org
X-original-sender: freecwmp@lukaperkov.net
Precedence: bulk
X-list: freecwmp

Hi Mohamed,

On Thu, Sep 13, 2012 at 08:25:12AM +0100, KALLEL Mohamed wrote:
> Could you add this line "Contributed by Inteno Broadband Technology
> AB" to the commit message of my patch

I have applied the patch with changes in e471ec28aefd62cc5f7ebf45374397769f2002db.

Thank you.

Regards,
Luka

From mohamed.kallel@pivasoftware.com Fri Sep 14 11:13:13 2012
Received: with ECARTIS (v1.0.0; list freecwmp); Fri, 14 Sep 2012 11:13:19 +0200 (CEST)
Received: from moutng.kundenserver.de ([212.227.126.187]:54162 "EHLO
        moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK)
        by eddie.linux-mips.org with ESMTP id S1903384Ab2INJNN (ORCPT
        <rfc822;freecwmp@linux-mips.org>); Fri, 14 Sep 2012 11:13:13 +0200
Received: from [192.168.1.133] ([41.224.250.29])
        by mrelayeu.kundenserver.de (node=mreu1) with ESMTP (Nemesis)
        id 0MdZRA-1Stfax0aWC-00Ps08; Fri, 14 Sep 2012 11:13:07 +0200
Message-ID: <5052F515.1030804@pivasoftware.com>
Date:   Fri, 14 Sep 2012 10:12:53 +0100
From:   KALLEL Mohamed <mohamed.kallel@pivasoftware.com>
User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:15.0) Gecko/20120907 Thunderbird/15.0.1
MIME-Version: 1.0
To:     freecwmp@linux-mips.org
Subject: Re: Fwd: Re: patch for the freecwmp project
References: <5045BBAB.1040207@pivasoftware.com> <504EE779.4040802@pivasoftware.com> <20120911173446.GB5103@w500.iskon.local> <50518A58.6080800@pivasoftware.com> <20120913233002.GB8376@w500.lan>
In-Reply-To: <20120913233002.GB8376@w500.lan>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
X-Provags-ID: V02:K0:Lbm4/t4AZIOomkIafWwsHPs8qswfBo7nKlwBW9FMXSw
 2cQ25M2GXGINScVDKo75tfqHTxLn8HnqqvLv/2wqRbDJODYlZv
 Om3gfS6R800nyQgHRRIGeZuNjtXjhp0Cv8w35OVzWfmvtu+Qkg
 Ksu1iCGY8r54Iuslqeh0CkdyjRQ60yc5aC+4dUZr8UNUTIpgdN
 jxde+emcLHzu/ljdPMOsnsWlV4JGtZh5Kd6ScoTHbNv0j6SSUZ
 zXo3dFAeOWSoJZmixK24Fj0OxT0jf01CELYU426aw8KlcraLts
 H1YwvsQ8g8N5VnbT/o+qhi5bni8rfGFjBDLq6dNdt7WSIOWcaJ
 VzwX7Zk5M/ci5eWfb7yiZWL/Yep/K4/QszexTkcQn
Return-Path: <mohamed.kallel@pivasoftware.com>
X-Envelope-To: <"|/home/ecartis/ecartis -s freecwmp"> (uid 0)
X-Orcpt: rfc822;freecwmp@linux-mips.org
Original-Recipient: rfc822;freecwmp@linux-mips.org
X-archive-position: 63
X-ecartis-version: Ecartis v1.0.0
Sender: freecwmp-bounce@linux-mips.org
Errors-to: freecwmp-bounce@linux-mips.org
X-original-sender: mohamed.kallel@pivasoftware.com
Precedence: bulk
X-list: freecwmp

Hi Luka

Good
Thank you

Regards
Mohamed

Le 14/09/2012 00:30, Luka Perkov a écrit :
> Hi Mohamed,
>
> On Thu, Sep 13, 2012 at 08:25:12AM +0100, KALLEL Mohamed wrote:
>> Could you add this line "Contributed by Inteno Broadband Technology
>> AB" to the commit message of my patch
> I have applied the patch with changes in e471ec28aefd62cc5f7ebf45374397769f2002db.
>
> Thank you.
>
> Regards,
> Luka
>


