freecwmp
[Top] [All Lists]

Re: [PATCH 13/27] Add 3rd argument in the ubus handler of notification.

To: mohamed.kallel@pivasoftware.com
Subject: Re: [PATCH 13/27] Add 3rd argument in the ubus handler of notification. The 3rd argument is the type of the parameter This agument could be used in the response of get parameter attribute Contributed by Inteno Broadband Technology AB
From: Luka Perkov <freecwmp@lukaperkov.net>
Date: Sat, 8 Dec 2012 11:45:01 +0100
Cc: freecwmp@linux-mips.org, ahmed.zribi@pivasoftware.com, freecwmp@lukaperkov.net, jogo@openwrt.org
In-reply-to: <1354809292-2467-14-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-14-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:38PM +0100, Mohamed wrote:
> 
> Signed-off-by: Ahmed ZRIBI <ahmed.zribi@pivasoftware.com>
> Signed-off-by: Mohamed <mohamed.kallel@pivasoftware.com>
> ---
>  src/cwmp.c |    2 +-
>  src/cwmp.h |    2 +-
>  src/ubus.c |    5 ++++-
>  3 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/src/cwmp.c b/src/cwmp.c
> index 1bf9b2a..b75c762 100644
> --- a/src/cwmp.c
> +++ b/src/cwmp.c
> @@ -245,7 +245,7 @@ void cwmp_clear_events(void)
>       pthread_mutex_unlock(&event_lock);
>  }
>  
> -void cwmp_add_notification(char *parameter, char *value)
> +void cwmp_add_notification(char *parameter, char *value, char *type)
>  {
>       char *c = NULL;
>       external_get_action("notification", parameter, &c);
> diff --git a/src/cwmp.h b/src/cwmp.h
> index 5703db0..1d8afac 100644
> --- a/src/cwmp.h
> +++ b/src/cwmp.h
> @@ -52,7 +52,7 @@ void cwmp_add_event(int code, char *key);
>  void cwmp_remove_event(int code);
>  void cwmp_clear_events(void);
>  
> -void cwmp_add_notification(char *parameter, char *value);
> +void cwmp_add_notification(char *parameter, char *value, char *type);
>  void cwmp_clear_notifications(void);
>  
>  int cwmp_set_parameter_write_handler(char *name, char *value);
> diff --git a/src/ubus.c b/src/ubus.c
> index d5437f9..0fd1def 100644
> --- a/src/ubus.c
> +++ b/src/ubus.c
> @@ -38,12 +38,14 @@ static void ubus_freecwmpd_stop_callback(struct 
> uloop_timeout *timeout)
>  static enum notify {
>       NOTIFY_PARAM,
>       NOTIFY_VALUE,
> +     NOTIFY_TYPE,
>       __NOTIFY_MAX
>  };
>  
>  static const struct blobmsg_policy notify_policy[] = {
>       [NOTIFY_PARAM] = { .name = "parameter", .type = BLOBMSG_TYPE_STRING },
>       [NOTIFY_VALUE] = { .name = "value", .type = BLOBMSG_TYPE_STRING },
> +     [NOTIFY_TYPE] = { .name = "type", .type = BLOBMSG_TYPE_STRING },
>  };
>  
>  static int
> @@ -66,7 +68,8 @@ freecwmpd_handle_notify(struct ubus_context *ctx, struct 
> ubus_object *obj,
>                            "triggered ubus notification parameter %s\n",
>                            blobmsg_data(tb[NOTIFY_PARAM]));
>       cwmp_add_notification(blobmsg_data(tb[NOTIFY_PARAM]),
> -                           blobmsg_data(tb[NOTIFY_VALUE]));
> +                     blobmsg_data(tb[NOTIFY_VALUE]),
> +                     tb[NOTIFY_TYPE]? blobmsg_data(tb[NOTIFY_TYPE]) : NULL);

Incorect indentation and missing spaces.

>  
>       return 0;
>  }
> -- 
> 1.7.4.1

Luka 

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