freecwmp
[Top] [All Lists]

ubus data model patch [13/27]

To: freecwmp@linux-mips.org
Subject: ubus data model patch [13/27]
From: KALLEL Mohamed <mohamed.kallel@pivasoftware.com>
Date: Thu, 06 Dec 2012 14:50:36 +0100
Cc: freecwmp@lukaperkov.net
Original-recipient: rfc822;freecwmp@linux-mips.org
Sender: freecwmp-bounce@linux-mips.org
User-agent: Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/17.0 Thunderbird/17.0
Hi Luka

  ubus data model patch [13/27] enclosed

Regards
MOHAMED Kallel

------------------------ubus data model patch [13/27] ---------------------------------


>From 71814340a261a18fd3002a67863ce0fcd295a0bf Mon Sep 17 00:00:00 2001
From: Mohamed <mohamed.kallel@pivasoftware.com>
Date: Sat, 1 Dec 2012 21:20:12 +0100
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


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>
  • ubus data model patch [13/27], KALLEL Mohamed <=