freecwmp
[Top] [All Lists]

Re: [PATCH 12/27] update inform in order to get parameters from ubus ins

To: mohamed.kallel@pivasoftware.com
Subject: Re: [PATCH 12/27] update inform in order to get parameters from ubus instead from pipe Contributed by PIVA SOFTWARE
From: Luka Perkov <freecwmp@lukaperkov.net>
Date: Sat, 8 Dec 2012 11:43:08 +0100
Cc: freecwmp@linux-mips.org, ahmed.zribi@pivasoftware.com, freecwmp@lukaperkov.net, jogo@openwrt.org
In-reply-to: <1354809292-2467-13-git-send-email-mohamed.kallel@pivasoftware.com>
Mail-followup-to: mohamed.kallel@pivasoftware.com, freecwmp@linux-mips.org, ahmed.zribi@pivasoftware.com, jogo@openwrt.org
Original-recipient: rfc822;freecwmp@linux-mips.org
References: <mohamed.kallel@pivasoftware.com> <1354809292-2467-1-git-send-email-mohamed.kallel@pivasoftware.com> <1354809292-2467-13-git-send-email-mohamed.kallel@pivasoftware.com>
Sender: freecwmp-bounce@linux-mips.org
User-agent: Mutt/1.5.21 (2010-09-15)
Missing commit message. Contributed by must go in commit message and not
in subject.

On Thu, Dec 06, 2012 at 04:54:37PM +0100, Mohamed wrote:
> 
> Signed-off-by: Ahmed ZRIBI <ahmed.zribi@pivasoftware.com>
> Signed-off-by: Mohamed <mohamed.kallel@pivasoftware.com>
> ---
>  src/xml.c |   40 ++++++++++++++++++----------------------
>  1 files changed, 18 insertions(+), 22 deletions(-)
> 
> diff --git a/src/xml.c b/src/xml.c
> index 23b9ec7..612c0bb 100644
> --- a/src/xml.c
> +++ b/src/xml.c
> @@ -219,6 +219,7 @@ int xml_prepare_inform_message(char **msg_out)
>  {
>       mxml_node_t *tree, *b;
>       char *c, *tmp;
> +     struct external_parameter *external_parameter;
>  
>  #ifdef DUMMY_MODE
>       FILE *fp;
> @@ -337,37 +338,31 @@ int xml_prepare_inform_message(char **msg_out)
>       if (mxmlGetType(b) != MXML_ELEMENT)
>               goto error;
>  
> -     tmp = 
> "InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.ExternalIPAddress";
> -     b = mxmlFindElementText(tree, tree, tmp, MXML_DESCEND);
> -     if (!b) goto error;
> -
> -     b = b->parent->next->next;
> -     if (mxmlGetType(b) != MXML_ELEMENT)
> +     external_get_action_write("value", 
> "InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.ExternalIPAddress",
>  NULL);
> +     external_get_action_write("value", 
> "InternetGatewayDevice.ManagementServer.ConnectionRequestURL", NULL);
> +     if (external_get_action_execute())
>               goto error;
>  
> -     c = NULL;
> -     if (external_get_action("value", tmp, &c)) goto error;
> -     if (c) {
> -             b = mxmlNewText(b, 0, c);
> -             FREE(c);
> -             if (!b) goto error;
> -     }
> -
> -     tmp = "InternetGatewayDevice.ManagementServer.ConnectionRequestURL";
> -     b = mxmlFindElementText(tree, tree, tmp, MXML_DESCEND);
> -     if (!b) goto error;
> +     while (external_list_parameter.next!=&external_list_parameter) {

Missing spaces.

> +             external_parameter = list_entry(external_list_parameter.next, 
> struct external_parameter, list);
> +             b = mxmlFindElementText(tree, tree, external_parameter->name, 
> MXML_DESCEND);
> +             if (!b) continue;
>  
>       b = b->parent->next->next;
>       if (mxmlGetType(b) != MXML_ELEMENT)
>               goto error;
>  
> -     c = NULL;
> -     if (external_get_action("value", tmp, &c)) goto error;
> -     if (c) {
> -             b = mxmlNewText(b, 0, c);
> -             FREE(c);
> +             if (external_parameter->data) {
> +                     b = mxmlNewText(b, 0, external_parameter->data);
>               if (!b) goto error;
>       }

This looks like incorect indenting.

> +             list_del(&external_parameter->list);
> +             free(external_parameter->name);
> +             free(external_parameter->data);
> +             free(external_parameter->type);
> +             free(external_parameter->fault_code);
> +             free(external_parameter);
> +     }
>  
>       if (xml_prepare_notifications_inform(tree))
>               goto error;
> @@ -378,6 +373,7 @@ int xml_prepare_inform_message(char **msg_out)
>       return 0;
>  
>  error:
> +     external_free_list_parameter();
>       mxmlDelete(tree);
>       return -1;
>  }
> -- 
> 1.7.4.1

Luka 

<Prev in Thread] Current Thread [Next in Thread>