freecwmp
[Top] [All Lists]

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

To: freecwmp@linux-mips.org
Subject: [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: Mohamed <mohamed.kallel@pivasoftware.com>
Date: Thu, 6 Dec 2012 16:54:38 +0100
Cc: freecwmp@lukaperkov.net, Mohamed <mohamed.kallel@pivasoftware.com>, Ahmed ZRIBI <ahmed.zribi@pivasoftware.com>
In-reply-to: <1354809292-2467-1-git-send-email-mohamed.kallel@pivasoftware.com>
Original-recipient: rfc822;freecwmp@linux-mips.org
References: <mohamed.kallel@pivasoftware.com> <1354809292-2467-1-git-send-email-mohamed.kallel@pivasoftware.com>
Sender: freecwmp-bounce@linux-mips.org
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);
 
        return 0;
 }
-- 
1.7.4.1


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