From f93730e72eeeade82ca72d7a7ad8cde404ef95f1 Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Tue, 17 Apr 2018 18:25:12 +0200 Subject: Handle query result and prepare to forward by API First draft to be able to read at regular interval the TSDB InfluxDB. This prepare a JSON object formated to be handled as an input argument from a regular call to the API verb 'write' Then it is only needed to call the remote verb to forward all the results Change-Id: I80076dd9cf00ba43075d37dd4d15180e63e37289 Signed-off-by: Romain Forlot --- src/utils/list.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/utils/list.c') diff --git a/src/utils/list.c b/src/utils/list.c index bd7eeac..d47f761 100644 --- a/src/utils/list.c +++ b/src/utils/list.c @@ -64,6 +64,20 @@ void add_key(struct list **l, const char *key) } } +int set_value(struct list *l, json_object *val, int index) +{ + int i; + + for (i = 0; i < index; i++) { + l = l->next; + if ( l == NULL ) + return -1; + } + + l->value = val; + return 0; +} + struct list *get_elt(struct list *l, int index) { int i; -- cgit 1.2.3-korg