From: Mohamed <mohamed.kallel@pivasoftware.com>
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 Kallel <mohamed.kallel@pivasoftware.com>
Signed-off-by: Ahmed Zribi <ahmed.zribi@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 6b2031b..f1f5e9f 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 3cc3c69..719a848 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
@@ -65,7 +67,8 @@ freecwmpd_handle_notify(struct ubus_context *ctx, struct
ubus_object *obj,
lfc_log_message(NAME, L_NOTICE, "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
|