/* * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * Copyright (C) 2012-2014 PIVA SOFTWARE (www.pivasoftware.com) * Author: Imen Bhiri * Author: Feten Besbes * Author: Mohamed Kallel * Author: Anis Ellouze */ #ifndef __UBUS_H #define __UBUS_H #include #include #include #define UBUS_ARGS (struct ubus_arg[]) #define SIMPLE_OUTPUT -1 #define INDENT_OUTPUT 0 #define JSON_OUTPUT SIMPLE_OUTPUT struct dmubus_ctx { struct list_head obj_head; }; struct ubus_obj { struct list_head list; struct list_head method_head; char *name; }; struct ubus_meth { struct list_head list; struct list_head msg_head; char *name; json_object *res; }; struct ubus_msg { struct list_head list; struct ubus_arg *ug; // ubus method param int ug_size; json_object *res; }; struct ubus_arg{ char *key; char *val; int type; }; enum ubus_args_enum { String, Integer, }; extern struct dmubus_ctx dmubus_ctx; extern struct ubus_context *ubus_ctx; #define dm_ubus_get_value(jobj,ARGC,args...) \ dmjson_get_value(jobj, ARGC, ##args) int dmubus_call(char *obj, char *method, struct ubus_arg u_args[], int u_args_size, json_object **req_res); int dmubus_call_set(char *obj, char *method, struct ubus_arg u_args[], int u_args_size); void dmubus_ctx_free(struct dmubus_ctx *ctx); #endif