diff --git a/README.md b/README.md index 9701854f..2024f507 100644 --- a/README.md +++ b/README.md @@ -9,12 +9,12 @@ The root directory of bbfdm library is **“src”** which is structred as follo The bbfdm library offers a tool to generate templates of the source code from json files. ```plain -$ ./convertor_json_to_c.py -Usage: ./convertor_json_to_c.py +$ python convertor_json_to_c.py +Usage: convertor_json_to_c.py Examples: - - ./convertor_json_to_c.py tr181.json + - convertor_json_to_c.py tr181.json ==> Generate the C code of all data model in tr181/ folder - - ./convertor_json_to_c.py tr104.json + - convertor_json_to_c.py tr104.json ==> Generate the C code of all data model in tr104/ folder ``` **Note:** Any developer can full the json file (**tr181.json** or **tr104.json**) with mapping field according to UCI, UBUS or CLI commands before generating the source code in C. @@ -95,7 +95,7 @@ Each object in the **DMOBJ** table contains the following arguments: | `browseinstobj` | This function allow to browse all instances under this object | | `forced_inform` | If it's set to `&DMFINFRM` that mean the object contains a force inform parameter in its subtree. The forced inform parameters are the parameter included in the inform message | | `notification` | The notification of the object. Could be **&DMACTIVE**, **&DMACTIVE** or **&DMNONE** | -| `nextjsonobj` | Pointer to a **DMOBJ** array which contains a list of the child objects using json file | +| `nextdynamicobj` | Pointer to the next of **DMOBJ** which contains a list of the child objects using json files and plugins(libraries) | | `nextobj` | Pointer to a **DMOBJ** array which contains a list of the child objects | | `leaf` | Pointer to a **DMLEAF** array which contains a list of the child objects | | `linker` | This argument is used for LowerLayer parameters or to make reference to other instance object in the tree | @@ -116,7 +116,10 @@ Each parameter in the **DMLEAF** table contains the following arguments: | `notification` | The notification of the parameter. Could be **&DMACTIVE**, **&DMACTIVE** or **&DMNONE** | | `bbfdm_type` | The bbfdm type of the parameter. Could be **BBFDM_CWMP**, **BBFDM_USP** or **BBFDM_NONE**.If it's `BBFDM_NONE` then we can see this parameter in all protocols (CWMP, USP,...) | -## BBFDM API used for GET/SET/ADD/Delete calls ## +## BBFDM API ## + +The bbfdm API is used for GET/SET/ADD/Delete/Operate calls. + It includes list of `UCI` functions. The most used one are as follow: **1. dmuci_get_option_value_string:** execute the uci get value @@ -202,21 +205,25 @@ End of BBF Data Models Generation #### JSON generator: #### It is a generator of json file from C source code. ```plain -$ ./generator_json_with_backend.py -Usage: ./generator_json_with_backend.py [Object path] +$ python generator_json_with_backend.py +Usage: generator_json_with_backend.py [Object path] Examples: - - ./generator_json_with_backend.py tr-181-2-12-0-cwmp-full.xml tr-181-2-12-0-usp-full.xml Device. + - generator_json_with_backend.py tr-181-2-12-0-cwmp-full.xml tr-181-2-12-0-usp-full.xml Device. ==> Generate the json file of the sub tree Device. in tr181.json - - ./generator_json_with_backend.py tr-104-1-1-0-full.xml VoiceService. + - generator_json_with_backend.py tr-104-1-1-0-full.xml VoiceService. ==> Generate the json file of the sub tree VoiceService. in tr104.json - - ./generator_json_with_backend.py tr-106-1-2-0-full.xml Device. + - generator_json_with_backend.py tr-106-1-2-0-full.xml Device. ==> Generate the json file of the sub tree Device. in tr106.json Example of xml data model file: https://www.broadband-forum.org/cwmp/tr-181-2-12-0-cwmp-full.xml ``` -#### Additional dynamic parameters at run time #### -The bbfdm library allows all applications installed on the box to import its own tr-181 data model parameters at run time.
+#### Load additional parameters at run time #### + +The bbfdm library allows all applications installed on the box to import its own tr-181 data model parameters at run time in two formats: **JSON files** and **Plugin(library) files**. + +#### `JSON Files:` #### + The application should bring its JSON file under **'/etc/bbfdm/json/'** path with **UCI** and **UBUS** mappings. The new added parameters will be automatically shown by icwmp and uspd/obuspa. **1. Object without instance:** @@ -394,4 +401,56 @@ The application should bring its JSON file under **'/etc/bbfdm/json/'** path wit } } ``` +#### +#### `Plugin(library) Files:` #### + +The application should bring its plugin(library) file under **'/usr/lib/bbfdm/'** path that contains the sub tree of **Objects/Parameters** and the related functions **Get/Set/Add/Delete/Operate**. The new added objects, parameters and operates will be automatically shown by icwmp and uspd/obuspa. + +To build a new library, you can use **example source code** under **library** folder to help you build it. + +Each library should contains two Root table named **“tRootDynamicObj”** and **“tRootDynamicOperate”** to define the parant path for each new object and operate. + +#### RootDynamicObject definition #### +![object](/pictures/rootdynamicobj.png) + +Each object in the **LIB_MAP_OBJ** table contains two arguments: + +| Argument | Description | +| ------------------- | --------------------------------------------------------------------------------------------------------------------------- | +| `parentobj` | A string of the parent object name. Example “Device.IP.Diagnostics.”, “Device.DeviceInfo”, “Device.WiFi.Radio.” | +| `nextobject` | Pointer to a **DMOBJ** array which contains a list of the child objects. | + +#### RootDynamicOperate definition #### +![object](/pictures/rootdynamincoperate.png) + +Each operate in the **LIB_MAP_OPERATE** table contains two arguments: + +| Argument | Description | +| ------------------- | --------------------------------------------------------------------------------------------------------------------------- | +| `pathname` | A string of the path name operate. Example “Device.BBKSpeedTest”, “Device.WiFi.AccessPoint.*.X_IOPSYS_EU_Reset” | +| `operation` | The function which return the status of this operate. | + +For the other tables, they are defined in the same way as the [Object and Parameter](#object-definition) definition described above. + +**Below are the steps for building of a new library using JSON file** + +**1. Create the json file:** + +Any developer should create a json file containing object requested as defined in the above section of **JSON Files**. You can find an example of json file **example.json** under **library** folder. + +**2. Generate the source code:** + +The bbfdm library offers a tool to generate templates of the library source code from json file. You can find the tool **generate_library.py** under **library** folder. + +```plain +$ python generate_library.py +Usage: generate_library.py +Examples: + - generate_library.py example.json + ==> Generate the C code in example/ folder +``` + +**3. Fill the functions of object/parameter:** + +After building the templates of source code, a **test.c, test.h and Makefile** files will be generated under **test** folder that contains the functions related to each object, parameter and operate. Then, you have to fill each function with the necessary [bbfdm API](#bbfdm-api) defined above. You can find an example of source code **(example folder)** under **library** folder. diff --git a/bin/Makefile.am b/bin/Makefile.am index c1d66dea..1d405820 100644 --- a/bin/Makefile.am +++ b/bin/Makefile.am @@ -1,20 +1,47 @@ LIB_BBFDM_VERSION = 3:0:0 -lib_LTLIBRARIES = libbbfdm.la +lib_LTLIBRARIES = libbbf_api.la + +libbbf_api_la_SOURCES = \ + ../libbbf_api/dmbbf.c \ + ../libbbf_api/dmubus.c \ + ../libbbf_api/dmjson.c \ + ../libbbf_api/dmuci.c \ + ../libbbf_api/dmcommon.c \ + ../libbbf_api/dmmem.c + +libbbf_api_la_CFLAGS = \ + $(AM_CFLAGS) \ + $(LIBUCI_CFLAGS) \ + $(LIBUBOX_CFLAGS) \ + $(LIBUBUS_CFLAGS) + +libbbf_api_la_LDFLAGS = \ + $(AM_LDFLAGS) \ + $(LIBUCI_LDFLAGS) \ + $(LIBUBOX_LDFLAGS) \ + $(LIBUBUS_LDFLAGS) + +libbbf_api_la_LIBADD = \ + $(AM_LIBS) \ + $(LIBUCI_LIBS) \ + $(LIBUBOX_LIBS) \ + $(LIBUBUS_LIBS) \ + $(LIBJSON_LIBS) \ + $(LBLOBMSG_LIBS) + + +lib_LTLIBRARIES += libbbfdm.la libbbfdm_la_SOURCES = \ - ../md5.c \ - ../dmbbf.c \ - ../dmentry.c \ - ../dmmem.c \ - ../dmubus.c \ - ../dmjson.c \ - ../dmuci.c \ - ../dmcommon.c \ - ../dmoperate.c \ - ../dmdiagnostics.c \ + ../dmentry.c \ + ../dmentrylibrary.c \ ../dmentryjson.c \ ../dmmemjson.c \ + ../dmoperate.c \ + ../dmdiagnostics.c \ + ../dmbbfcommon.c \ + ../md5.c \ ../wepkey.c if BBF_TR181 @@ -106,10 +133,10 @@ libbbfdm_la_LIBADD = \ $(LIBUBUS_LIBS) \ $(LIBJSON_LIBS) \ $(LIBTRACE_LIBS) \ - $(LBLOBMSG_LIBS) + $(LBLOBMSG_LIBS) \ + -lbbf_api libbbfdm_la_CFLAGS+=-I../ -libbbfdm_la_CFLAGS+=-I../dmtree/ libbbfdm_la_CFLAGS+=-I../dmtree/tr181 libbbfdm_la_CFLAGS+=-I../dmtree/tr104 libbbfdm_la_CFLAGS+=-I../dmtree/tr143 diff --git a/dmbbfcommon.c b/dmbbfcommon.c new file mode 100644 index 00000000..c365310d --- /dev/null +++ b/dmbbfcommon.c @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2020 iopsys Software Solutions AB + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1 + * as published by the Free Software Foundation + * + * Author Amin Ben Ramdhane + * + */ + +#include "dmbbfcommon.h" + +int bbfdmuci_lookup_ptr(struct uci_context *ctx, struct uci_ptr *ptr, char *package, char *section, char *option, char *value) +{ + return dmuci_lookup_ptr(ctx, ptr, package, section, option, value); +} + +void bbf_apply_end_session(void) +{ + apply_end_session(); +} + +int set_bbfdatamodel_type(int bbf_type) +{ + bbfdatamodel_type = bbf_type; + return 0; +} + +int set_upnp_in_user_mask(unsigned int upnp_user_mask) +{ + upnp_in_user_mask = upnp_user_mask; + return 0; +} + +int bbf_set_ip_version(int ipversion) +{ + ip_version = ipversion; + return 0; +} + +int set_bbf_end_session_flag(int flag) +{ + return (end_session_flag &= flag); +} + +int reset_bbf_end_session_flag(void) +{ + end_session_flag = 0; + return 0; +} + +void bbf_del_list_parameter(struct dm_parameter *dm_parameter) +{ + del_list_parameter(dm_parameter); +} + +void bbf_cwmp_set_end_session (unsigned int flag) +{ + cwmp_set_end_session (flag); +} + +int bbfdm_update_file_enabled_notify(char *param, char *new_value) +{ + return dm_update_file_enabled_notify(param, new_value); +} + +void bbfdmjson_parse_init(char *msg) +{ + dmjson_parse_init(msg); +} + +void bbfdmjson_parse_fini(void) +{ + dmjson_parse_fini(); +} + +json_object *bbfdmjson_select_obj(json_object * jobj, char *argv[]) +{ + return (dmjson_select_obj(jobj, argv)); +} + +void bbf_del_list_fault_param(struct param_fault *param_fault) +{ + del_list_fault_param(param_fault); +} + +int dm_copy_temporary_file_to_original_file(char *f1, char *f2) +{ + return copy_temporary_file_to_original_file(f1, f2); +} + +void bbfdmjson_get_var(char *jkey, char **jval) +{ + dmjson_get_var(jkey, jval); +} + +void bbfdm_update_enabled_notify(struct dm_enabled_notify *p, char *new_value) +{ + dm_update_enabled_notify(p, new_value); +} + +struct list_head get_bbf_list_enabled_lw_notify(void) +{ + return list_enabled_lw_notify; +} diff --git a/dmbbfcommon.h b/dmbbfcommon.h new file mode 100644 index 00000000..fec7df5b --- /dev/null +++ b/dmbbfcommon.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2020 iopsys Software Solutions AB + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1 + * as published by the Free Software Foundation + * + * Author Amin Ben Ramdhane + * + */ + +#include +#include +#include +#include +#include + +int bbfdmuci_lookup_ptr(struct uci_context *ctx, struct uci_ptr *ptr, char *package, char *section, char *option, char *value); +void bbf_apply_end_session(void); +int set_bbfdatamodel_type(int bbf_type); +int set_upnp_in_user_mask(unsigned int upnp_user_mask); +int bbf_set_ip_version(int ipversion); +int set_bbf_end_session_flag(int flag); +int reset_bbf_end_session_flag(void); +void bbf_del_list_parameter(struct dm_parameter *dm_parameter); +void bbf_cwmp_set_end_session (unsigned int flag); +int bbfdm_update_file_enabled_notify(char *param, char *new_value); +void bbfdmjson_parse_init(char *msg); +void bbfdmjson_parse_fini(void); +json_object *bbfdmjson_select_obj(json_object * jobj, char *argv[]); +void bbf_del_list_fault_param(struct param_fault *param_fault); +int dm_copy_temporary_file_to_original_file(char *f1, char *f2); +void bbfdmjson_get_var(char *jkey, char **jval); +void bbfdm_update_enabled_notify(struct dm_enabled_notify *p, char *new_value); +struct list_head get_bbf_list_enabled_lw_notify(void); + diff --git a/dmdiagnostics.c b/dmdiagnostics.c index a23d950e..22ab080e 100644 --- a/dmdiagnostics.c +++ b/dmdiagnostics.c @@ -23,8 +23,7 @@ #include #include #include -#include "dmentry.h" -#include "dmcommon.h" +#include #include "dmdiagnostics.h" int read_next; diff --git a/dmentry.c b/dmentry.c index f7b4f0b7..8107b828 100644 --- a/dmentry.c +++ b/dmentry.c @@ -8,21 +8,23 @@ * Author MOHAMED Kallel * Author Imen Bhiri * Author Feten Besbes + * Author Amin Ben Ramdhane * */ #include #include #include -#include "dmbbf.h" -#include "dmubus.h" -#include "dmuci.h" +#include +#include +#include +#include #include "dmentry.h" +#include "dmentryjson.h" +#include "dmentrylibrary.h" +#include "dmoperate.h" #include "device.h" #include "wepkey.h" -#include "dmcommon.h" -#include "dmoperate.h" -#include "dmentryjson.h" LIST_HEAD(head_package_change); unsigned char dmcli_timetrack = 0; @@ -155,33 +157,21 @@ int dm_ctx_clean_sub(struct dmctx *ctx) return 0; } -void dmentry_instance_lookup_inparam(struct dmctx *ctx) -{ - char *pch, *spch, *in_param; - in_param = dmstrdup(ctx->in_param); - int i = 0; - char pat[2] = {0}; - *pat = dm_delim; - for (pch = strtok_r(in_param, pat, &spch); pch != NULL; pch = strtok_r(NULL, pat, &spch)) { - if (pch[0]== '[') { - ctx->alias_register |= (1 << i); - i++; - } else if (isdigit(pch[0])) { - i++; - } - } - dmfree(in_param); - ctx->nbrof_instance = i; -} - int dm_entry_param_method(struct dmctx *ctx, int cmd, char *inparam, char *arg1, char *arg2) { int fault = 0; bool setnotif = true, alarm = false, event = false; int err, err2; - - if (check_stats_folder(JSON_FOLDER_PATH)) + + if (check_stats_json_folder(JSON_FOLDER_PATH)) { + free_json_dynamic_arrays(tEntry181Obj); load_json_dynamic_arrays(ctx); + } + + if (check_stats_library_folder(LIBRARY_FOLDER_PATH)) { + free_library_dynamic_arrays(tEntry181Obj); + load_library_dynamic_arrays(ctx); + } if (!inparam) inparam = ""; ctx->in_param = inparam; @@ -254,7 +244,7 @@ int dm_entry_param_method(struct dmctx *ctx, int cmd, char *inparam, char *arg1, break; case CMD_USP_OPERATE: ctx->in_value = arg1 ? arg1 : ""; - fault = dm_entry_operate(ctx); + fault = operate_on_node(ctx, ctx->in_param, ctx->in_value); break; #ifdef BBF_TR064 case CMD_UPNP_GET_SUPPORTED_PARAMETERS: @@ -1965,3 +1955,12 @@ invalid_arguments: fprintf(stdout, "Invalid arguments!\n");; } +int free_dynamic_arrays(void) +{ + DMOBJ *root = tEntry181Obj; + DMNODE node = {.current_object = ""}; + free_dm_browse_node_dynamic_object_tree(&node, root); + free_json_dynamic_arrays(tEntry181Obj); + free_library_dynamic_arrays(tEntry181Obj); + return 0; +} diff --git a/dmentry.h b/dmentry.h index 5c59cc11..1f94dc1a 100644 --- a/dmentry.h +++ b/dmentry.h @@ -8,13 +8,14 @@ * Author MOHAMED Kallel * Author Imen Bhiri * Author Feten Besbes + * Author Amin Ben Ramdhane * */ #ifndef __DMENTRY_H__ #define __DMENTRY_H__ -#include "dmbbf.h" +#include extern struct list_head head_package_change; extern unsigned char dmcli_timetrack; extern unsigned char dmcli_evaluatetest; @@ -52,7 +53,7 @@ int dm_ctx_clean_sub(struct dmctx *ctx); void dm_execute_cli_shell(int argc, char** argv, unsigned int dmtype, unsigned int amd_version, unsigned int instance_mode); void dm_execute_cli_command(char *file, unsigned int dmtype, unsigned int amd_version, unsigned int instance_mode); void wepkey_cli(int argc, char** argv); -void dmentry_instance_lookup_inparam(struct dmctx *ctx); +int free_dynamic_arrays(void); #ifdef BBF_TR064 #define DM_ENTRY_UPNP_CHECK_CHANGES(ALARM, EVENT, VERSION) \ diff --git a/dmentryjson.c b/dmentryjson.c index d1f8251f..20547e81 100644 --- a/dmentryjson.c +++ b/dmentryjson.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 iopsys Software Solutions AB + * Copyright (C) 2020 iopsys Software Solutions AB * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 2.1 @@ -14,18 +14,17 @@ #include #include #include -#include "dmcommon.h" -#include "dmuci.h" -#include "dmubus.h" -#include "dmjson.h" +#include +#include +#include +#include #include "dmentryjson.h" #include "dmmemjson.h" -#include "device.h" LIST_HEAD(json_list); static char json_hash[64] = ""; -static int get_stats_folder(char *folder_path, int *file_count, unsigned long *size, unsigned long *date) +static int get_stats_json_folder(char *folder_path, int *file_count, unsigned long *size, unsigned long *date) { struct stat stats; struct dirent *entry; @@ -56,7 +55,7 @@ static int get_stats_folder(char *folder_path, int *file_count, unsigned long *s return 0; } -void add_json_data_to_list(struct list_head *dup_list, char *name, char *arg1, const char *arg2, const char *arg3, const char *arg4, const char *arg5, const char *arg6) +static void add_json_data_to_list(struct list_head *dup_list, char *name, char *arg1, const char *arg2, const char *arg3, const char *arg4, const char *arg5, const char *arg6) { struct dm_json_parameter *dm_json_parameter; dm_json_parameter = dmcallocjson(1, sizeof(struct dm_json_parameter)); @@ -70,7 +69,7 @@ void add_json_data_to_list(struct list_head *dup_list, char *name, char *arg1, c if (arg6) dm_json_parameter->arg6 = dmstrdupjson(arg6); } -void delete_json_data_from_list(struct dm_json_parameter *dm_json_parameter) +static void delete_json_data_from_list(struct dm_json_parameter *dm_json_parameter) { list_del(&dm_json_parameter->list); if (dm_json_parameter->name) dmfreejson(dm_json_parameter->name); @@ -83,7 +82,7 @@ void delete_json_data_from_list(struct dm_json_parameter *dm_json_parameter) if (dm_json_parameter) dmfreejson(dm_json_parameter); } -void free_json_data_from_list(struct list_head *dup_list) +static void free_json_data_from_list(struct list_head *dup_list) { struct dm_json_parameter *dm_json_parameter; while (dup_list->next != dup_list) { @@ -92,13 +91,17 @@ void free_json_data_from_list(struct list_head *dup_list) } } -int dm_browse_node_object_tree(DMNODE *parent_node, DMOBJ *entryobj) +static int dm_browse_node_json_object_tree(DMNODE *parent_node, DMOBJ *entryobj) { if (!entryobj) return 0; for (; entryobj->obj; entryobj++) { - entryobj->nextjsonobj = NULL; + if (entryobj->nextdynamicobj) { + struct dm_dynamic_obj *next_dyn_array = entryobj->nextdynamicobj + INDX_JSON_OBJ_MOUNT; + if (next_dyn_array->nextobj) FREE(next_dyn_array->nextobj); + } + DMNODE node = {0}; node.obj = entryobj; node.parent = parent_node; @@ -106,41 +109,38 @@ int dm_browse_node_object_tree(DMNODE *parent_node, DMOBJ *entryobj) node.matched = parent_node->matched; if (entryobj->nextobj) - dm_browse_node_object_tree(&node, entryobj->nextobj); + dm_browse_node_json_object_tree(&node, entryobj->nextobj); } return 0; } -static int free_node_object_tree(void) +static int free_node_object_tree_dynamic_array(DMOBJ *dm_entryobj) { - DMOBJ *root = tEntry181Obj; + DMOBJ *root = dm_entryobj; DMNODE node = {.current_object = ""}; - dm_browse_node_object_tree(&node, root); + dm_browse_node_json_object_tree(&node, root); return 0; } - -int free_json_dynamic_arrays(void) +int free_json_dynamic_arrays(DMOBJ *dm_entryobj) { free_json_data_from_list(&json_list); dmcleanmemjson(); - free_node_object_tree(); + free_node_object_tree_dynamic_array(dm_entryobj); return 0; } -int check_stats_folder(char *folder_path) +int check_stats_json_folder(char *json_folder_path) { int file_count = 0; unsigned long size = 0, date = 0; char str[64] = ""; - if (!get_stats_folder(folder_path, &file_count, &size, &date)) + if (!get_stats_json_folder(json_folder_path, &file_count, &size, &date)) return 0; sprintf(str, "count:%d,sizes:%lu,date:%lu", file_count, size, date); - if (strcmp(str, json_hash)) { - free_json_dynamic_arrays(); strcpy(json_hash, str); return 1; } @@ -236,53 +236,7 @@ int get_index_of_available_entry(DMOBJ *jentryobj) return idx; } -int plugin_json_obj_match(struct dmctx *dmctx, struct dmnode *node, char *entry_obj, char *full_obj) -{ - if (node->matched) - return 0; - - if (!dmctx->inparam_isparam && strstr(node->current_object, full_obj) == node->current_object) { - node->matched++; - dmctx->findparam = 1; - return 0; - } - - if (strstr(full_obj, node->current_object) == full_obj) - return 0; - - return FAULT_9005; -} - - -void dm_check_obj(struct dmctx *dmctx, DMNODE *parent_node, DMOBJ *entryobj, char *full_obj, char *obj, DMOBJ **root_entry, int *obj_found) -{ - int err = 0; - if (!entryobj) - return; - char *parent_obj = parent_node->current_object; - for (; entryobj->obj; entryobj++) { - DMNODE node = {0}; - node.obj = entryobj; - node.parent = parent_node; - node.instance_level = parent_node->instance_level; - node.matched = parent_node->matched; - dmasprintfjson(&(node.current_object), "%s%s%c", parent_obj, entryobj->obj, dm_delim); - if (strcmp(node.current_object, obj) == 0) { - *root_entry = entryobj; - *obj_found = 1; - return; - } - - err = plugin_json_obj_match(dmctx, &node, entryobj->obj, full_obj); - if (err) - continue; - - if (entryobj->nextobj) - dm_check_obj(dmctx, &node, entryobj->nextobj, full_obj, obj, root_entry, obj_found); - } -} - -int check_root_obj(struct dmctx *ctx, char *in_param_json, DMOBJ **root_entry) +static int check_json_root_obj(struct dmctx *ctx, char *in_param_json, DMOBJ **root_entry) { char *prefix_obj = NULL, *obj = NULL, *full_obj; int prefix_obj_found = 0, obj_found = 0; @@ -296,9 +250,9 @@ int check_root_obj(struct dmctx *ctx, char *in_param_json, DMOBJ **root_entry) else generate_prefixobj_and_obj_full_obj(full_obj, &prefix_obj, &obj); - dm_check_obj(ctx, &node, root, full_obj, prefix_obj, root_entry, &prefix_obj_found); + dm_check_dynamic_obj(ctx, &node, root, full_obj, prefix_obj, root_entry, &prefix_obj_found); if(prefix_obj_found && *root_entry) { - dm_check_obj(ctx, &node, root, full_obj, full_obj, root_entry, &obj_found); + dm_check_dynamic_obj(ctx, &node, root, full_obj, full_obj, root_entry, &obj_found); dmfreejson(full_obj); if(obj_found) return 1; @@ -718,7 +672,7 @@ static void count_obj_param_under_jsonobj(json_object *jsonobj, int *obj_number, static void parse_obj(char *object, json_object *jobj, DMOBJ *pobj, int index, struct list_head *list) { - /* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type(13)*/ + /* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type(13)*/ char *full_obj = NULL, *prfix_obj = NULL, *obj_str = NULL; int obj_number = 0, param_number = 0, i = 0, j = 0; @@ -788,8 +742,8 @@ static void parse_obj(char *object, json_object *jobj, DMOBJ *pobj, int index, s //notification pobj[index].notification = NULL; - //nextjsonobj - pobj[index].nextjsonobj = NULL; + //nextdynamicobj + pobj[index].nextdynamicobj = NULL; //linker pobj[index].get_linker = NULL; @@ -813,28 +767,39 @@ static void parse_obj(char *object, json_object *jobj, DMOBJ *pobj, int index, s static void parse_next_obj(struct dmctx *ctx, json_object *jobj) { + int instance = 0, indx = 0; + json_object_object_foreach(jobj, key, json_obj) { DMOBJ *dm_entryobj = NULL; if (json_object_get_type(json_obj) == json_type_object && is_obj(key, json_obj)) { - int check_obj = check_root_obj(ctx, key, &dm_entryobj); + int check_obj = check_json_root_obj(ctx, key, &dm_entryobj); if (check_obj == 0) continue; if (check_obj == 1) { parse_next_obj(ctx, json_obj); } else { if (!dm_entryobj) continue; - if (dm_entryobj->nextjsonobj == NULL) { - dm_entryobj->nextjsonobj = dmcallocjson(2, sizeof(struct dm_obj_s)); - parse_obj(key, json_obj, dm_entryobj->nextjsonobj, 0, &json_list); + + if (dm_entryobj->nextdynamicobj == NULL) { + dm_entryobj->nextdynamicobj = calloc(__INDX_DYNAMIC_MAX, sizeof(struct dm_dynamic_obj)); + dm_entryobj->nextdynamicobj[INDX_JSON_OBJ_MOUNT].isstatic = 0; + } + + if (dm_entryobj->nextdynamicobj[INDX_JSON_OBJ_MOUNT].nextobj == NULL) { + dm_entryobj->nextdynamicobj[INDX_JSON_OBJ_MOUNT].nextobj = calloc(2, sizeof(struct dm_obj_s *)); + } + + if (dm_entryobj->nextdynamicobj[INDX_JSON_OBJ_MOUNT].nextobj[0] == NULL) { + dm_entryobj->nextdynamicobj[INDX_JSON_OBJ_MOUNT].nextobj[0] = dmcallocjson(2, sizeof(struct dm_obj_s)); + parse_obj(key, jobj, dm_entryobj->nextdynamicobj[INDX_JSON_OBJ_MOUNT].nextobj[0], 0, &json_list); } else { - int idx = get_index_of_available_entry(dm_entryobj->nextjsonobj); - dm_entryobj->nextjsonobj = dmreallocjson(dm_entryobj->nextjsonobj, (idx + 2) * sizeof(struct dm_obj_s)); - memset(dm_entryobj->nextjsonobj + (idx + 1), 0, sizeof(struct dm_obj_s)); - parse_obj(key, json_obj, dm_entryobj->nextjsonobj, idx, &json_list); + int idx = get_index_of_available_entry(dm_entryobj->nextdynamicobj[INDX_JSON_OBJ_MOUNT].nextobj[0]); + dm_entryobj->nextdynamicobj[INDX_JSON_OBJ_MOUNT].nextobj[0] = dmreallocjson(dm_entryobj->nextdynamicobj[INDX_JSON_OBJ_MOUNT].nextobj[0], (idx + 2) * sizeof(struct dm_obj_s)); + memset(dm_entryobj->nextdynamicobj[INDX_JSON_OBJ_MOUNT].nextobj[0] + (idx + 1), 0, sizeof(struct dm_obj_s)); + parse_obj(key, jobj, dm_entryobj->nextdynamicobj[INDX_JSON_OBJ_MOUNT].nextobj[0], idx, &json_list); } } } } - } int load_json_dynamic_arrays(struct dmctx *ctx) @@ -848,28 +813,39 @@ int load_json_dynamic_arrays(struct dmctx *ctx) DMOBJ *dm_entryobj = NULL; json_object *json; char buf[32] = ""; + int instance = 0, indx = 0; sprintf(buf, "%s/%s", JSON_FOLDER_PATH, ent->d_name); json = json_object_from_file(buf); if (!json) continue; json_object_object_foreach(json, key, jobj) { if (!key) break; - int check_obj = check_root_obj(ctx, key, &dm_entryobj); + int check_obj = check_json_root_obj(ctx, key, &dm_entryobj); if (check_obj == 0) continue; if (check_obj == 1) { parse_next_obj(ctx, jobj); continue; } if (!dm_entryobj) continue; - if (dm_entryobj->nextjsonobj == NULL) { - dm_entryobj->nextjsonobj = dmcallocjson(2, sizeof(struct dm_obj_s)); - parse_obj(key, jobj, dm_entryobj->nextjsonobj, 0, &json_list); - } else { - int idx = get_index_of_available_entry(dm_entryobj->nextjsonobj); - dm_entryobj->nextjsonobj = dmreallocjson(dm_entryobj->nextjsonobj, (idx + 2) * sizeof(struct dm_obj_s)); - memset(dm_entryobj->nextjsonobj + (idx + 1), 0, sizeof(struct dm_obj_s)); - parse_obj(key, jobj, dm_entryobj->nextjsonobj, idx, &json_list); + if (dm_entryobj->nextdynamicobj == NULL) { + dm_entryobj->nextdynamicobj = calloc(__INDX_DYNAMIC_MAX, sizeof(struct dm_dynamic_obj)); + dm_entryobj->nextdynamicobj[INDX_JSON_OBJ_MOUNT].isstatic = 0; + dm_entryobj->nextdynamicobj[INDX_LIBRARY_OBJ_MOUNT].isstatic = 1; + } + + if (dm_entryobj->nextdynamicobj[INDX_JSON_OBJ_MOUNT].nextobj == NULL) { + dm_entryobj->nextdynamicobj[INDX_JSON_OBJ_MOUNT].nextobj = calloc(2, sizeof(struct dm_obj_s *)); + } + + if (dm_entryobj->nextdynamicobj[INDX_JSON_OBJ_MOUNT].nextobj[0] == NULL) { + dm_entryobj->nextdynamicobj[INDX_JSON_OBJ_MOUNT].nextobj[0] = dmcallocjson(2, sizeof(struct dm_obj_s)); + parse_obj(key, jobj, dm_entryobj->nextdynamicobj[INDX_JSON_OBJ_MOUNT].nextobj[0], 0, &json_list); + } else { + int idx = get_index_of_available_entry(dm_entryobj->nextdynamicobj[INDX_JSON_OBJ_MOUNT].nextobj[0]); + dm_entryobj->nextdynamicobj[INDX_JSON_OBJ_MOUNT].nextobj[0] = dmreallocjson(dm_entryobj->nextdynamicobj[INDX_JSON_OBJ_MOUNT].nextobj[0], (idx + 2) * sizeof(struct dm_obj_s)); + memset(dm_entryobj->nextdynamicobj[INDX_JSON_OBJ_MOUNT].nextobj[0] + (idx + 1), 0, sizeof(struct dm_obj_s)); + parse_obj(key, jobj, dm_entryobj->nextdynamicobj[INDX_JSON_OBJ_MOUNT].nextobj[0], idx, &json_list); } } if (json) json_object_put(json); diff --git a/dmentryjson.h b/dmentryjson.h index 7caf48dd..732a1274 100644 --- a/dmentryjson.h +++ b/dmentryjson.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 iopsys Software Solutions AB + * Copyright (C) 2020 iopsys Software Solutions AB * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 2.1 @@ -14,8 +14,8 @@ #define JSON_FOLDER_PATH "/etc/bbfdm/json" -int check_stats_folder(char *folder_path); +int check_stats_json_folder(char *json_folder_path); int load_json_dynamic_arrays(struct dmctx *ctx); -int free_json_dynamic_arrays(void); +int free_json_dynamic_arrays(DMOBJ *dm_entryobj); #endif //__DMENTRYJSON_H__ diff --git a/dmentrylibrary.c b/dmentrylibrary.c new file mode 100644 index 00000000..20597051 --- /dev/null +++ b/dmentrylibrary.c @@ -0,0 +1,183 @@ +/* + * Copyright (C) 2020 iopsys Software Solutions AB + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1 + * as published by the Free Software Foundation + * + * Author Amin Ben Ramdhane + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include "dmentrylibrary.h" +#include "dmoperate.h" + +static char library_hash[64] = ""; + +static int get_stats_library_folder(char *folder_path, int *file_count, unsigned long *size, unsigned long *date) +{ + struct stat stats; + struct dirent *entry; + DIR *dirp = NULL; + char buf[256] = {0}; + int filecount = 0; + unsigned long filesize = 0, filedate = 0; + + if (isfolderexist(folder_path)) { + dirp = opendir(folder_path); + while ((entry = readdir(dirp)) != NULL) { + if ((entry->d_type == DT_REG) && (strstr(entry->d_name, ".so"))) { + filecount++; + sprintf(buf, "%s/%s", folder_path, entry->d_name); + if (!stat(buf, &stats)) { + filesize = (filesize + stats.st_size) / 2; + filedate = (filedate + stats.st_mtime) / 2; + } + } + } + if (dirp) closedir(dirp); + + *file_count = filecount; + *size = filesize; + *date = filedate; + return 1; + } + return 0; +} + +int check_stats_library_folder(char *library_folder_path) +{ + int file_count = 0; + unsigned long size = 0, date = 0; + char str[64] = ""; + + if (!get_stats_library_folder(library_folder_path, &file_count, &size, &date)) + return 0; + + sprintf(str, "count:%d,sizes:%lu,date:%lu", file_count, size, date); + if (strcmp(str, library_hash)) { + strcpy(library_hash, str); + return 1; + } + return 0; +} + +static int dm_browse_node_dynamic_object_tree(DMNODE *parent_node, DMOBJ *entryobj) +{ + if (!entryobj) + return 0; + + for (; entryobj->obj; entryobj++) { + if (entryobj->nextdynamicobj) { + struct dm_dynamic_obj *next_dyn_array = entryobj->nextdynamicobj + INDX_LIBRARY_OBJ_MOUNT; + if (next_dyn_array->nextobj) FREE(next_dyn_array->nextobj); + } + + DMNODE node = {0}; + node.obj = entryobj; + node.parent = parent_node; + node.instance_level = parent_node->instance_level; + node.matched = parent_node->matched; + + if (entryobj->nextobj) + dm_browse_node_dynamic_object_tree(&node, entryobj->nextobj); + } + return 0; +} + +int free_library_dynamic_arrays(DMOBJ *dm_entryobj) +{ + DMOBJ *root = dm_entryobj; + DMNODE node = {.current_object = ""}; + dm_browse_node_dynamic_object_tree(&node, root); + FREE(dynamic_operate); + return 0; +} + +static int check_library_root_obj(struct dmctx *ctx, char *in_param, DMOBJ **root_entry) +{ + int obj_found = 0; + DMOBJ *root = ctx->dm_entryobj; + DMNODE node = {.current_object = ""}; + dm_check_dynamic_obj(ctx, &node, root, in_param, in_param, root_entry, &obj_found); + if(obj_found && *root_entry) return 1; + return 0; +} + +static int get_index_of_available_dynamic_array(struct dm_obj_s **jentryobj) +{ + int i, idx = 0; + for (i = 0; jentryobj[i]; i++) { + idx++; + } + return idx; +} + +int load_library_dynamic_arrays(struct dmctx *ctx) +{ + struct dirent *ent; + DIR *dir = NULL; + + if (isfolderexist(LIBRARY_FOLDER_PATH)) { + sysfs_foreach_file(LIBRARY_FOLDER_PATH, dir, ent) { + if (strstr(ent->d_name, ".so")) { + void *handle; + LIB_MAP_OBJ *root_dynamic_obj = NULL; + LIB_MAP_OPERATE *root_dynamic_operate = NULL; + DMOBJ *dm_entryobj = NULL; + char buf[32] = ""; + int i; + + sprintf(buf, "%s/%s", LIBRARY_FOLDER_PATH, ent->d_name); + handle = dlopen(buf, RTLD_LAZY); + if (!handle) continue; + + //Dynamic Object + *(void **) (&root_dynamic_obj) = dlsym(handle, "tRootDynamicObj"); + if(root_dynamic_obj) { + for (i = 0; root_dynamic_obj[i].path; i++) { + if (!root_dynamic_obj[i].root_obj) continue; + int check_obj = check_library_root_obj(ctx, root_dynamic_obj[i].path, &dm_entryobj); + if ((check_obj == 0) || (!dm_entryobj)) continue; + + if (dm_entryobj->nextdynamicobj == NULL) { + dm_entryobj->nextdynamicobj = calloc(__INDX_DYNAMIC_MAX, sizeof(struct dm_dynamic_obj)); + dm_entryobj->nextdynamicobj[INDX_JSON_OBJ_MOUNT].isstatic = 0; + dm_entryobj->nextdynamicobj[INDX_LIBRARY_OBJ_MOUNT].isstatic = 1; + } + + if (dm_entryobj->nextdynamicobj[INDX_LIBRARY_OBJ_MOUNT].nextobj == NULL) { + dm_entryobj->nextdynamicobj[INDX_LIBRARY_OBJ_MOUNT].nextobj = calloc(2, sizeof(struct dm_obj_s *)); + dm_entryobj->nextdynamicobj[INDX_LIBRARY_OBJ_MOUNT].nextobj[0] = root_dynamic_obj[i].root_obj; + } else { + int idx = get_index_of_available_dynamic_array(dm_entryobj->nextdynamicobj[INDX_LIBRARY_OBJ_MOUNT].nextobj); + dm_entryobj->nextdynamicobj[INDX_LIBRARY_OBJ_MOUNT].nextobj = realloc(dm_entryobj->nextdynamicobj[INDX_LIBRARY_OBJ_MOUNT].nextobj, (idx + 2) * sizeof(struct dm_obj_s *)); + dm_entryobj->nextdynamicobj[INDX_LIBRARY_OBJ_MOUNT].nextobj[idx] = root_dynamic_obj[i].root_obj; + dm_entryobj->nextdynamicobj[INDX_LIBRARY_OBJ_MOUNT].nextobj[idx+1] = NULL; + } + } + } + + //Dynamic Operate + *(void **) (&root_dynamic_operate) = dlsym(handle, "tRootDynamicOperate"); + if(root_dynamic_operate) { + for (i = 0; root_dynamic_operate[i].path; i++) { + if (root_dynamic_operate[i].operate) + add_dynamic_operate(root_dynamic_operate[i].path, root_dynamic_operate[i].operate); + } + } + + if (handle) dlclose(handle); + } + } + if (dir) closedir(dir); + } + return 0; +} diff --git a/dmentrylibrary.h b/dmentrylibrary.h new file mode 100644 index 00000000..0ae16322 --- /dev/null +++ b/dmentrylibrary.h @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2020 iopsys Software Solutions AB + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1 + * as published by the Free Software Foundation + * + * Author Amin Ben Ramdhane + * + */ + +#ifndef __DMENTRYLIBRARY_H__ +#define __DMENTRYLIBRARY_H__ + +#define LIBRARY_FOLDER_PATH "/usr/lib/bbfdm" + +int check_stats_library_folder(char *library_folder_path); +int load_library_dynamic_arrays(struct dmctx *ctx); +int free_library_dynamic_arrays(DMOBJ *dm_entryobj); + +#endif //__DMENTRYLIBRARY_H__ diff --git a/dmoperate.c b/dmoperate.c index 92bf787d..bbd6693e 100644 --- a/dmoperate.c +++ b/dmoperate.c @@ -13,22 +13,12 @@ * */ -#include -#include -#include -#include -#include "dmbbf.h" -#include "dmubus.h" -#include "dmuci.h" -#include "dmjson.h" -#include "dmentry.h" -#include "dmcommon.h" #include "dmoperate.h" -#include "dmdiagnostics.h" #define GLOB_EXPR "[=><]+" static uint8_t wifi_neighbor_count = 0; +struct op_cmd *dynamic_operate = NULL; bool match(const char *string, const char *pattern) { @@ -224,7 +214,7 @@ struct wifi_security_params reset_params[] = { static opr_ret_t ap_security_reset(struct dmctx *dmctx, char *path, char *input) { char *wpakey = NULL; - char node[MAXNAMLEN] = {'\0'}; + char node[255] = {'\0'}; int i, len = 0; char *ret = strrchr(path, '.'); @@ -233,20 +223,20 @@ static opr_ret_t ap_security_reset(struct dmctx *dmctx, char *path, char *input) len = ARRAY_SIZE(reset_params); for (i = 0; i < len; i++) { - strncpy(reset_params[i].node, node, MAXNAMLEN); + strncpy(reset_params[i].node, node, 255); strcat(reset_params[i].node, reset_params[i].param); } const char *mode_enabled = "WPA2-Personal"; // Default mode - WPA2-Personal - strncpy(reset_params[0].value, mode_enabled, MAXNAMLEN); + strncpy(reset_params[0].value, mode_enabled, 255); // Get Default wpakey db_get_value_string("hw", "board", "wpaKey", &wpakey); // PreSharedKey and KeyPassphrase are kept same - strncpy(reset_params[1].value, wpakey, MAXNAMLEN); - strncpy(reset_params[2].value, wpakey, MAXNAMLEN); + strncpy(reset_params[1].value, wpakey, 255); + strncpy(reset_params[2].value, wpakey, 255); for (i = 0; i < len; i++) { bbf_set_value(reset_params[i].node, reset_params[i].value); @@ -807,6 +797,31 @@ static opr_ret_t ip_diagnostics_nslookup(struct dmctx *dmctx, char *path, char * return SUCCESS; } +static int get_index_of_available_dynamic_operate(struct op_cmd *operate) +{ + int idx = 0; + for (; (operate && operate->name); operate++) { + idx++; + } + return idx; +} + +int add_dynamic_operate(char *path, operation operate) +{ + if (dynamic_operate == NULL) { + dynamic_operate = calloc(2, sizeof(struct op_cmd)); + dynamic_operate[0].name = path; + dynamic_operate[0].opt = operate; + } else { + int idx = get_index_of_available_dynamic_operate(dynamic_operate); + dynamic_operate = realloc(dynamic_operate, (idx + 2) * sizeof(struct op_cmd)); + memset(dynamic_operate + (idx + 1), 0, sizeof(struct op_cmd)); + dynamic_operate[idx].name = path; + dynamic_operate[idx].opt = operate; + } + return 0; +} + static struct op_cmd operate_helper[] = { {"Device.Reboot", reboot_device}, {"Device.FactoryReset", factory_reset}, @@ -829,15 +844,26 @@ static struct op_cmd operate_helper[] = { {"Device.DNS.Diagnostics.NSLookupDiagnostics", ip_diagnostics_nslookup} }; -int operate_on_node(struct dmctx *dmctx, char *path, char *input) +opr_ret_t operate_on_node(struct dmctx *dmctx, char *path, char *input) { - uint8_t len = 0; + uint8_t len = 0, i; + struct op_cmd *save_pointer = NULL; + if (dynamic_operate) save_pointer = dynamic_operate; len = ARRAY_SIZE(operate_helper); - for(uint8_t i=0; iname); dynamic_operate++) { + if (match(path, dynamic_operate->name)) { + opr_ret_t res = dynamic_operate->opt(dmctx, path, input); + if (save_pointer) dynamic_operate = save_pointer; + return res; } } + if (save_pointer) dynamic_operate = save_pointer; + return CMD_NOT_FOUND; } diff --git a/dmoperate.h b/dmoperate.h index 28f542eb..7f33955b 100644 --- a/dmoperate.h +++ b/dmoperate.h @@ -16,7 +16,18 @@ #ifndef __DMOPERATE_H__ #define __DMOPERATE_H__ +#include +#include +#include +#include #include +#include +#include +#include +#include +#include +#include "dmentry.h" +#include "dmdiagnostics.h" #define SYSTEM_UBUS_PATH "system" #define NETWORK_INTERFACE_UBUS_PATH "network.interface" @@ -25,22 +36,12 @@ #define ICWMP_SCRIPT "/usr/sbin/icwmp" #define VCF_FILE_TYPE "3" -enum operate_ret_status{ - UBUS_INVALID_ARGUMENTS, - SUCCESS, - FAIL, - CMD_NOT_FOUND, - __STATUS_MAX, -}; - -typedef enum operate_ret_status opr_ret_t; - -typedef opr_ret_t (*operation) (struct dmctx *dmctx, char *p, char *input); +extern struct op_cmd *dynamic_operate; struct wifi_security_params { - char node[MAXNAMLEN]; + char node[255]; char *param; - char value[MAXNAMLEN]; + char value[255]; }; struct file_server { @@ -216,6 +217,7 @@ struct op_cmd { operation opt; }; -int operate_on_node(struct dmctx *dmctx, char *path, char *input); +int add_dynamic_operate(char *path, operation operate); +opr_ret_t operate_on_node(struct dmctx *dmctx, char *path, char *input); #endif diff --git a/dmtree/tr104/voice_services.c b/dmtree/tr104/voice_services.c index 054d2dda..25bbd2cb 100644 --- a/dmtree/tr104/voice_services.c +++ b/dmtree/tr104/voice_services.c @@ -13,23 +13,23 @@ #include #include #include -#include "dmbbf.h" -#include "dmuci.h" -#include "dmubus.h" -#include "dmcommon.h" +#include +#include +#include +#include +#include #include "voice_services.h" -#include "dmjson.h" /* *** Device.Services. *** */ DMOBJ tServicesObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"VoiceService", &DMREAD, NULL, NULL, NULL, browseVoiceServiceInst, NULL, NULL, NULL, tServicesVoiceServiceObj, tServicesVoiceServiceParams, NULL, BBFDM_BOTH}, {0} }; /* *** Device.Services.VoiceService.{i}. *** */ DMOBJ tServicesVoiceServiceObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Capabilities", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceCapabilitiesObj, tServicesVoiceServiceCapabilitiesParams, NULL, BBFDM_BOTH}, {"VoiceProfile", &DMWRITE, add_profile_object, delete_profile_object, NULL, browseProfileInst, NULL, NULL, NULL, tServicesVoiceServiceVoiceProfileObj, tServicesVoiceServiceVoiceProfileParams, NULL, BBFDM_BOTH}, {0} @@ -43,7 +43,7 @@ DMLEAF tServicesVoiceServiceParams[] = { /* *** Device.Services.VoiceService.{i}.Capabilities. *** */ DMOBJ tServicesVoiceServiceCapabilitiesObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"SIP", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceCapabilitiesSIPParams, NULL, BBFDM_BOTH}, {"Codecs", &DMREAD, NULL, NULL, NULL, browseCodecsInst, NULL, NULL, NULL, NULL, tServicesVoiceServiceCapabilitiesCodecsParams, NULL, BBFDM_BOTH}, {0} @@ -111,7 +111,7 @@ DMLEAF tServicesVoiceServiceCapabilitiesCodecsParams[] = { /* *** Device.Services.VoiceService.{i}.VoiceProfile.{i}. *** */ DMOBJ tServicesVoiceServiceVoiceProfileObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"SIP", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceVoiceProfileSIPParams, NULL, BBFDM_BOTH}, {"ServiceProviderInfo", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceVoiceProfileServiceProviderInfoParams, NULL, BBFDM_BOTH}, {"FaxT38", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceVoiceProfileFaxT38Params, NULL, BBFDM_BOTH}, @@ -172,7 +172,7 @@ DMLEAF tServicesVoiceServiceVoiceProfileFaxT38Params[] = { /* *** Device.Services.VoiceService.{i}.VoiceProfile.{i}.RTP. *** */ DMOBJ tServicesVoiceServiceVoiceProfileRTPObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"RTCP", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceVoiceProfileRTPRTCPParams, NULL, BBFDM_BOTH}, {"SRTP", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceVoiceProfileRTPSRTPParams, NULL, BBFDM_BOTH}, {0} @@ -203,7 +203,7 @@ DMLEAF tServicesVoiceServiceVoiceProfileRTPSRTPParams[] = { /* *** Device.Services.VoiceService.{i}.VoiceProfile.{i}.Line.{i}. *** */ DMOBJ tServicesVoiceServiceVoiceProfileLineObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"VoiceProcessing", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceVoiceProfileLineVoiceProcessingParams, NULL, BBFDM_BOTH}, {"CallingFeatures", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceVoiceProfileLineCallingFeaturesParams, NULL, BBFDM_BOTH}, {"SIP", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceVoiceProfileLineSIPParams, NULL, BBFDM_BOTH}, @@ -250,7 +250,7 @@ DMLEAF tServicesVoiceServiceVoiceProfileLineSIPParams[] = { /* *** Device.Services.VoiceService.{i}.VoiceProfile.{i}.Line.{i}.Codec. *** */ DMOBJ tServicesVoiceServiceVoiceProfileLineCodecObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"List", &DMREAD, NULL, NULL, NULL, browseLineCodecListInst, NULL, NULL, NULL, NULL, tServicesVoiceServiceVoiceProfileLineCodecListParams, NULL, BBFDM_BOTH}, {0} }; diff --git a/dmtree/tr143/diagnostics.c b/dmtree/tr143/diagnostics.c index 28fee0ac..a938d3e1 100644 --- a/dmtree/tr143/diagnostics.c +++ b/dmtree/tr143/diagnostics.c @@ -12,17 +12,17 @@ #include #include #include -#include "dmuci.h" -#include "dmubus.h" -#include "dmbbf.h" -#include "dmcommon.h" -#include "dmjson.h" +#include +#include +#include +#include +#include #include "dmentry.h" #include "diagnostics.h" /* *** Device.IP.Diagnostics. *** */ DMOBJ tIPDiagnosticsObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"IPPing", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tIPDiagnosticsIPPingParams, NULL, BBFDM_CWMP}, {"TraceRoute", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tIPDiagnosticsTraceRouteObj, tIPDiagnosticsTraceRouteParams, NULL, BBFDM_CWMP}, {"DownloadDiagnostics", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tIPDiagnosticsDownloadDiagnosticsObj, tIPDiagnosticsDownloadDiagnosticsParams, NULL, BBFDM_CWMP}, @@ -74,7 +74,7 @@ DMLEAF tIPDiagnosticsIPPingParams[] = { /* *** Device.IP.Diagnostics.TraceRoute. *** */ DMOBJ tIPDiagnosticsTraceRouteObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"RouteHops", &DMREAD, NULL, NULL, NULL, browseIPDiagnosticsTraceRouteRouteHopsInst, NULL, NULL, NULL, NULL, tIPDiagnosticsTraceRouteRouteHopsParams, NULL, BBFDM_CWMP}, {0} }; @@ -107,7 +107,7 @@ DMLEAF tIPDiagnosticsTraceRouteRouteHopsParams[] = { /* *** Device.IP.Diagnostics.DownloadDiagnostics. *** */ DMOBJ tIPDiagnosticsDownloadDiagnosticsObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"PerConnectionResult", &DMREAD, NULL, NULL, NULL, browseIPDiagnosticsDownloadDiagnosticsPerConnectionResultInst, NULL, NULL, NULL, NULL, tIPDiagnosticsDownloadDiagnosticsPerConnectionResultParams, NULL, BBFDM_CWMP}, {0} }; @@ -156,7 +156,7 @@ DMLEAF tIPDiagnosticsDownloadDiagnosticsPerConnectionResultParams[] = { /* *** Device.IP.Diagnostics.UploadDiagnostics. *** */ DMOBJ tIPDiagnosticsUploadDiagnosticsObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"PerConnectionResult", &DMREAD, NULL, NULL, NULL, browseIPDiagnosticsUploadDiagnosticsPerConnectionResultInst, NULL, NULL, NULL, NULL, tIPDiagnosticsUploadDiagnosticsPerConnectionResultParams, NULL, BBFDM_CWMP}, {0} }; diff --git a/dmtree/tr157/bulkdata.c b/dmtree/tr157/bulkdata.c index 7f570ebc..1d922002 100644 --- a/dmtree/tr157/bulkdata.c +++ b/dmtree/tr157/bulkdata.c @@ -8,17 +8,17 @@ * Author: Amin Ben Ramdhane */ -#include "dmbbf.h" -#include "dmcommon.h" -#include "dmuci.h" -#include "dmubus.h" -#include "dmjson.h" -#include "dmentry.h" +#include +#include +#include +#include +#include +//#include "dmentry.h" #include "bulkdata.h" /* *** Device.BulkData. *** */ DMOBJ tBulkDataObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Profile", &DMWRITE, addObjBulkDataProfile, delObjBulkDataProfile, NULL, browseBulkDataProfileInst, NULL, NULL, NULL, tBulkDataProfileObj, tBulkDataProfileParams, NULL, BBFDM_BOTH}, {0} }; @@ -39,7 +39,7 @@ DMLEAF tBulkDataParams[] = { /* *** Device.BulkData.Profile.{i}. *** */ DMOBJ tBulkDataProfileObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Parameter", &DMWRITE, addObjBulkDataProfileParameter, delObjBulkDataProfileParameter, NULL, browseBulkDataProfileParameterInst, NULL, NULL, NULL, NULL, tBulkDataProfileParameterParams, NULL, BBFDM_BOTH}, {"CSVEncoding", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tBulkDataProfileCSVEncodingParams, NULL, BBFDM_BOTH}, {"JSONEncoding", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tBulkDataProfileJSONEncodingParams, NULL, BBFDM_BOTH}, @@ -98,7 +98,7 @@ DMLEAF tBulkDataProfileJSONEncodingParams[] = { /* *** Device.BulkData.Profile.{i}.HTTP. *** */ DMOBJ tBulkDataProfileHTTPObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"RequestURIParameter", &DMWRITE, addObjBulkDataProfileHTTPRequestURIParameter, delObjBulkDataProfileHTTPRequestURIParameter, NULL, browseBulkDataProfileHTTPRequestURIParameterInst, NULL, NULL, NULL, NULL, tBulkDataProfileHTTPRequestURIParameterParams, NULL, BBFDM_BOTH}, {0} }; diff --git a/dmtree/tr157/softwaremodules.c b/dmtree/tr157/softwaremodules.c index 65bfa4a1..a2029eae 100644 --- a/dmtree/tr157/softwaremodules.c +++ b/dmtree/tr157/softwaremodules.c @@ -8,17 +8,17 @@ * Author: Amin Ben Ramdhane */ -#include "dmbbf.h" -#include "dmcommon.h" -#include "dmuci.h" -#include "dmubus.h" -#include "dmjson.h" +#include +#include +#include +#include +#include #include "dmentry.h" #include "softwaremodules.h" /* *** Device.SoftwareModules. *** */ DMOBJ tSoftwareModulesObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"ExecEnv", &DMREAD, NULL, NULL, NULL, browseSoftwareModulesExecEnvInst, NULL, NULL, NULL, NULL, tSoftwareModulesExecEnvParams, get_exe_cenv_linker, BBFDM_BOTH}, {"DeploymentUnit", &DMREAD, NULL, NULL, NULL, browseSoftwareModulesDeploymentUnitInst, NULL, NULL, NULL, NULL, tSoftwareModulesDeploymentUnitParams, get_du_linker, BBFDM_BOTH}, {"ExecutionUnit", &DMREAD, NULL, NULL, NULL, browseSoftwareModulesExecutionUnitInst, NULL, NULL, NULL, tSoftwareModulesExecutionUnitObj, tSoftwareModulesExecutionUnitParams, NULL, BBFDM_BOTH}, @@ -80,7 +80,7 @@ DMLEAF tSoftwareModulesDeploymentUnitParams[] = { /* *** Device.SoftwareModules.ExecutionUnit.{i}. *** */ DMOBJ tSoftwareModulesExecutionUnitObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Extensions", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, BBFDM_BOTH}, {0} }; diff --git a/dmtree/tr181/atm.c b/dmtree/tr181/atm.c index 8f780fb2..a66a8b43 100644 --- a/dmtree/tr181/atm.c +++ b/dmtree/tr181/atm.c @@ -11,24 +11,24 @@ #include #include -#include "dmbbf.h" -#include "dmuci.h" -#include "dmubus.h" -#include "dmcommon.h" -#include "atm.h" -#include "dmjson.h" +#include +#include +#include +#include +#include #include "dmentry.h" +#include "atm.h" /*** ATM. ***/ DMOBJ tATMObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Link", &DMWRITE, add_atm_link, delete_atm_link, NULL, browseAtmLinkInst, NULL, NULL, NULL, tATMLinkObj, tATMLinkParams, get_atm_linker, BBFDM_BOTH}, {0} }; /*** ATM.Link. ***/ DMOBJ tATMLinkObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tATMLinkStatsParams, NULL, BBFDM_BOTH}, {0} }; diff --git a/dmtree/tr181/bridging.c b/dmtree/tr181/bridging.c index 30ccb78e..3ef81dbe 100644 --- a/dmtree/tr181/bridging.c +++ b/dmtree/tr181/bridging.c @@ -12,19 +12,19 @@ #include #include -#include "dmbbf.h" -#include "dmuci.h" -#include "dmubus.h" -#include "dmcommon.h" -#include "bridging.h" -#include "dmjson.h" +#include +#include +#include +#include +#include #include "dmentry.h" +#include "bridging.h" static char *wan_baseifname = NULL; /*** Bridging. ***/ DMOBJ tBridgingObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Bridge", &DMWRITE, add_bridge, delete_bridge, NULL, browseBridgeInst, NULL, NULL, NULL, tBridgingBridgeObj, tBridgingBridgeParams, NULL, BBFDM_BOTH}, {0} }; @@ -43,7 +43,7 @@ DMLEAF tBridgingParams[] = { /*** Bridging.Bridge.{i}. ***/ DMOBJ tBridgingBridgeObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Port", &DMWRITE, add_br_port, delete_br_port, NULL, browseBridgePortInst, NULL, NULL, NULL, tBridgingBridgePortObj, tBridgingBridgePortParams, get_linker_br_port, BBFDM_BOTH}, {"VLAN", &DMWRITE, add_br_vlan, delete_br_vlan, NULL, browseBridgeVlanInst, NULL, NULL, NULL, NULL, tBridgingBridgeVLANParams, get_linker_br_vlan, BBFDM_BOTH}, {"VLANPort", &DMREAD, NULL, NULL, NULL, browseBridgeVlanPortInst, NULL, NULL, NULL, NULL, tBridgingBridgeVLANPortParams, NULL, BBFDM_BOTH}, @@ -65,7 +65,7 @@ DMLEAF tBridgingBridgeParams[] = { /*** Bridging.Bridge.{i}.Port.{i}. ***/ DMOBJ tBridgingBridgePortObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tBridgingBridgePortStatsParams, NULL, BBFDM_BOTH}, {0} }; diff --git a/dmtree/tr181/datamodelversion.h b/dmtree/tr181/datamodelversion.h index 04f2ceb5..063efe1e 100644 --- a/dmtree/tr181/datamodelversion.h +++ b/dmtree/tr181/datamodelversion.h @@ -11,8 +11,8 @@ #ifndef __DATAMODELVERSION_H #define __DATAMODELVERSION_H -#include "dmbbf.h" -#include "dmcommon.h" +#include +#include int get_Device_RootDataModelVersion(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); diff --git a/dmtree/tr181/device.c b/dmtree/tr181/device.c index 35fd33c0..b1c62ff8 100644 --- a/dmtree/tr181/device.c +++ b/dmtree/tr181/device.c @@ -10,8 +10,8 @@ * Author: Amin Ben Ramdhane */ -#include "dmuci.h" -#include "dmbbf.h" +#include +#include #include "device.h" #include "deviceinfo.h" #include "managementserver.h" @@ -61,7 +61,7 @@ /* *** BBFDM *** */ DMOBJ tEntry181Obj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Device", &DMREAD, NULL, NULL, NULL, NULL, &DMFINFRM, &DMNONE, NULL, tRoot_181_Obj, tRoot_181_Params, NULL, BBFDM_BOTH}, {0} }; @@ -74,7 +74,7 @@ DMLEAF tRoot_181_Params[] = { }; DMOBJ tRoot_181_Obj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"DeviceInfo", &DMREAD, NULL, NULL, NULL, NULL, &DMFINFRM, &DMNONE, NULL, tDeviceInfoObj, tDeviceInfoParams, NULL, BBFDM_BOTH}, {"ManagementServer", &DMREAD, NULL, NULL, NULL, NULL, &DMFINFRM, &DMNONE, NULL, NULL, tManagementServerParams, NULL, BBFDM_BOTH}, {"Time", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE, NULL, NULL, tTimeParams, NULL, BBFDM_BOTH}, diff --git a/dmtree/tr181/deviceinfo.c b/dmtree/tr181/deviceinfo.c index 8284770c..3da3b373 100644 --- a/dmtree/tr181/deviceinfo.c +++ b/dmtree/tr181/deviceinfo.c @@ -16,16 +16,16 @@ #include #include #include -#include "dmbbf.h" -#include "dmuci.h" -#include "dmcommon.h" +#include +#include +#include #include "deviceinfo.h" -#include "dmjson.h" -#include "dmubus.h" +#include +#include /* *** Device.DeviceInfo. *** */ DMOBJ tDeviceInfoObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {CUSTOM_PREFIX"CATV", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tCatTvParams, NULL, BBFDM_BOTH}, {"VendorConfigFile", &DMREAD, NULL, NULL, NULL, browseVcfInst, NULL, NULL, NULL, NULL, tDeviceInfoVendorConfigFileParams, NULL, BBFDM_BOTH}, {"VendorLogFile", &DMREAD, NULL, NULL, NULL, browseVlfInst, NULL, NULL, NULL, NULL, tDeviceInfoVendorLogFileParams, NULL, BBFDM_BOTH}, @@ -75,7 +75,7 @@ DMLEAF tDeviceInfoMemoryStatusParams[] = { /* *** Device.DeviceInfo.ProcessStatus. *** */ DMOBJ tDeviceInfoProcessStatusObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Process", &DMREAD, NULL, NULL, NULL, browsePocessEntriesInst, NULL, NULL, NULL, NULL, tDeviceInfoProcessStatusProcessParams, NULL, BBFDM_BOTH}, {0} }; diff --git a/dmtree/tr181/deviceinfo.h b/dmtree/tr181/deviceinfo.h index 91bc3cbe..93d9c8b7 100644 --- a/dmtree/tr181/deviceinfo.h +++ b/dmtree/tr181/deviceinfo.h @@ -12,7 +12,7 @@ #ifndef __DEVICE_INFO_H #define __DEVICE_INFO_H -#include "dmbbf.h" +#include #define UPTIME "/proc/uptime" #define DEFAULT_CONFIG_DIR "/etc/config/" diff --git a/dmtree/tr181/dhcpv4.c b/dmtree/tr181/dhcpv4.c index e977074e..ed82754c 100644 --- a/dmtree/tr181/dhcpv4.c +++ b/dmtree/tr181/dhcpv4.c @@ -14,18 +14,19 @@ #include #include #include -#include "dmuci.h" -#include "dmubus.h" -#include "dmbbf.h" -#include "dmcommon.h" -#include "dhcpv4.h" -#include "dmjson.h" +#include +#include +#include +#include +#include #include "dmentry.h" +#include "dhcpv4.h" + #define DELIMITOR "," /*** DHCPv4. ***/ DMOBJ tDHCPv4Obj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Client", &DMWRITE, addObjDHCPv4Client, delObjDHCPv4Client, NULL, browseDHCPv4ClientInst, NULL, NULL, NULL, tDHCPv4ClientObj, tDHCPv4ClientParams, NULL, BBFDM_BOTH}, {"Server", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tDHCPv4ServerObj, tDHCPv4ServerParams, NULL, BBFDM_BOTH}, {"Relay", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tDHCPv4RelayObj, tDHCPv4RelayParams, NULL, BBFDM_BOTH}, @@ -40,7 +41,7 @@ DMLEAF tDHCPv4Params[] = { /* *** Device.DHCPv4.Client.{i}. *** */ DMOBJ tDHCPv4ClientObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"SentOption", &DMWRITE, addObjDHCPv4ClientSentOption, delObjDHCPv4ClientSentOption, NULL, browseDHCPv4ClientSentOptionInst, NULL, NULL, NULL, NULL, tDHCPv4ClientSentOptionParams, NULL, BBFDM_BOTH}, {"ReqOption", &DMWRITE, addObjDHCPv4ClientReqOption, delObjDHCPv4ClientReqOption, NULL, browseDHCPv4ClientReqOptionInst, NULL, NULL, NULL, NULL, tDHCPv4ClientReqOptionParams, NULL, BBFDM_BOTH}, {0} @@ -97,14 +98,14 @@ DMLEAF tDHCPv4ServerParams[] = { /*** DHCPv4.Server. ***/ DMOBJ tDHCPv4ServerObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Pool", &DMWRITE, add_dhcp_server, delete_dhcp_server, NULL, browseDhcpInst, NULL, NULL, NULL, tDHCPv4ServerPoolObj, tDHCPv4ServerPoolParams, NULL, BBFDM_BOTH}, {0} }; /*** DHCPv4.Server.Pool.{i}. ***/ DMOBJ tDHCPv4ServerPoolObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"StaticAddress", &DMWRITE, add_dhcp_staticaddress, delete_dhcp_staticaddress, NULL, browseDhcpStaticInst, NULL, NULL, NULL, NULL, tDHCPv4ServerPoolAddressParams, NULL, BBFDM_BOTH}, {"Option", &DMWRITE, addObjDHCPv4ServerPoolOption, delObjDHCPv4ServerPoolOption, NULL, browseDHCPv4ServerPoolOptionInst, NULL, NULL, NULL, NULL, tDHCPv4ServerPoolOptionParams, NULL, BBFDM_BOTH}, {"Client", &DMREAD, NULL, NULL, NULL, browseDhcpClientInst, NULL, NULL, NULL, tDHCPv4ServerPoolClientObj, tDHCPv4ServerPoolClientParams, get_dhcp_client_linker}, @@ -113,7 +114,7 @@ DMOBJ tDHCPv4ServerPoolObj[] = { /*** DHCPv4.Server.Pool.{i}.Client.{i}. ***/ DMOBJ tDHCPv4ServerPoolClientObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"IPv4Address", &DMREAD, NULL, NULL, NULL, browseDhcpClientIPv4Inst, NULL, NULL, NULL, NULL, tDHCPv4ServerPoolClientIPv4AddressParams, NULL, BBFDM_BOTH}, {"Option", &DMREAD, NULL, NULL, NULL, browseDHCPv4ServerPoolClientOptionInst, NULL, NULL, NULL, NULL, tDHCPv4ServerPoolClientOptionParams, NULL, BBFDM_BOTH}, {0} @@ -186,7 +187,7 @@ DMLEAF tDHCPv4ServerPoolClientOptionParams[] = { /* *** Device.DHCPv4.Relay. *** */ DMOBJ tDHCPv4RelayObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Forwarding", &DMWRITE, addObjDHCPv4RelayForwarding, delObjDHCPv4RelayForwarding, NULL, browseDHCPv4RelayForwardingInst, NULL, NULL, NULL, NULL, tDHCPv4RelayForwardingParams, NULL, BBFDM_BOTH}, {0} }; diff --git a/dmtree/tr181/dhcpv6.c b/dmtree/tr181/dhcpv6.c index 9a26c64b..f5fb38a2 100644 --- a/dmtree/tr181/dhcpv6.c +++ b/dmtree/tr181/dhcpv6.c @@ -11,18 +11,19 @@ #include #include #include -#include "dmuci.h" -#include "dmubus.h" -#include "dmbbf.h" -#include "dmcommon.h" +#include +#include +#include +#include +#include #include "dmentry.h" #include "dhcpv4.h" #include "dhcpv6.h" -#include "dmjson.h" + /* *** Device.DHCPv6. *** */ DMOBJ tDHCPv6Obj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Client", &DMWRITE, addObjDHCPv6Client, delObjDHCPv6Client, NULL, browseDHCPv6ClientInst, NULL, NULL, NULL, tDHCPv6ClientObj, tDHCPv6ClientParams, NULL, BBFDM_BOTH}, {"Server", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tDHCPv6ServerObj, tDHCPv6ServerParams, NULL, BBFDM_BOTH}, {0} @@ -36,7 +37,7 @@ DMLEAF tDHCPv6Params[] = { /* *** Device.DHCPv6.Client.{i}. *** */ DMOBJ tDHCPv6ClientObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Server", &DMREAD, NULL, NULL, NULL, browseDHCPv6ClientServerInst, NULL, NULL, NULL, NULL, tDHCPv6ClientServerParams, NULL, BBFDM_BOTH}, {"SentOption", &DMWRITE, addObjDHCPv6ClientSentOption, delObjDHCPv6ClientSentOption, NULL, browseDHCPv6ClientSentOptionInst, NULL, NULL, NULL, NULL, tDHCPv6ClientSentOptionParams, NULL, BBFDM_BOTH}, {"ReceivedOption", &DMREAD, NULL, NULL, NULL, browseDHCPv6ClientReceivedOptionInst, NULL, NULL, NULL, NULL, tDHCPv6ClientReceivedOptionParams, NULL, BBFDM_BOTH}, @@ -94,7 +95,7 @@ DMLEAF tDHCPv6ClientReceivedOptionParams[] = { /* *** Device.DHCPv6.Server. *** */ DMOBJ tDHCPv6ServerObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Pool", &DMWRITE, addObjDHCPv6ServerPool, delObjDHCPv6ServerPool, NULL, browseDHCPv6ServerPoolInst, NULL, NULL, NULL, tDHCPv6ServerPoolObj, tDHCPv6ServerPoolParams, NULL, BBFDM_BOTH}, {0} }; @@ -108,7 +109,7 @@ DMLEAF tDHCPv6ServerParams[] = { /* *** Device.DHCPv6.Server.Pool.{i}. *** */ DMOBJ tDHCPv6ServerPoolObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Client", &DMREAD, NULL, NULL, NULL, browseDHCPv6ServerPoolClientInst, NULL, NULL, NULL, tDHCPv6ServerPoolClientObj, tDHCPv6ServerPoolClientParams, NULL, BBFDM_BOTH}, {"Option", &DMWRITE, addObjDHCPv6ServerPoolOption, delObjDHCPv6ServerPoolOption, NULL, browseDHCPv6ServerPoolOptionInst, NULL, NULL, NULL, NULL, tDHCPv6ServerPoolOptionParams, NULL, BBFDM_BOTH}, {0} @@ -144,7 +145,7 @@ DMLEAF tDHCPv6ServerPoolParams[] = { /* *** Device.DHCPv6.Server.Pool.{i}.Client.{i}. *** */ DMOBJ tDHCPv6ServerPoolClientObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"IPv6Address", &DMREAD, NULL, NULL, NULL, browseDHCPv6ServerPoolClientIPv6AddressInst, NULL, NULL, NULL, NULL, tDHCPv6ServerPoolClientIPv6AddressParams, NULL, BBFDM_BOTH}, {"IPv6Prefix", &DMREAD, NULL, NULL, NULL, browseDHCPv6ServerPoolClientIPv6PrefixInst, NULL, NULL, NULL, NULL, tDHCPv6ServerPoolClientIPv6PrefixParams, NULL, BBFDM_BOTH}, {"Option", &DMREAD, NULL, NULL, NULL, browseDHCPv6ServerPoolClientOptionInst, NULL, NULL, NULL, NULL, tDHCPv6ServerPoolClientOptionParams, NULL, BBFDM_BOTH}, diff --git a/dmtree/tr181/dns.c b/dmtree/tr181/dns.c index d631695f..e4070ef2 100644 --- a/dmtree/tr181/dns.c +++ b/dmtree/tr181/dns.c @@ -8,17 +8,17 @@ * Author: Amin Ben Ramdhane */ -#include "dmuci.h" -#include "dmubus.h" -#include "dmbbf.h" -#include "dmcommon.h" -#include "dmjson.h" +#include +#include +#include +#include +#include #include "dmentry.h" #include "dns.h" /* *** Device.DNS. *** */ DMOBJ tDNSObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Client", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tDNSClientObj, tDNSClientParams, NULL, BBFDM_BOTH}, {"Relay", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tDNSRelayObj, tDNSRelayParams, NULL, BBFDM_BOTH}, {"Diagnostics", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tDNSDiagnosticsObj, NULL, NULL, BBFDM_BOTH}, @@ -33,7 +33,7 @@ DMLEAF tDNSParams[] = { /* *** Device.DNS.Client. *** */ DMOBJ tDNSClientObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Server", &DMWRITE, add_client_server, delete_client_server, NULL, browseServerInst, NULL, NULL, NULL, NULL, tDNSClientServerParams, NULL, BBFDM_BOTH}, {0} }; @@ -60,7 +60,7 @@ DMLEAF tDNSClientServerParams[] = { /* *** Device.DNS.Relay. *** */ DMOBJ tDNSRelayObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Forwarding", &DMWRITE, add_relay_forwarding, delete_relay_forwarding, NULL, browseRelayForwardingInst, NULL, NULL, NULL, NULL, tDNSRelayForwardingParams, NULL, BBFDM_BOTH}, {0} }; @@ -87,14 +87,14 @@ DMLEAF tDNSRelayForwardingParams[] = { /* *** Device.DNS.Diagnostics. *** */ DMOBJ tDNSDiagnosticsObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"NSLookupDiagnostics", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tDNSDiagnosticsNSLookupDiagnosticsObj, tDNSDiagnosticsNSLookupDiagnosticsParams, NULL, BBFDM_BOTH}, {0} }; /* *** Device.DNS.Diagnostics.NSLookupDiagnostics. *** */ DMOBJ tDNSDiagnosticsNSLookupDiagnosticsObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Result", &DMREAD, NULL, NULL, NULL, browseResultInst, NULL, NULL, NULL, NULL, tDNSDiagnosticsNSLookupDiagnosticsResultParams, NULL, BBFDM_BOTH}, {0} }; diff --git a/dmtree/tr181/dsl.c b/dmtree/tr181/dsl.c index aa6a60d3..f29e2231 100644 --- a/dmtree/tr181/dsl.c +++ b/dmtree/tr181/dsl.c @@ -11,11 +11,11 @@ #include #include #include -#include "dmuci.h" -#include "dmubus.h" -#include "dmbbf.h" -#include "dmcommon.h" -#include "dmjson.h" +#include +#include +#include +#include +#include #include "dmentry.h" #include "dsl.h" @@ -23,7 +23,7 @@ /* *** Device.DSL. *** */ DMOBJ tDSLObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Line", &DMREAD, NULL, NULL, NULL, browseDSLLineInst, NULL, NULL, NULL, tDSLLineObj, tDSLLineParams, get_dsl_line_linker, BBFDM_BOTH}, {"Channel", &DMREAD, NULL, NULL, NULL, browseDSLChannelInst, NULL, NULL, NULL, tDSLChannelObj, tDSLChannelParams, get_dsl_channel_linker, BBFDM_BOTH}, {0} @@ -38,7 +38,7 @@ DMLEAF tDSLParams[] = { /* *** Device.DSL.Line.{i}. *** */ DMOBJ tDSLLineObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tDSLLineStatsObj, tDSLLineStatsParams, NULL, BBFDM_BOTH}, {0} }; @@ -98,7 +98,7 @@ DMLEAF tDSLLineParams[] = { /* *** Device.DSL.Line.{i}.Stats. *** */ DMOBJ tDSLLineStatsObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Total", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tDSLLineStatsTotalParams, NULL, BBFDM_BOTH}, {"Showtime", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tDSLLineStatsShowtimeParams, NULL, BBFDM_BOTH}, {"LastShowtime", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tDSLLineStatsLastShowtimeParams, NULL, BBFDM_BOTH}, @@ -159,7 +159,7 @@ DMLEAF tDSLLineStatsQuarterHourParams[] = { /* *** Device.DSL.Channel.{i}. *** */ DMOBJ tDSLChannelObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tDSLChannelStatsObj, tDSLChannelStatsParams, NULL, BBFDM_BOTH}, {0} }; @@ -191,7 +191,7 @@ DMLEAF tDSLChannelParams[] = { /* *** Device.DSL.Channel.{i}.Stats. *** */ DMOBJ tDSLChannelStatsObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Total", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tDSLChannelStatsTotalParams, NULL, BBFDM_BOTH}, {"Showtime", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tDSLChannelStatsShowtimeParams, NULL, BBFDM_BOTH}, {"LastShowtime", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tDSLChannelStatsLastShowtimeParams, NULL, BBFDM_BOTH}, diff --git a/dmtree/tr181/dynamicdns.c b/dmtree/tr181/dynamicdns.c index e9ff9387..6f722e97 100644 --- a/dmtree/tr181/dynamicdns.c +++ b/dmtree/tr181/dynamicdns.c @@ -9,17 +9,17 @@ */ #include -#include "dmbbf.h" -#include "dmcommon.h" -#include "dmuci.h" -#include "dmubus.h" -#include "dmjson.h" +#include +#include +#include +#include +#include #include "dmentry.h" #include "dynamicdns.h" /* *** Device.DynamicDNS. *** */ DMOBJ tDynamicDNSObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Client", &DMWRITE, addObjDynamicDNSClient, delObjDynamicDNSClient, NULL, browseDynamicDNSClientInst, NULL, NULL, NULL, tDynamicDNSClientObj, tDynamicDNSClientParams, NULL, BBFDM_BOTH}, {"Server", &DMWRITE, addObjDynamicDNSServer, delObjDynamicDNSServer, NULL, browseDynamicDNSServerInst, NULL, NULL, NULL, NULL, tDynamicDNSServerParams, get_linker_dynamicdns_server, BBFDM_BOTH}, {0} @@ -35,7 +35,7 @@ DMLEAF tDynamicDNSParams[] = { /* *** Device.DynamicDNS.Client.{i}. *** */ DMOBJ tDynamicDNSClientObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Hostname", &DMWRITE, NULL, NULL, NULL, browseDynamicDNSClientHostnameInst, NULL, NULL, NULL, NULL, tDynamicDNSClientHostnameParams, NULL, BBFDM_BOTH}, {0} }; diff --git a/dmtree/tr181/ethernet.c b/dmtree/tr181/ethernet.c index c518a164..87182c27 100644 --- a/dmtree/tr181/ethernet.c +++ b/dmtree/tr181/ethernet.c @@ -13,19 +13,19 @@ #include #include #include -#include "dmuci.h" -#include "dmubus.h" -#include "dmbbf.h" -#include "dmcommon.h" -#include "ethernet.h" -#include "dmjson.h" +#include +#include +#include +#include +#include #include "dmentry.h" +#include "ethernet.h" char *wan_ifname = NULL; /* *** Device.Ethernet. *** */ DMOBJ tEthernetObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Interface", &DMREAD, NULL, NULL, NULL, browseEthernetInterfaceInst, NULL, NULL, NULL, tEthernetInterfaceObj, tEthernetInterfaceParams, get_linker_interface, BBFDM_BOTH}, {"Link", &DMWRITE, addObjEthernetLink, delObjEthernetLink, NULL, browseEthernetLinkInst, NULL, NULL, NULL, tEthernetLinkObj, tEthernetLinkParams, get_linker_link, BBFDM_BOTH}, {"VLANTermination", &DMWRITE, addObjEthernetVLANTermination, delObjEthernetVLANTermination, NULL, browseEthernetVLANTerminationInst, NULL, NULL, NULL, tEthernetVLANTerminationObj, tEthernetVLANTerminationParams, get_linker_vlan_term, BBFDM_BOTH}, @@ -42,7 +42,7 @@ DMLEAF tEthernetParams[] = { /* *** Device.Ethernet.Interface.{i}. *** */ DMOBJ tEthernetInterfaceObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tEthernetInterfaceStatsParams, NULL, BBFDM_BOTH}, {0} }; @@ -87,7 +87,7 @@ DMLEAF tEthernetInterfaceStatsParams[] = { /* *** Device.Ethernet.Link.{i}. *** */ DMOBJ tEthernetLinkObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tEthernetLinkStatsParams, NULL, BBFDM_BOTH}, {0} }; @@ -127,7 +127,7 @@ DMLEAF tEthernetLinkStatsParams[] = { /* *** Device.Ethernet.VLANTermination.{i}. *** */ DMOBJ tEthernetVLANTerminationObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tEthernetVLANTerminationStatsParams, NULL, BBFDM_BOTH}, {0} }; diff --git a/dmtree/tr181/firewall.c b/dmtree/tr181/firewall.c index efd52172..14508865 100644 --- a/dmtree/tr181/firewall.c +++ b/dmtree/tr181/firewall.c @@ -8,14 +8,14 @@ * Author: Omar Kallel */ -#include "dmbbf.h" -#include "firewall.h" -#include "dmcommon.h" +#include +#include #include "dmentry.h" +#include "firewall.h" /* *** Device.Firewall. *** */ DMOBJ tFirewallObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Level", &DMREAD, NULL, NULL, NULL, browseLevelInst, NULL, NULL, NULL, NULL, tFirewallLevelParams, NULL, BBFDM_BOTH}, {"Chain", &DMREAD, NULL, NULL, NULL, browseChainInst, NULL, NULL, NULL, tFirewallChainObj, tFirewallChainParams, NULL, BBFDM_BOTH}, {0} @@ -44,7 +44,7 @@ DMLEAF tFirewallLevelParams[] = { /* *** Device.Firewall.Chain.{i}. *** */ DMOBJ tFirewallChainObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Rule", &DMWRITE, add_firewall_rule, delete_firewall_rule, NULL, browseRuleInst, NULL, NULL, NULL, tFirewallChainRuleObj, tFirewallChainRuleParams, NULL, BBFDM_BOTH}, {0} }; @@ -60,7 +60,7 @@ DMLEAF tFirewallChainParams[] = { /* *** Device.Firewall.Chain.{i}.Rule.{i}. *** */ DMOBJ tFirewallChainRuleObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {CUSTOM_PREFIX"TimeSpan", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tTimeSpanParams, NULL, BBFDM_BOTH}, {0} }; diff --git a/dmtree/tr181/gre.c b/dmtree/tr181/gre.c index 993cb0e4..c88c088e 100644 --- a/dmtree/tr181/gre.c +++ b/dmtree/tr181/gre.c @@ -10,12 +10,11 @@ #include #include -#include "dmbbf.h" -#include "dmcommon.h" -#include "dmuci.h" -#include "dmubus.h" -#include "dmjson.h" -#include "dmentry.h" +#include +#include +#include +#include +#include #include "gre.h" /* *** Device.GRE. *** */ diff --git a/dmtree/tr181/hosts.c b/dmtree/tr181/hosts.c index 381e9ebb..aa7fdf9e 100644 --- a/dmtree/tr181/hosts.c +++ b/dmtree/tr181/hosts.c @@ -12,17 +12,17 @@ #include #include #include -#include "dmuci.h" -#include "dmubus.h" -#include "dmbbf.h" -#include "dmcommon.h" -#include "hosts.h" -#include "dmjson.h" +#include +#include +#include +#include +#include #include "dmentry.h" +#include "hosts.h" /* *** Device.Hosts. *** */ DMOBJ tHostsObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Host", &DMREAD, NULL, NULL, NULL, browsehostInst, NULL, NULL, NULL, NULL, tHostsHostParams, NULL, BBFDM_BOTH}, {0} }; diff --git a/dmtree/tr181/interfacestack.c b/dmtree/tr181/interfacestack.c index 83bd71df..376eea41 100644 --- a/dmtree/tr181/interfacestack.c +++ b/dmtree/tr181/interfacestack.c @@ -8,10 +8,10 @@ * Author: Amin Ben Ramdhane */ -#include "dmbbf.h" -#include "dmcommon.h" -#include "dmubus.h" -#include "dmjson.h" +#include +#include +#include +#include #include "dmentry.h" #include "interfacestack.h" diff --git a/dmtree/tr181/ip.c b/dmtree/tr181/ip.c index 2a01a350..66fd18b1 100644 --- a/dmtree/tr181/ip.c +++ b/dmtree/tr181/ip.c @@ -13,12 +13,12 @@ #include #include #include -#include "dmuci.h" -#include "dmubus.h" -#include "dmbbf.h" -#include "dmcommon.h" +#include +#include +#include +#include +#include #include "ip.h" -#include "dmjson.h" #include "dmentry.h" #ifdef BBF_TR143 #include "diagnostics.h" @@ -29,7 +29,7 @@ struct dm_forced_inform_s IPv6INFRM = {0, get_ipv6_finform}; /* *** Device.IP. *** */ DMOBJ tIPObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Interface", &DMWRITE, add_ip_interface, delete_ip_interface, NULL, browseIPIfaceInst, NULL, NULL, NULL, tIPInterfaceObj, tIPInterfaceParams, get_linker_ip_interface, BBFDM_BOTH}, #ifdef BBF_TR143 {"Diagnostics", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tIPDiagnosticsObj, tIPDiagnosticsParams, NULL, BBFDM_BOTH}, @@ -52,7 +52,7 @@ DMLEAF tIPParams[] = { /* *** Device.IP.Interface. *** */ DMOBJ tIPInterfaceObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"IPv4Address", &DMWRITE, add_ipv4, delete_ipv4, NULL, browseIfaceIPv4Inst, NULL, NULL, NULL, NULL, tIPInterfaceIPv4AddressParams, NULL, BBFDM_BOTH}, {"IPv6Address", &DMWRITE, add_ipv6, delete_ipv6, NULL, browseIfaceIPv6Inst, NULL, NULL, NULL, NULL, tIPInterfaceIPv6AddressParams, NULL, BBFDM_BOTH}, {"IPv6Prefix", &DMWRITE, add_ipv6_prefix, delete_ipv6_prefix, NULL, browseIfaceIPv6PrefixInst, NULL, NULL, NULL, NULL, tIPInterfaceIPv6PrefixParams, get_linker_ipv6_prefix, BBFDM_BOTH}, diff --git a/dmtree/tr181/managementserver.c b/dmtree/tr181/managementserver.c index 40f12dc6..f0aed4b9 100644 --- a/dmtree/tr181/managementserver.c +++ b/dmtree/tr181/managementserver.c @@ -14,13 +14,13 @@ #include #include #include -#include "dmmem.h" -#include "dmbbf.h" -#include "dmuci.h" -#include "dmubus.h" -#include "dmcommon.h" +#include +#include +#include +#include +#include +#include #include "managementserver.h" -#include "dmjson.h" #define DEFAULT_ACSURL "http://192.168.1.1:8080/openacs/acs" diff --git a/dmtree/tr181/managementserver.h b/dmtree/tr181/managementserver.h index 382d6c30..164b4158 100644 --- a/dmtree/tr181/managementserver.h +++ b/dmtree/tr181/managementserver.h @@ -11,7 +11,7 @@ #ifndef __MANAGEMENT_SERVER_H #define __MANAGEMENT_SERVER_H -#include "dmbbf.h" +#include extern DMLEAF tManagementServerParams[]; int get_management_server_url(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); diff --git a/dmtree/tr181/nat.c b/dmtree/tr181/nat.c index 9c676926..803f676f 100644 --- a/dmtree/tr181/nat.c +++ b/dmtree/tr181/nat.c @@ -13,16 +13,16 @@ #include #include #include -#include "dmuci.h" -#include "dmubus.h" -#include "dmbbf.h" -#include "dmcommon.h" +#include +#include +#include +#include #include "dmentry.h" #include "nat.h" /* *** Device.NAT. *** */ DMOBJ tNATObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"InterfaceSetting", &DMWRITE, add_NAT_InterfaceSetting, delete_NAT_InterfaceSetting, NULL, browseInterfaceSettingInst, NULL, NULL, NULL, NULL, tNATInterfaceSettingParams, NULL, BBFDM_BOTH}, {"PortMapping", &DMWRITE, add_NAT_PortMapping, delete_NAT_PortMapping, NULL, browsePortMappingInst, NULL, NULL, NULL, NULL, tNATPortMappingParams, NULL, BBFDM_BOTH}, {0} diff --git a/dmtree/tr181/ppp.c b/dmtree/tr181/ppp.c index fa2fe8b5..2a8f3bfd 100644 --- a/dmtree/tr181/ppp.c +++ b/dmtree/tr181/ppp.c @@ -12,17 +12,17 @@ #include #include #include -#include "dmuci.h" -#include "dmubus.h" -#include "dmbbf.h" -#include "dmjson.h" -#include "dmcommon.h" +#include +#include +#include +#include +#include #include "dmentry.h" #include "ppp.h" /* *** Device.PPP. *** */ DMOBJ tPPPObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Interface", &DMWRITE, add_ppp_interface, delete_ppp_interface, NULL, browseInterfaceInst, NULL, NULL, NULL, tPPPInterfaceObj, tPPPInterfaceParams, get_linker_ppp_interface, BBFDM_BOTH}, {0} }; @@ -35,7 +35,7 @@ DMLEAF tPPPParams[] = { /* *** Device.PPP.Interface.{i}. *** */ DMOBJ tPPPInterfaceObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"PPPoE", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tPPPInterfacePPPoEParams, NULL, BBFDM_BOTH}, {"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tPPPInterfaceStatsParams, NULL, BBFDM_BOTH}, {0} diff --git a/dmtree/tr181/ptm.c b/dmtree/tr181/ptm.c index d0c9c81c..76c24d2f 100644 --- a/dmtree/tr181/ptm.c +++ b/dmtree/tr181/ptm.c @@ -11,24 +11,24 @@ #include #include -#include "dmbbf.h" -#include "dmuci.h" -#include "dmubus.h" -#include "dmcommon.h" -#include "ptm.h" -#include "dmjson.h" +#include +#include +#include +#include +#include #include "dmentry.h" +#include "ptm.h" /* *** Device.PTM. *** */ DMOBJ tPTMObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Link", &DMWRITE, add_ptm_link, delete_ptm_link, NULL, browsePtmLinkInst, NULL, NULL, NULL, tPTMLinkObj, tPTMLinkParams, get_ptm_linker, BBFDM_BOTH}, {0} }; /* *** Device.PTM.Link.{i}. *** */ DMOBJ tPTMLinkObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tPTMLinkStatsParams, NULL, BBFDM_BOTH}, {0} }; diff --git a/dmtree/tr181/qos.c b/dmtree/tr181/qos.c index c1feaab2..b8ab2449 100644 --- a/dmtree/tr181/qos.c +++ b/dmtree/tr181/qos.c @@ -8,16 +8,16 @@ * Author: Omar Kallel */ -#include "dmbbf.h" -#include "dmcommon.h" -#include "dmentry.h" -#include "dmuci.h" -#include "qos.h" #include +#include +#include +#include +#include "dmentry.h" +#include "qos.h" /* *** Device.QoS. *** */ DMOBJ tQoSObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Classification", &DMWRITE, addObjQoSClassification, delObjQoSClassification, NULL, browseQoSClassificationInst, NULL, NULL, NULL, NULL, tQoSClassificationParams, NULL, BBFDM_BOTH}, {"App", &DMWRITE, addObjQoSApp, delObjQoSApp, NULL, browseQoSAppInst, NULL, NULL, NULL, NULL, tQoSAppParams, NULL, BBFDM_BOTH}, {"Flow", &DMWRITE, addObjQoSFlow, delObjQoSFlow, NULL, browseQoSFlowInst, NULL, NULL, NULL, NULL, tQoSFlowParams, NULL, BBFDM_BOTH}, diff --git a/dmtree/tr181/routing.c b/dmtree/tr181/routing.c index bb12245d..86beb187 100644 --- a/dmtree/tr181/routing.c +++ b/dmtree/tr181/routing.c @@ -14,12 +14,12 @@ #include #include #include -#include "dmbbf.h" -#include "dmuci.h" -#include "dmubus.h" -#include "dmcommon.h" +#include +#include +#include +#include +#include #include "routing.h" -#include "dmjson.h" #include "dmentry.h" enum enum_route_type { @@ -30,7 +30,7 @@ enum enum_route_type { /* *** Device.Routing. *** */ DMOBJ tRoutingObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Router", &DMREAD, NULL, NULL, NULL, browseRouterInst, NULL, NULL, NULL, tRoutingRouterObj, tRoutingRouterParams, NULL, BBFDM_BOTH}, {"RouteInformation", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tRoutingRouteInformationObj, tRoutingRouteInformationParams, NULL, BBFDM_BOTH}, {0} @@ -44,7 +44,7 @@ DMLEAF tRoutingParams[] = { /* *** Device.Routing.Router.{i}. *** */ DMOBJ tRoutingRouterObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"IPv4Forwarding", &DMWRITE, add_ipv4forwarding, delete_ipv4forwarding, NULL, browseIPv4ForwardingInst, NULL, NULL, NULL, NULL, tRoutingRouterIPv4ForwardingParams, NULL, BBFDM_BOTH}, {"IPv6Forwarding", &DMWRITE, add_ipv6Forwarding, delete_ipv6Forwarding, NULL, browseIPv6ForwardingInst, NULL, NULL, NULL, NULL, tRoutingRouterIPv6ForwardingParams, NULL, BBFDM_BOTH}, {0} @@ -95,7 +95,7 @@ DMLEAF tRoutingRouterIPv6ForwardingParams[] = { /* *** Device.Routing.RouteInformation. *** */ DMOBJ tRoutingRouteInformationObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"InterfaceSetting", &DMREAD, NULL, NULL, NULL, browseRoutingRouteInformationInterfaceSettingInst, NULL, NULL, NULL, NULL, tRoutingRouteInformationInterfaceSettingParams, NULL, BBFDM_BOTH}, {0} }; diff --git a/dmtree/tr181/times.c b/dmtree/tr181/times.c index f876f5f2..f575db9b 100644 --- a/dmtree/tr181/times.c +++ b/dmtree/tr181/times.c @@ -11,10 +11,10 @@ #include #include -#include "dmuci.h" -#include "dmbbf.h" -#include "dmubus.h" -#include "dmcommon.h" +#include +#include +#include +#include #include "dmentry.h" #include "times.h" diff --git a/dmtree/tr181/times.h b/dmtree/tr181/times.h index 2ffa7352..d7132732 100644 --- a/dmtree/tr181/times.h +++ b/dmtree/tr181/times.h @@ -11,7 +11,7 @@ #ifndef __TIMES_H #define __TIMES_H -#include "dmbbf.h" +#include extern DMLEAF tTimeParams[]; diff --git a/dmtree/tr181/upnp.c b/dmtree/tr181/upnp.c index 4af7f77c..25500814 100644 --- a/dmtree/tr181/upnp.c +++ b/dmtree/tr181/upnp.c @@ -12,15 +12,15 @@ #include #include #include -#include "dmuci.h" -#include "dmubus.h" -#include "dmbbf.h" -#include "dmcommon.h" +#include +#include +#include +#include #include "upnp.h" /* *** Device.UPnP. *** */ DMOBJ tUPnPObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Device", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tUPnPDeviceParams, NULL, BBFDM_BOTH}, {0} }; diff --git a/dmtree/tr181/usb.c b/dmtree/tr181/usb.c index 3d4c0501..3bd4f7ea 100644 --- a/dmtree/tr181/usb.c +++ b/dmtree/tr181/usb.c @@ -9,15 +9,15 @@ */ #include -#include "dmbbf.h" -#include "dmcommon.h" -#include "dmuci.h" +#include +#include +#include #include "dmentry.h" #include "usb.h" /* *** Device.USB. *** */ DMOBJ tUSBObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Interface", &DMREAD, NULL, NULL, NULL, browseUSBInterfaceInst, NULL, NULL, NULL, tUSBInterfaceObj, tUSBInterfaceParams, NULL, BBFDM_BOTH}, {"Port", &DMREAD, NULL, NULL, NULL, browseUSBPortInst, NULL, NULL, NULL, NULL, tUSBPortParams, get_linker_usb_port, BBFDM_BOTH}, {"USBHosts", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tUSBUSBHostsObj, tUSBUSBHostsParams, NULL, BBFDM_BOTH}, @@ -33,7 +33,7 @@ DMLEAF tUSBParams[] = { /* *** Device.USB.Interface.{i}. *** */ DMOBJ tUSBInterfaceObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tUSBInterfaceStatsParams, NULL, BBFDM_BOTH}, {0} }; @@ -89,7 +89,7 @@ DMLEAF tUSBPortParams[] = { /* *** Device.USB.USBHosts. *** */ DMOBJ tUSBUSBHostsObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Host", &DMREAD, NULL, NULL, NULL, browseUSBUSBHostsHostInst, NULL, NULL, NULL, tUSBUSBHostsHostObj, tUSBUSBHostsHostParams, NULL, BBFDM_BOTH}, {0} }; @@ -102,7 +102,7 @@ DMLEAF tUSBUSBHostsParams[] = { /* *** Device.USB.USBHosts.Host.{i}. *** */ DMOBJ tUSBUSBHostsHostObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Device", &DMREAD, NULL, NULL, NULL, browseUSBUSBHostsHostDeviceInst, NULL, NULL, NULL, tUSBUSBHostsHostDeviceObj, tUSBUSBHostsHostDeviceParams, get_linker_usb_host_device, BBFDM_BOTH}, {0} }; @@ -122,7 +122,7 @@ DMLEAF tUSBUSBHostsHostParams[] = { /* *** Device.USB.USBHosts.Host.{i}.Device.{i}. *** */ DMOBJ tUSBUSBHostsHostDeviceObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Configuration", &DMREAD, NULL, NULL, NULL, browseUSBUSBHostsHostDeviceConfigurationInst, NULL, NULL, NULL, tUSBUSBHostsHostDeviceConfigurationObj, tUSBUSBHostsHostDeviceConfigurationParams, NULL, BBFDM_BOTH}, {0} }; @@ -153,7 +153,7 @@ DMLEAF tUSBUSBHostsHostDeviceParams[] = { /* *** Device.USB.USBHosts.Host.{i}.Device.{i}.Configuration.{i}. *** */ DMOBJ tUSBUSBHostsHostDeviceConfigurationObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Interface", &DMREAD, NULL, NULL, NULL, browseUSBUSBHostsHostDeviceConfigurationInterfaceInst, NULL, NULL, NULL, NULL, tUSBUSBHostsHostDeviceConfigurationInterfaceParams, NULL, BBFDM_BOTH}, {0} }; diff --git a/dmtree/tr181/userinterface.c b/dmtree/tr181/userinterface.c index 3710e95e..9521515c 100644 --- a/dmtree/tr181/userinterface.c +++ b/dmtree/tr181/userinterface.c @@ -13,16 +13,16 @@ #include #include #include -#include "dmuci.h" -#include "dmubus.h" -#include "dmbbf.h" -#include "dmjson.h" -#include "dmcommon.h" +#include +#include +#include +#include +#include #include "userinterface.h" /* *** Device.UserInterface. *** */ DMOBJ tUserInterfaceObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"RemoteAccess", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tUserInterfaceRemoteAccessParams, NULL, BBFDM_BOTH}, {0} }; diff --git a/dmtree/tr181/users.c b/dmtree/tr181/users.c index dba80907..fb33ddc9 100644 --- a/dmtree/tr181/users.c +++ b/dmtree/tr181/users.c @@ -9,13 +9,13 @@ * Author: Omar Kallel */ -#include "dmbbf.h" +#include +#include #include "users.h" -#include "dmcommon.h" /* *** Device.Users. *** */ DMOBJ tUsersObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"User", &DMWRITE, add_users_user, delete_users_user, NULL, browseUserInst, NULL, NULL, NULL, NULL, tUsersUserParams, NULL, BBFDM_BOTH}, {0} }; diff --git a/dmtree/tr181/users.h b/dmtree/tr181/users.h index 86428ea6..06db9a0f 100644 --- a/dmtree/tr181/users.h +++ b/dmtree/tr181/users.h @@ -11,7 +11,7 @@ #ifndef _USERS_H #define _USERS_H -#include "dmbbf.h" +#include extern DMOBJ tUsersObj[]; extern DMLEAF tUsersParams[]; diff --git a/dmtree/tr181/wifi.c b/dmtree/tr181/wifi.c index 709386e1..f6c2ba8a 100644 --- a/dmtree/tr181/wifi.c +++ b/dmtree/tr181/wifi.c @@ -13,19 +13,20 @@ #include #include #include -#include "dmuci.h" -#include "dmubus.h" -#include "dmbbf.h" -#include "dmcommon.h" -#include "wifi.h" -#include "dmjson.h" +#include +#include +#include +#include +#include #include "dmentry.h" #include "wepkey.h" +#include "wifi.h" + #define DELIMITOR "," /* *** Device.WiFi. *** */ DMOBJ tWiFiObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Radio", &DMREAD, NULL, NULL, NULL, browseWifiRadioInst, NULL, NULL, NULL, tWiFiRadioObj, tWiFiRadioParams, get_linker_Wifi_Radio, BBFDM_BOTH}, {"SSID", &DMWRITE, add_wifi_ssid, delete_wifi_ssid, NULL, browseWifiSsidInst, NULL, NULL, NULL, tWiFiSSIDObj, tWiFiSSIDParams, get_linker_Wifi_Ssid, BBFDM_BOTH}, {"AccessPoint", &DMREAD, NULL, NULL, NULL, browseWifiAccessPointInst, NULL, NULL, NULL, tWiFiAccessPointObj, tWiFiAccessPointParams, NULL, BBFDM_BOTH}, @@ -46,7 +47,7 @@ DMLEAF tWiFiParams[] = { /* *** Device.WiFi.Radio.{i}. *** */ DMOBJ tWiFiRadioObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiRadioStatsParams, NULL, BBFDM_BOTH}, {0} }; @@ -104,7 +105,7 @@ DMLEAF tWiFiRadioStatsParams[] = { /* *** Device.WiFi.NeighboringWiFiDiagnostic. *** */ DMOBJ tWiFiNeighboringWiFiDiagnosticObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Result", &DMREAD, NULL, NULL, NULL, browseWifiNeighboringWiFiDiagnosticResultInst, NULL, NULL, NULL, NULL, tWiFiNeighboringWiFiDiagnosticResultParams, NULL, BBFDM_CWMP}, {0} }; @@ -130,7 +131,7 @@ DMLEAF tWiFiNeighboringWiFiDiagnosticResultParams[] = { /* *** Device.WiFi.SSID.{i}. *** */ DMOBJ tWiFiSSIDObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiSSIDStatsParams, NULL, BBFDM_BOTH}, {0} }; @@ -170,7 +171,7 @@ DMLEAF tWiFiSSIDStatsParams[] = { /* *** Device.WiFi.AccessPoint.{i}. *** */ DMOBJ tWiFiAccessPointObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Security", &DMWRITE, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiAccessPointSecurityParams, NULL, BBFDM_BOTH}, {"AssociatedDevice", &DMREAD, NULL, NULL, NULL, browse_wifi_associated_device, NULL, NULL, NULL, tWiFiAccessPointAssociatedDeviceObj, tWiFiAccessPointAssociatedDeviceParams, get_linker_associated_device, BBFDM_BOTH}, {"WPS", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiAccessPointWPSParams, NULL, BBFDM_BOTH}, @@ -230,7 +231,7 @@ DMLEAF tWiFiAccessPointWPSParams[] = { /* *** Device.WiFi.AccessPoint.{i}.AssociatedDevice.{i}. *** */ DMOBJ tWiFiAccessPointAssociatedDeviceObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiAccessPointAssociatedDeviceStatsParams, NULL, BBFDM_BOTH}, {0} }; @@ -286,7 +287,7 @@ DMLEAF tWiFiAcessPointIEEE80211rParams[] = { /* *** Device.WiFi.EndPoint.{i}. *** */ DMOBJ tWiFiEndPointObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiEndPointStatsParams, NULL, BBFDM_BOTH}, {"Security", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiEndPointSecurityParams, NULL, BBFDM_BOTH}, {"Profile", &DMREAD, NULL, NULL, NULL, browseWiFiEndPointProfileInst, NULL, NULL, NULL, tWiFiEndPointProfileObj, tWiFiEndPointProfileParams, NULL, BBFDM_BOTH}, @@ -324,7 +325,7 @@ DMLEAF tWiFiEndPointSecurityParams[] = { /* *** Device.WiFi.EndPoint.{i}.Profile.{i}. *** */ DMOBJ tWiFiEndPointProfileObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Security", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiEndPointProfileSecurityParams, NULL, BBFDM_BOTH}, {0} }; @@ -700,7 +701,7 @@ int get_radio_operating_channel_bandwidth(char *refparam, struct dmctx *ctx, voi json_object *res; char *wlan_name; dmuci_get_value_by_section_string(((struct wifi_radio_args *)data)->wifi_radio_sec, "bandwidth", value); - if (value[0] == '\0') + if ((*value)[0] == '\0') { wlan_name = section_name(((struct wifi_radio_args *)data)->wifi_radio_sec); dmubus_call("router.wireless", "status", UBUS_ARGS{{"vif", wlan_name, String}}, 1, &res); diff --git a/dmtree/tr181/x_iopsys_eu_buttons.c b/dmtree/tr181/x_iopsys_eu_buttons.c index 9442c187..ca50f811 100644 --- a/dmtree/tr181/x_iopsys_eu_buttons.c +++ b/dmtree/tr181/x_iopsys_eu_buttons.c @@ -12,10 +12,10 @@ #include #include -#include "dmbbf.h" -#include "dmuci.h" -#include "dmubus.h" -#include "dmcommon.h" +#include +#include +#include +#include #include "x_iopsys_eu_buttons.h" /*** DMROOT.X_IOPSYS_EU_Buttons.{i}. ****/ diff --git a/dmtree/tr181/x_iopsys_eu_dropbear.c b/dmtree/tr181/x_iopsys_eu_dropbear.c index bf05261d..ae02c9d8 100644 --- a/dmtree/tr181/x_iopsys_eu_dropbear.c +++ b/dmtree/tr181/x_iopsys_eu_dropbear.c @@ -11,10 +11,10 @@ #include #include -#include "dmbbf.h" -#include "dmuci.h" -#include "dmubus.h" -#include "dmcommon.h" +#include +#include +#include +#include #include "x_iopsys_eu_dropbear.h" /*** DMROOT.X_IOPSYS_EU_Dropbear.{i}. ****/ diff --git a/dmtree/tr181/x_iopsys_eu_ice.c b/dmtree/tr181/x_iopsys_eu_ice.c index 2a17affd..cb4b24e8 100644 --- a/dmtree/tr181/x_iopsys_eu_ice.c +++ b/dmtree/tr181/x_iopsys_eu_ice.c @@ -12,10 +12,10 @@ #include #include #include -#include "dmuci.h" -#include "dmubus.h" -#include "dmbbf.h" -#include "dmcommon.h" +#include +#include +#include +#include #include "x_iopsys_eu_ice.h" /*** DMROOT.X_IOPSYS_EU_ICE. ***/ diff --git a/dmtree/tr181/x_iopsys_eu_igmp.c b/dmtree/tr181/x_iopsys_eu_igmp.c index 9555f88c..42888d8d 100644 --- a/dmtree/tr181/x_iopsys_eu_igmp.c +++ b/dmtree/tr181/x_iopsys_eu_igmp.c @@ -12,10 +12,10 @@ #include #include #include -#include "dmuci.h" -#include "dmubus.h" -#include "dmbbf.h" -#include "dmcommon.h" +#include +#include +#include +#include #include "x_iopsys_eu_igmp.h" DMLEAF tSe_IgmpParam[] = { diff --git a/dmtree/tr181/x_iopsys_eu_ipacccfg.c b/dmtree/tr181/x_iopsys_eu_ipacccfg.c index b3b5e4f1..a3035133 100644 --- a/dmtree/tr181/x_iopsys_eu_ipacccfg.c +++ b/dmtree/tr181/x_iopsys_eu_ipacccfg.c @@ -12,15 +12,15 @@ #include #include -#include "dmbbf.h" -#include "dmuci.h" -#include "dmubus.h" -#include "dmcommon.h" +#include +#include +#include +#include #include "x_iopsys_eu_ipacccfg.h" /*** DMROOT.X_IOPSYS_EU_IpAccCfg. ***/ DMOBJ tSe_IpAccObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {CUSTOM_PREFIX"IpAccListCfgObj", &DMWRITE, add_ipacccfg_rule, delete_ipacccfg_rule, NULL, browseAccListInst, NULL, NULL, NULL, NULL, tSe_IpAccCfgParam, NULL, BBFDM_BOTH}, {CUSTOM_PREFIX"PortForwarding", &DMWRITE, add_ipacccfg_port_forwarding, delete_ipacccfg_port_forwarding, NULL, browseport_forwardingInst, NULL, NULL, NULL, NULL, tSe_PortForwardingParam, NULL, BBFDM_BOTH}, {0} diff --git a/dmtree/tr181/x_iopsys_eu_logincfg.c b/dmtree/tr181/x_iopsys_eu_logincfg.c index 97b27fbd..6e0bb630 100644 --- a/dmtree/tr181/x_iopsys_eu_logincfg.c +++ b/dmtree/tr181/x_iopsys_eu_logincfg.c @@ -10,10 +10,10 @@ */ #include -#include "dmbbf.h" -#include "dmuci.h" -#include "dmubus.h" -#include "dmcommon.h" +#include +#include +#include +#include #include "x_iopsys_eu_logincfg.h" /*** DMROOT.X_IOPSYS_EU_LoginCfg. ***/ diff --git a/dmtree/tr181/x_iopsys_eu_owsd.c b/dmtree/tr181/x_iopsys_eu_owsd.c index 07d8b710..052756ff 100644 --- a/dmtree/tr181/x_iopsys_eu_owsd.c +++ b/dmtree/tr181/x_iopsys_eu_owsd.c @@ -12,10 +12,10 @@ #include #include -#include "dmbbf.h" -#include "dmuci.h" -#include "dmubus.h" -#include "dmcommon.h" +#include +#include +#include +#include #include "dmentry.h" #include "x_iopsys_eu_owsd.h" @@ -28,7 +28,7 @@ DMLEAF XIopsysEuOwsdParams[] = { }; DMOBJ XIopsysEuOwsdObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {CUSTOM_PREFIX"UbusProxy", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, UbusProxyParams, NULL, BBFDM_BOTH}, {CUSTOM_PREFIX"ListenObj", &DMWRITE, add_owsd_listen, delete_owsd_listen_instance, NULL, browseXIopsysEuOwsdListenObj, NULL, NULL, NULL, NULL, X_IOPSYS_EU_ListenObjParams, NULL, BBFDM_BOTH}, {0} diff --git a/dmtree/tr181/x_iopsys_eu_power_mgmt.c b/dmtree/tr181/x_iopsys_eu_power_mgmt.c index d121a5dc..6fffc26a 100644 --- a/dmtree/tr181/x_iopsys_eu_power_mgmt.c +++ b/dmtree/tr181/x_iopsys_eu_power_mgmt.c @@ -12,9 +12,9 @@ */ #include -#include "dmbbf.h" -#include "dmuci.h" -#include "dmcommon.h" +#include +#include +#include #include "x_iopsys_eu_power_mgmt.h" /*** DMROOT.X_IOPSYS_EU_PowerManagement. ***/ diff --git a/dmtree/tr181/x_iopsys_eu_syslog.c b/dmtree/tr181/x_iopsys_eu_syslog.c index 0edac3a0..0e380bda 100644 --- a/dmtree/tr181/x_iopsys_eu_syslog.c +++ b/dmtree/tr181/x_iopsys_eu_syslog.c @@ -12,10 +12,10 @@ #include #include #include -#include "dmuci.h" -#include "dmubus.h" -#include "dmbbf.h" -#include "dmcommon.h" +#include +#include +#include +#include #include "x_iopsys_eu_syslog.h" /*** DMROOT.X_IOPSYS_EU_SyslogCfg. ***/ diff --git a/dmtree/tr181/x_iopsys_eu_wifilife.c b/dmtree/tr181/x_iopsys_eu_wifilife.c index c146cb41..10b2baec 100644 --- a/dmtree/tr181/x_iopsys_eu_wifilife.c +++ b/dmtree/tr181/x_iopsys_eu_wifilife.c @@ -10,15 +10,15 @@ #include #include -#include "dmbbf.h" -#include "dmuci.h" -#include "dmubus.h" -#include "dmcommon.h" +#include +#include +#include +#include #include "x_iopsys_eu_wifilife.h" /*** DMROOT.X_IOPSYS_EU_WiFiLife. ****/ DMOBJ X_IOPSYS_EU_WiFiLifeObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Steering", &DMREAD, NULL, NULL, NULL, browseWifiLifeSteeringObj, NULL, NULL, NULL, NULL, WiFiLifeSteeringParams, NULL, BBFDM_BOTH}, {0} }; diff --git a/dmtree/tr181/xmpp.c b/dmtree/tr181/xmpp.c index 3a34d7b7..551f5f48 100644 --- a/dmtree/tr181/xmpp.c +++ b/dmtree/tr181/xmpp.c @@ -12,15 +12,15 @@ #include #include -#include "dmbbf.h" -#include "dmuci.h" -#include "dmubus.h" -#include "dmcommon.h" +#include +#include +#include +#include #include "xmpp.h" /* *** Device.XMPP. *** */ DMOBJ tXMPPObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Connection", &DMWRITE, add_xmpp_connection, delete_xmpp_connection, NULL, browsexmpp_connectionInst, NULL, NULL, NULL, tXMPPConnectionObj, tXMPPConnectionParams, get_xmpp_connection_linker, BBFDM_BOTH}, {0} }; @@ -34,7 +34,7 @@ DMLEAF tXMPPParams[] = { /* *** Device.XMPP.Connection.{i}. *** */ DMOBJ tXMPPConnectionObj[] = { -/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/ {"Server", &DMREAD, NULL, NULL, NULL, browsexmpp_connection_serverInst, NULL, NULL, NULL, NULL, tXMPPConnectionServerParams, NULL, BBFDM_BOTH}, {0} }; diff --git a/json/convertor_json_to_c.py b/json/convertor_json_to_c.py index 35d96b01..399a6f41 100755 --- a/json/convertor_json_to_c.py +++ b/json/convertor_json_to_c.py @@ -169,7 +169,7 @@ def printheaderObjCommon( objname ): def cprintheaderOBJS( objname ): fp = open('./.objparamarray.c', 'a') print >> fp, "DMOBJ %s[] = {" % ("t" + getname(objname) + "Obj") - print >> fp, "/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/" + print >> fp, "/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type*/" fp.close() def hprintheaderOBJS( objname ): diff --git a/dmbbf.c b/libbbf_api/dmbbf.c similarity index 96% rename from dmbbf.c rename to libbbf_api/dmbbf.c index f8290004..086f587d 100644 --- a/dmbbf.c +++ b/libbbf_api/dmbbf.c @@ -9,6 +9,7 @@ * Author Imen Bhiri * Author Feten Besbes * Author Omar Kallel + * Author Amin Ben Ramdhane * */ @@ -19,37 +20,8 @@ #include "dmuci.h" #include "dmbbf.h" #include "dmmem.h" -#include "device.h" -#include "times.h" -#include "upnp.h" -#include "deviceinfo.h" -#include "managementserver.h" -#include "x_iopsys_eu_igmp.h" -#include "x_iopsys_eu_ice.h" -#include "x_iopsys_eu_power_mgmt.h" -#include "x_iopsys_eu_ipacccfg.h" -#include "x_iopsys_eu_logincfg.h" -#include "x_iopsys_eu_syslog.h" #include "dmcommon.h" -#include "wifi.h" -#include "ethernet.h" -#include "atm.h" -#include "ptm.h" -#include "bridging.h" -#include "hosts.h" -#include "dhcpv4.h" -#include "ip.h" -#include "ppp.h" -#include "softwaremodules.h" -#include "routing.h" -#include "nat.h" -#include "xmpp.h" #include "dmjson.h" -#include "dmentry.h" -#include "dmoperate.h" -#ifdef BBF_TR104 -#include "voice_services.h" -#endif static char *get_parameter_notification(struct dmctx *ctx, char *param); static int remove_parameter_notification(char *param); @@ -340,7 +312,7 @@ void dm_browse_entry(struct dmctx *dmctx, DMNODE *parent_node, DMOBJ *entryobj, } } - if (entryobj->nextobj || entryobj->nextjsonobj) { + if (entryobj->nextobj || entryobj->nextdynamicobj) { *err = dm_browse(dmctx, &node, entryobj->nextobj, data, instance); } } @@ -348,7 +320,8 @@ void dm_browse_entry(struct dmctx *dmctx, DMNODE *parent_node, DMOBJ *entryobj, int dm_browse(struct dmctx *dmctx, DMNODE *parent_node, DMOBJ *entryobj, void *data, char *instance) { DMOBJ *jentryobj; - int err = 0; + struct dm_dynamic_obj *next_dyn_array; + int i, j, err = 0; char *parent_obj = parent_node->current_object; @@ -361,11 +334,20 @@ int dm_browse(struct dmctx *dmctx, DMNODE *parent_node, DMOBJ *entryobj, void *d } if (parent_node->obj) { - jentryobj = parent_node->obj->nextjsonobj; - for (; (jentryobj && jentryobj->obj); jentryobj++) { - dm_browse_entry(dmctx, parent_node, jentryobj, data, instance, parent_obj, &err); - if (dmctx->stop) - return err; + if (parent_node->obj->nextdynamicobj) { + for (i = 0; i < __INDX_DYNAMIC_MAX; i++) { + next_dyn_array = parent_node->obj->nextdynamicobj + i; + if (next_dyn_array->nextobj) { + for (j = 0; next_dyn_array->nextobj[j]; j++) { + jentryobj = next_dyn_array->nextobj[j]; + for (; (jentryobj && jentryobj->obj); jentryobj++) { + dm_browse_entry(dmctx, parent_node, jentryobj, data, instance, parent_obj, &err); + if (dmctx->stop) + return err; + } + } + } + } } } @@ -421,6 +403,77 @@ int dm_link_inst_obj(struct dmctx *dmctx, DMNODE *parent_node, void *data, char return err; } +static int plugin_dynamic_obj_match(struct dmctx *dmctx, struct dmnode *node, char *entry_obj, char *full_obj) +{ + if (node->matched) + return 0; + + if (!dmctx->inparam_isparam && strstr(node->current_object, full_obj) == node->current_object) { + node->matched++; + dmctx->findparam = 1; + return 0; + } + + if (strstr(full_obj, node->current_object) == full_obj) + return 0; + + return FAULT_9005; +} + +void dm_check_dynamic_obj(struct dmctx *dmctx, DMNODE *parent_node, DMOBJ *entryobj, char *full_obj, char *obj, DMOBJ **root_entry, int *obj_found) +{ + int err = 0; + if (!entryobj) + return; + char *parent_obj = parent_node->current_object; + for (; entryobj->obj; entryobj++) { + DMNODE node = {0}; + node.obj = entryobj; + node.parent = parent_node; + node.instance_level = parent_node->instance_level; + node.matched = parent_node->matched; + dmasprintf(&(node.current_object), "%s%s%c", parent_obj, entryobj->obj, dm_delim); + if (strcmp(node.current_object, obj) == 0) { + *root_entry = entryobj; + *obj_found = 1; + return; + } + + err = plugin_dynamic_obj_match(dmctx, &node, entryobj->obj, full_obj); + if (err) + continue; + + if (entryobj->nextobj) + dm_check_dynamic_obj(dmctx, &node, entryobj->nextobj, full_obj, obj, root_entry, obj_found); + } +} + +int free_dm_browse_node_dynamic_object_tree(DMNODE *parent_node, DMOBJ *entryobj) +{ + if (!entryobj) + return 0; + + for (; entryobj->obj; entryobj++) { + if (entryobj->nextdynamicobj) { + for (int i = 0; i < __INDX_DYNAMIC_MAX; i++) { + struct dm_dynamic_obj *next_dyn_array = entryobj->nextdynamicobj + i; + if (next_dyn_array->nextobj) FREE(next_dyn_array->nextobj); + } + FREE(entryobj->nextdynamicobj); + } + + DMNODE node = {0}; + node.obj = entryobj; + node.parent = parent_node; + node.instance_level = parent_node->instance_level; + node.matched = parent_node->matched; + + if (entryobj->nextobj) + free_dm_browse_node_dynamic_object_tree(&node, entryobj->nextobj); + } + return 0; +} + int rootcmp(char *inparam, char *rootobj) { int cmp = -1; @@ -1060,13 +1113,23 @@ int string_to_bool(char *v, bool *b) return -1; } -/****************** - * operate commands - *****************/ -int dm_entry_operate(struct dmctx *dmctx) +void dmentry_instance_lookup_inparam(struct dmctx *ctx) { - int res = operate_on_node(dmctx, dmctx->in_param, dmctx->in_value); - return res; + char *pch, *spch, *in_param; + in_param = dmstrdup(ctx->in_param); + int i = 0; + char pat[2] = {0}; + *pat = dm_delim; + for (pch = strtok_r(in_param, pat, &spch); pch != NULL; pch = strtok_r(NULL, pat, &spch)) { + if (pch[0]== '[') { + ctx->alias_register |= (1 << i); + i++; + } else if (isdigit(pch[0])) { + i++; + } + } + dmfree(in_param); + ctx->nbrof_instance = i; } /* ********** diff --git a/dmbbf.h b/libbbf_api/dmbbf.h similarity index 94% rename from dmbbf.h rename to libbbf_api/dmbbf.h index 026cd5cd..6e7c20b9 100644 --- a/dmbbf.h +++ b/libbbf_api/dmbbf.h @@ -8,6 +8,7 @@ * Author MOHAMED Kallel * Author Imen Bhiri * Author Feten Besbes + * Author Amin Ben Ramdhane * */ @@ -94,6 +95,11 @@ struct dmnode; struct dmctx; struct dm_notif_s; +struct dm_dynamic_obj { + struct dm_obj_s **nextobj; + int isstatic; +}; + struct dm_permession_s { char *val; char *(*get_permission)(char *refparam, struct dmctx *dmctx, void *data, char *instance); @@ -122,7 +128,7 @@ typedef struct dm_leaf_s { } DMLEAF; typedef struct dm_obj_s { - /* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type(13)*/ + /* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type(13)*/ char *obj; struct dm_permession_s *permission; int (*addobj)(char *refparam, struct dmctx *ctx, void *data, char **instance); @@ -131,7 +137,7 @@ typedef struct dm_obj_s { int (*browseinstobj)(struct dmctx *dmctx, struct dmnode *node, void *data, char *instance); struct dm_forced_inform_s *forced_inform; struct dm_notif_s *notification; - struct dm_obj_s *nextjsonobj; + struct dm_dynamic_obj *nextdynamicobj; struct dm_obj_s *nextobj; struct dm_leaf_s *leaf; int (*get_linker)(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker); @@ -274,6 +280,28 @@ typedef struct execute_end_session { void (*function)(struct execute_end_session *); } execute_end_session; +typedef struct lib_map_obj { + char *path; + struct dm_obj_s *root_obj; +} LIB_MAP_OBJ; + +enum operate_ret_status{ + UBUS_INVALID_ARGUMENTS, + SUCCESS, + FAIL, + CMD_NOT_FOUND, + __STATUS_MAX, +}; + +typedef enum operate_ret_status opr_ret_t; + +typedef opr_ret_t (*operation) (struct dmctx *dmctx, char *p, char *input); + +typedef struct lib_map_operate { + char *path; + operation operate; +} LIB_MAP_OPERATE; + enum set_value_action { VALUECHECK, VALUESET @@ -283,6 +311,7 @@ enum del_action_enum { DEL_INST, DEL_ALL }; + enum { CMD_GET_VALUE, CMD_GET_NAME, @@ -469,6 +498,12 @@ enum dm_param_flags_enum{ DM_FACTORIZED = 1 << 31 }; +enum { + INDX_JSON_OBJ_MOUNT, + INDX_LIBRARY_OBJ_MOUNT, + __INDX_DYNAMIC_MAX +}; + extern struct list_head list_enabled_notify; extern struct list_head list_enabled_lw_notify; extern struct list_head list_execute_end_session; @@ -505,7 +540,7 @@ void add_list_fault_param(struct dmctx *ctx, char *param, int fault); void del_list_fault_param(struct param_fault *param_fault); void free_all_list_fault_param(struct dmctx *ctx); int string_to_bool(char *v, bool *b); -int dm_entry_operate(struct dmctx *dmctx); +void dmentry_instance_lookup_inparam(struct dmctx *ctx); int dm_entry_get_value(struct dmctx *ctx); int dm_entry_get_name(struct dmctx *ctx); int dm_entry_get_notification(struct dmctx *ctx); @@ -548,6 +583,8 @@ void cwmp_set_end_session (unsigned int flag); char *dm_print_path(char *fpath, ...); void free_all_list_enabled_lwnotify(); int dm_link_inst_obj(struct dmctx *dmctx, DMNODE *parent_node, void *data, char *instance); +void dm_check_dynamic_obj(struct dmctx *dmctx, DMNODE *parent_node, DMOBJ *entryobj, char *full_obj, char *obj, DMOBJ **root_entry, int *obj_found); +int free_dm_browse_node_dynamic_object_tree(DMNODE *parent_node, DMOBJ *entryobj); #ifdef BBF_TR064 void dm_upnp_apply_config(void); void add_list_upnp_param_track(struct dmctx *dmctx, struct list_head *pchead, char *param, char *key, char *value, unsigned int isobj); diff --git a/dmcommon.c b/libbbf_api/dmcommon.c similarity index 99% rename from dmcommon.c rename to libbbf_api/dmcommon.c index 3085608c..bd6b1e8d 100644 --- a/dmcommon.c +++ b/libbbf_api/dmcommon.c @@ -8,6 +8,7 @@ * Author: Imen Bhiri * Author: Feten Besbes * Author: Omar Kallel + * Author Amin Ben Ramdhane */ #include @@ -687,7 +688,7 @@ void update_section_list(char *config, char *section, char *option, int number, struct uci_section *s = NULL; int i = 0; - if (config == DMMAP) + if (strcmp(config, DMMAP) == 0) { if (option) { uci_path_foreach_option_eq(bbfdm, config, section, option, filter, s) { diff --git a/dmcommon.h b/libbbf_api/dmcommon.h similarity index 99% rename from dmcommon.h rename to libbbf_api/dmcommon.h index 286570c5..c21e259f 100644 --- a/dmcommon.h +++ b/libbbf_api/dmcommon.h @@ -7,15 +7,18 @@ * * Author: Imen Bhiri * Author: Feten Besbes + * Author Amin Ben Ramdhane */ #ifndef __DM_COMMON_H #define __DM_COMMON_H + #include #include #include #include #include "dmbbf.h" + #define NVRAM_FILE "/proc/nvram/WpaKey" #define MAX_DHCP_LEASES 256 #define MAX_PROC_ROUTING 256 diff --git a/dmjson.c b/libbbf_api/dmjson.c similarity index 100% rename from dmjson.c rename to libbbf_api/dmjson.c diff --git a/dmjson.h b/libbbf_api/dmjson.h similarity index 100% rename from dmjson.h rename to libbbf_api/dmjson.h diff --git a/dmmem.c b/libbbf_api/dmmem.c similarity index 100% rename from dmmem.c rename to libbbf_api/dmmem.c diff --git a/dmmem.h b/libbbf_api/dmmem.h similarity index 100% rename from dmmem.h rename to libbbf_api/dmmem.h diff --git a/dmubus.c b/libbbf_api/dmubus.c similarity index 100% rename from dmubus.c rename to libbbf_api/dmubus.c diff --git a/dmubus.h b/libbbf_api/dmubus.h similarity index 100% rename from dmubus.h rename to libbbf_api/dmubus.h diff --git a/dmuci.c b/libbbf_api/dmuci.c similarity index 100% rename from dmuci.c rename to libbbf_api/dmuci.c diff --git a/dmuci.h b/libbbf_api/dmuci.h similarity index 100% rename from dmuci.h rename to libbbf_api/dmuci.h diff --git a/library/example.json b/library/example.json new file mode 100644 index 00000000..5481c926 --- /dev/null +++ b/library/example.json @@ -0,0 +1,53 @@ +{ + "Device.IP.Diagnostics.X_IOPSYS_EU_BBKSpeedTest.": { + "type": "object", + "protocols": [ + "cwmp", + "usp" + ], + "access": false, + "DiagnosticsState": { + "type": "string", + "protocols": [ + "cwmp", + "usp" + ], + "read": true, + "write": true + }, + "Latency": { + "type": "string", + "protocols": [ + "cwmp", + "usp" + + ], + "read": true, + "write": false + }, + "Download": { + "type": "string", + "protocols": [ + "cwmp", + "usp" + + ], + "read": true, + "write": false + }, + "Upload": { + "type": "string", + "protocols": [ + "cwmp", + "usp" + + ], + "read": true, + "write": false + } + }, + "Device.BBKSpeedTest": { + "type": "operate" + } +} + diff --git a/library/example/Makefile b/library/example/Makefile new file mode 100644 index 00000000..e61c1eec --- /dev/null +++ b/library/example/Makefile @@ -0,0 +1,23 @@ +LIB_EXAMPLE := lib/libexample.so + +OBJS := example.o + +PROG_CFLAGS = $(CFLAGS) -fstrict-aliasing +PROG_LDFLAGS = $(LDFLAGS) -lbbfdm +FPIC := -fPIC + +.PHONY: all + +%.o: %.c + $(CC) $(PROG_CFLAGS) $(FPIC) -c -o $@ $< + +all: $(LIB_EXAMPLE) + +$(LIB_EXAMPLE): $(OBJS) + $(shell mkdir -p lib) + $(CC) -shared -Wl,-soname,libexample.so $^ -o $@ + +clean: + rm -f *.o + rm -f $(LIB_EXAMPLE) + diff --git a/library/example/example.c b/library/example/example.c new file mode 100644 index 00000000..59d96324 --- /dev/null +++ b/library/example/example.c @@ -0,0 +1,151 @@ +/* + * Copyright (C) 2020 iopsys Software Solutions AB + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1 + * as published by the Free Software Foundation + * + * Author: Amin Ben Ramdhane + */ + +#include +#include +#include +#include +#include +#include +#include +#include "example.h" + +/* ********** RootDynamicObj ********** */ +LIB_MAP_OBJ tRootDynamicObj[] = { +/* parentobj, nextobject */ +{"Device.IP.Diagnostics.", tdynamicIPDiagnosticsObj}, +{0} +}; + +/* ********** RootDynamicOperate ********** */ +LIB_MAP_OPERATE tRootDynamicOperate[] = { +/* pathname, operation */ +{"Device.BBKSpeedTest", dynamicDeviceOperate}, +{0} +}; + +/* *** Device.IP.Diagnostics. *** */ +DMOBJ tdynamicIPDiagnosticsObj[] = { +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/ +{"X_IOPSYS_EU_BBKSpeedTest", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tdynamicIPDiagnosticsX_IOPSYS_EU_BBKSpeedTestParams, NULL, BBFDM_BOTH}, +{0} +}; + +/* *** Device.IP.Diagnostics.X_IOPSYS_EU_BBKSpeedTest. *** */ +DMLEAF tdynamicIPDiagnosticsX_IOPSYS_EU_BBKSpeedTestParams[] = { +/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification, bbfdm_type*/ +{"DiagnosticsState", &DMWRITE, DMT_STRING, getdynamic_IPDiagnosticsX_IOPSYS_EU_BBKSpeedTest_DiagnosticsState, setdynamic_IPDiagnosticsX_IOPSYS_EU_BBKSpeedTest_DiagnosticsState, NULL, NULL, BBFDM_BOTH}, +{"Latency", &DMREAD, DMT_STRING, getdynamic_IPDiagnosticsX_IOPSYS_EU_BBKSpeedTest_Latency, NULL, NULL, NULL, BBFDM_BOTH}, +{"Download", &DMREAD, DMT_STRING, getdynamic_IPDiagnosticsX_IOPSYS_EU_BBKSpeedTest_Download, NULL, NULL, NULL, BBFDM_BOTH}, +{"Upload", &DMREAD, DMT_STRING, getdynamic_IPDiagnosticsX_IOPSYS_EU_BBKSpeedTest_Upload, NULL, NULL, NULL, BBFDM_BOTH}, +{0} +}; + +/************************************************************* + * GET & SET PARAM +/*************************************************************/ +static int execute_bbk_speedtest() +{ + json_object *res; + char *latency, *download, *upload = NULL; + + dmubus_call("bbk", "start", UBUS_ARGS{}, 0, &res); + if (res) { + dmuci_set_varstate_value("cwmp", "@bbkspeedtest[0]", "DiagnosticState", "Complete"); + latency=dmjson_get_value(res, 1, "latency"); + if(latency!=NULL && strlen(latency)>0) + dmuci_set_varstate_value("cwmp", "@bbkspeedtest[0]", "Latency", latency); + download=dmjson_get_value(res, 1, "download"); + if(download!=NULL && strlen(latency)>0) + dmuci_set_varstate_value("cwmp", "@bbkspeedtest[0]", "Download", download); + upload=dmjson_get_value(res, 1, "upload"); + if(upload!=NULL && strlen(upload)>0) + dmuci_set_varstate_value("cwmp", "@bbkspeedtest[0]", "Upload", upload); + } + return 0; +} + +static inline char *bbk_speedtest_get(char *option, char *def) +{ + char *tmp; + dmuci_get_varstate_string("cwmp", "@bbkspeedtest[0]", option, &tmp); + if(tmp && tmp[0] == '\0') + return dmstrdup(def); + else + return tmp; +} + + +int getdynamic_IPDiagnosticsX_IOPSYS_EU_BBKSpeedTest_DiagnosticsState(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = bbk_speedtest_get("DiagnosticState", "None"); + return 0; +} + +int setdynamic_IPDiagnosticsX_IOPSYS_EU_BBKSpeedTest_DiagnosticsState(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + char *tmp; + struct uci_section *curr_section = NULL; + + switch (action) { + case VALUECHECK: + break; + case VALUESET: + if (strcmp(value, "Requested") == 0) { + curr_section = dmuci_walk_state_section("cwmp", "bbkspeedtest", NULL, NULL, CMP_SECTION, NULL, NULL, GET_FIRST_SECTION); + if(!curr_section) + { + dmuci_add_state_section("cwmp", "bbkspeedtest", &curr_section, &tmp); + } + dmuci_set_varstate_value("cwmp", "@bbkspeedtest[0]", "DiagnosticState", value); + execute_bbk_speedtest(); + } + break; + } + return 0; +} + +int getdynamic_IPDiagnosticsX_IOPSYS_EU_BBKSpeedTest_Latency(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = bbk_speedtest_get("Latency", "0"); + return 0; +} + +int getdynamic_IPDiagnosticsX_IOPSYS_EU_BBKSpeedTest_Download(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = bbk_speedtest_get("Download", "0"); + return 0; +} + +int getdynamic_IPDiagnosticsX_IOPSYS_EU_BBKSpeedTest_Upload(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = bbk_speedtest_get("Upload", "0"); + return 0; +} + +/************************************************************* + * OPERATE +/*************************************************************/ +opr_ret_t dynamicDeviceOperate(struct dmctx *dmctx, char *path, char *input) +{ + json_object *ubus_res = NULL; + + dmubus_call("bbk", "start", UBUS_ARGS{}, 0, &ubus_res); + + char *param_latency = (char *) dmjson_get_value(ubus_res, 1, "latency"); + char *param_download = (char *) dmjson_get_value(ubus_res, 1, "download"); + char *param_upload = (char *) dmjson_get_value(ubus_res, 1, "upload"); + + add_list_paramameter(dmctx, dmstrdup("Latency"), param_latency, "string", NULL, 0); + add_list_paramameter(dmctx, dmstrdup("Download"), param_download, "string", NULL, 0); + add_list_paramameter(dmctx, dmstrdup("Upload"), param_upload, "string", NULL, 0); + + return SUCCESS; +} diff --git a/library/example/example.h b/library/example/example.h new file mode 100644 index 00000000..74c13480 --- /dev/null +++ b/library/example/example.h @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2020 iopsys Software Solutions AB + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1 + * as published by the Free Software Foundation + * + * Author: Amin Ben Ramdhane + */ + +#ifndef __EXAMPLE_H +#define __EXAMPLE_H + +DMOBJ tdynamicIPDiagnosticsObj[]; +DMLEAF tdynamicIPDiagnosticsX_IOPSYS_EU_BBKSpeedTestParams[]; + +int getdynamic_IPDiagnosticsX_IOPSYS_EU_BBKSpeedTest_DiagnosticsState(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int setdynamic_IPDiagnosticsX_IOPSYS_EU_BBKSpeedTest_DiagnosticsState(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); +int getdynamic_IPDiagnosticsX_IOPSYS_EU_BBKSpeedTest_Latency(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int getdynamic_IPDiagnosticsX_IOPSYS_EU_BBKSpeedTest_Download(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int getdynamic_IPDiagnosticsX_IOPSYS_EU_BBKSpeedTest_Upload(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +opr_ret_t dynamicDeviceOperate(struct dmctx *dmctx, char *path, char *input); + +#endif //__EXAMPLE_H + diff --git a/library/generate_library.py b/library/generate_library.py new file mode 100755 index 00000000..252b3661 --- /dev/null +++ b/library/generate_library.py @@ -0,0 +1,641 @@ +#!/usr/bin/python + +# Copyright (C) 2020 iopsys Software Solutions AB +# Author: Amin Ben Ramdhane + +import os +import sys +import time +import json +from collections import OrderedDict + +arrtype = { +"string": "DMT_STRING", +"unsignedInt": "DMT_UNINT", +"unsignedLong": "DMT_UNLONG", +"int": "DMT_INT", +"long": "DMT_LONG", +"boolean": "DMT_BOOL", +"dateTime": "DMT_TIME", +"hexBinary": "DMT_HEXBIN", +"base64": "DMT_BASE64", +} + +def removefile( filename ): + try: + os.remove(filename) + except OSError: + pass + +def securemkdir( folder ): + try: + os.mkdir(folder) + except: + pass + +def getlastname( name ): + lastname = name + lastname = lastname.replace(".{i}", "") + namelist = lastname.split('.') + lastname = namelist[-1] + if lastname == "": + lastname = namelist[-2] + return lastname; + +def getname( objname ): + OBJSname = objname + if (objname.count('.') > 1 and (objname.count('.') != 2 or objname.count('{i}') != 1)): + OBJSname = objname.replace("Device", "", 1) + OBJSname = OBJSname.replace("{i}", "") + OBJSname = OBJSname.replace(".", "") + if (objname.count('.') == 1): + OBJSname = "Device" + return OBJSname + return OBJSname; + +def getoptionparam( value, option ): + val = "false" + if isinstance(value,dict): + for k,v in value.items(): + if k == option: + return v + return val + +def getprotocolsparam( value, option ): + if isinstance(value,dict): + for k,v in value.items(): + if k == option and isinstance(v, list): + if len(v) == 2: + return "BBFDM_BOTH" + elif v[0] == "usp": + return "BBFDM_USP" + else: + return "BBFDM_CWMP" + return "BBFDM_BOTH" + +def getparamtype( value ): + ptype = None + paramtype = getoptionparam(value, "type") + ptype = arrtype.get(paramtype, None) + if ptype == None: + ptype = "__NA__" + return ptype + +def objhaschild( value ): + if isinstance(value,dict): + for k,v in value.items(): + if isinstance(v,dict): + for k1,v1 in v.items(): + if k1 == "type" and v1 == "object": + return 1 + return 0 + +def objhasparam( value ): + if isinstance(value,dict): + for k,v in value.items(): + if isinstance(v,dict): + for k1,v1 in v.items(): + if k1 == "type" and v1 != "object": + return 1 + return 0 + +def printheaderObjCommon( objname ): + fp = open('./.objparamarray.c', 'a') + print >> fp, "/* *** %s *** */" % objname + fp.close() + +def cprintheaderOBJS( objname ): + fp = open('./.objparamarray.c', 'a') + print >> fp, "DMOBJ %s[] = {" % ("tdynamic" + getname(objname) + "Obj") + print >> fp, "/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/" + fp.close() + +def cprintheaderRootDynamicObj( ): + fp = open('./.objroot.c', 'a') + print >> fp, "/* ********** RootDynamicObj ********** */" + print >> fp, "LIB_MAP_OBJ tRootDynamicObj[] = {" + print >> fp, "/* parentobj, nextobject */" + fp.close() + +def cprintheaderRootDynamicOperate( ): + fp = open('./.objroot.c', 'a') + print >> fp, "/* ********** RootDynamicOperate ********** */" + print >> fp, "LIB_MAP_OPERATE tRootDynamicOperate[] = {" + print >> fp, "/* pathname, operation */" + fp.close() + +def printObjRootDynamic( dmobject ): + commonname = getname(dmobject) + fp = open('./.objroot.c', 'a') + print >> fp, "{\"%s\", %s}," % (dmobject, "tdynamic" + commonname + "Obj") + fp.close() + +def printOperateRootDynamic( dmobject, commonname ): + fp = open('./.objroot.c', 'a') + print >> fp, "{\"%s\", %s}," % (dmobject, "dynamic" + commonname + "Operate") + fp.close() + +def printtailArrayRootDynamic( ): + fp = open('./.objroot.c', 'a') + print >> fp, "{0}" + print >> fp, "};" + print >> fp, "" + fp.close() + +def hprintheaderOBJS( objname ): + fp = open('./.objparamarray.h', 'a') + print >> fp, "DMOBJ %s[];" % ("tdynamic" + getname(objname) + "Obj") + fp.close() + +def cprinttopfile ( fp ): + print >> fp, "/*" + print >> fp, " * Copyright (C) 2020 iopsys Software Solutions AB" + print >> fp, " *" + print >> fp, " * This program is free software; you can redistribute it and/or modify" + print >> fp, " * it under the terms of the GNU Lesser General Public License version 2.1" + print >> fp, " * as published by the Free Software Foundation" + print >> fp, " *" + print >> fp, " * Author: Amin Ben Ramdhane " + print >> fp, " */" + print >> fp, "" + print >> fp, "#include " + print >> fp, "#include " + print >> fp, "#include " + print >> fp, "#include " + print >> fp, "#include " + print >> fp, "#include " + print >> fp, "#include " + print >> fp, "#include \"example.h\"" + print >> fp, "" + +def hprinttopfile ( fp ): + print >> fp, "/*" + print >> fp, " * Copyright (C) 2020 iopsys Software Solutions AB" + print >> fp, " *" + print >> fp, " * This program is free software; you can redistribute it and/or modify" + print >> fp, " * it under the terms of the GNU Lesser General Public License version 2.1" + print >> fp, " * as published by the Free Software Foundation" + print >> fp, " *" + print >> fp, " * Author: Amin Ben Ramdhane " + print >> fp, " */" + print >> fp, "" + print >> fp, "#ifndef __EXAMPLE_H" + print >> fp, "#define __EXAMPLE_H" + print >> fp, "" + +def printmakefile ( fp ): + print >> fp, "LIB_EXAMPLE := lib/libexample.so" + print >> fp, "" + print >> fp, "OBJS := example.o" + print >> fp, "" + print >> fp, "PROG_CFLAGS = $(CFLAGS) -fstrict-aliasing" + print >> fp, "PROG_LDFLAGS = $(LDFLAGS) -lbbfdm" + print >> fp, "FPIC := -fPIC" + print >> fp, "" + print >> fp, ".PHONY: all" + print >> fp, "" + print >> fp, "%.o: %.c" + print >> fp, " $(CC) $(PROG_CFLAGS) $(FPIC) -c -o $@ $<" + print >> fp, "" + print >> fp, "all: $(LIB_EXAMPLE)" + print >> fp, "" + print >> fp, "$(LIB_EXAMPLE): $(OBJS)" + print >> fp, " $(shell mkdir -p lib)" + print >> fp, " $(CC) -shared -Wl,-soname,libexample.so $^ -o $@" + print >> fp, "" + print >> fp, "clean:" + print >> fp, " rm -f *.o" + print >> fp, " rm -f $(LIB_EXAMPLE)" + print >> fp, "" + +def hprintfootfile ( fp ): + print >> fp, "" + print >> fp, "#endif //__EXAMPLE_H" + print >> fp, "" + +def cprintAddDelObj( faddobj, fdelobj, name, mappingobj, dmobject ): + fp = open('./.objadddel.c', 'a') + print >> fp, "int %s(char *refparam, struct dmctx *ctx, void *data, char **instance)" % faddobj + print >> fp, "{" + print >> fp, " //TODO" + print >> fp, " return 0;" + print >> fp, "}" + print >> fp, "" + print >> fp, "int %s(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action)" % fdelobj + print >> fp, "{" + print >> fp, " switch (del_action) {" + print >> fp, " case DEL_INST:" + print >> fp, " //TODO" + print >> fp, " break;" + print >> fp, " case DEL_ALL:" + print >> fp, " //TODO" + print >> fp, " break;" + print >> fp, " }" + print >> fp, " return 0;" + print >> fp, "}" + print >> fp, "" + fp.close() + +def hprintAddDelObj( faddobj, fdelobj ): + fp = open('./.objadddel.h', 'a') + print >> fp, "int %s(char *refparam, struct dmctx *ctx, void *data, char **instance);" % faddobj + print >> fp, "int %s(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);" % fdelobj + fp.close() + +def cprintBrowseObj( fbrowse, name, mappingobj, dmobject ): + fp = open('./.objbrowse.c', 'a') + print >> fp, "int %s(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)" % fbrowse + print >> fp, "{" + print >> fp, " //TODO" + print >> fp, " return 0;" + print >> fp, "}" + print >> fp, "" + fp.close() + +def hprintBrowseObj( fbrowse ): + fp = open('./.objbrowse.h', 'a') + print >> fp, "int %s(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);" % fbrowse + fp.close() + +def cprintGetSetValue(getvalue, setvalue, mappingparam, instance, typeparam, parentname, dmparam): + fp = open('./.getstevalue.c', 'a') + print >> fp, "int %s(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)" % getvalue + print >> fp, "{" + print >> fp, " //TODO" + print >> fp, " return 0;" + print >> fp, "}" + print >> fp, "" + if setvalue != "NULL": + print >> fp, "int %s(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)" % setvalue + print >> fp, "{" + print >> fp, " switch (action) {" + print >> fp, " case VALUECHECK:" + print >> fp, " break;" + print >> fp, " case VALUESET:" + print >> fp, " //TODO" + print >> fp, " break;" + print >> fp, " }" + print >> fp, " return 0;" + print >> fp, "}" + print >> fp, "" + fp.close() + +def hprintGetSetValue( getvalue, setvalue ): + fp = open('./.getstevalue.h', 'a') + print >> fp, "int %s(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);" % getvalue + if setvalue != "NULL": + print >> fp, "int %s(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);" % setvalue + fp.close() + +def cprintOperate( get_operate ): + fp = open('./.operate.c', 'a') + print >> fp, "opr_ret_t %s(struct dmctx *dmctx, char *path, char *input)" % ("dynamic" + get_operate + "Operate") + print >> fp, "{" + print >> fp, " return SUCCESS;" + print >> fp, "}" + fp.close() + +def cprintheaderPARAMS( objname ): + fp = open('./.objparamarray.c', 'a') + print >> fp, "DMLEAF %s[] = {" % ("tdynamic" + getname(objname) + "Params") + print >> fp, "/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification, bbfdm_type*/" + fp.close() + +def hprintOperate( get_operate ): + fp = open('./.operate.h', 'a') + print >> fp, "opr_ret_t %s(struct dmctx *dmctx, char *path, char *input);" % ("dynamic" + get_operate + "Operate") + fp.close() + +def hprintheaderPARAMS( objname ): + fp = open('./.objparamarray.h', 'a') + print >> fp, "DMLEAF %s[];" % ("tdynamic" + getname(objname) + "Params") + fp.close() + +def printPARAMline( parentname, dmparam, value ): + commonname = getname(parentname) + "_" + dmparam + ptype = getparamtype(value) + getvalue = "getdynamic_" + commonname + mappingparam = getoptionparam(value, "mapping") + typeparam = getoptionparam(value, "type") + bbfdm = getprotocolsparam(value, "protocols") + accessparam = getoptionparam(value, "write") + + if accessparam: + access = "&DMWRITE" + setvalue = "setdynamic_" + commonname + else: + access = "&DMREAD" + setvalue = "NULL" + + if parentname.endswith(".{i}."): + instance = "TRUE" + else: + instance = "FALSE" + + cprintGetSetValue(getvalue, setvalue, mappingparam, instance, typeparam, parentname, dmparam) + hprintGetSetValue(getvalue, setvalue) + + fp = open('./.objparamarray.c', 'a') + print >> fp, "{\"%s\", %s, %s, %s, %s, NULL, NULL, %s}," % (dmparam, access, ptype, getvalue, setvalue, bbfdm) + fp.close() + +def printtailArray( ): + fp = open('./.objparamarray.c', 'a') + print >> fp, "{0}" + print >> fp, "};" + print >> fp, "" + fp.close() + +def printOBJline( dmobject, value ): + commonname = getname(dmobject) + hasobj = objhaschild(value) + hasparam = objhasparam(value) + accessobj = getoptionparam(value, "access") + mappingobj = getoptionparam(value, "mapping") + bbfdm = getprotocolsparam(value, "protocols") + + if accessobj: + access = "&DMWRITE" + faddobj = "adddynamicObj" + commonname + fdelobj = "deldynamicObj" + commonname + cprintAddDelObj(faddobj, fdelobj, (getlastname(dmobject)).lower(), mappingobj, dmobject) + hprintAddDelObj(faddobj, fdelobj) + else: + access = "&DMREAD" + faddobj = "NULL" + fdelobj = "NULL" + + if dmobject.endswith(".{i}."): + fbrowse = "browse" + commonname + "Inst" + cprintBrowseObj(fbrowse, (getlastname(dmobject)).lower(), mappingobj, dmobject) + hprintBrowseObj(fbrowse) + else: + fbrowse = "NULL" + + if hasobj: + objchildarray = "tdynamic" + commonname + "Obj" + else: + objchildarray = "NULL" + + if hasparam: + paramarray = "tdynamic" + commonname + "Params" + else: + paramarray = "NULL" + + fp = open('./.objparamarray.c', 'a') + print >> fp, "{\"%s\", %s, %s, %s, NULL, %s, NULL, NULL, NULL, %s, %s, NULL, %s}," % (getlastname(dmobject), access, faddobj, fdelobj, fbrowse, objchildarray, paramarray, bbfdm) + fp.close() + +def printusage(): + print "Usage: " + sys.argv[0] + " " + print "Examples:" + print " - " + sys.argv[0] + " example.json" + print " ==> Generate the C code in example/ folder" + +def object_parse_childs( dmobject , value, nextlevel ): + hasobj = objhaschild(value) + hasparam = objhasparam(value) + + if hasobj or hasparam: + printheaderObjCommon(dmobject) + + if hasobj: + cprintheaderOBJS(dmobject) + hprintheaderOBJS(dmobject) + + if isinstance(value,dict): + for k,v in value.items(): + if isinstance(v,dict): + for k1,v1 in v.items(): + if k1 == "type" and v1 == "object": + printOBJline(k, v) + break + printtailArray() + + if hasparam: + cprintheaderPARAMS(dmobject) + hprintheaderPARAMS(dmobject) + if isinstance(value,dict): + for k,v in value.items(): + if k == "mapping": + continue + if isinstance(v,dict): + for k1,v1 in v.items(): + if k1 == "type" and v1 != "object": + printPARAMline(dmobject, k, v) + break + printtailArray() + + if hasobj and nextlevel == 0: + if isinstance(value,dict): + for k,v in value.items(): + if isinstance(v,dict): + for k1,v1 in v.items(): + if k1 == "type" and v1 == "object": + object_parse_childs(k , v, 0) + +def generatecfiles( pdir ): + securemkdir(pdir) + dmfpc = open(pdir + "/example" + ".c", "w") + dmfph = open(pdir + "/example" + ".h", "w") + makefile = open(pdir + "/Makefile", "w") + + cprinttopfile(dmfpc) + hprinttopfile(dmfph) + printmakefile(makefile) + + try: + tmpf = open("./.objroot.c", "r") + tmpd = tmpf.read() + tmpf.close() + dmfpc.write(tmpd) + except: + pass + try: + tmpf = open("./.objparamarray.c", "r") + tmpd = tmpf.read() + tmpf.close() + dmfpc.write(tmpd) + except: + pass + try: + tmpf = open("./.objparamarray.h", "r") + tmpd = tmpf.read() + tmpf.close() + dmfph.write(tmpd) + print >> dmfph, "" + except: + pass + try: + exists = os.path.isfile("./.objbrowse.c") + if exists: + print >> dmfpc, "/*************************************************************" + print >> dmfpc, " * ENTRY METHOD" + print >> dmfpc, "/*************************************************************/" + tmpf = open("./.objbrowse.c", "r") + tmpd = tmpf.read() + tmpf.close() + dmfpc.write(tmpd) + except: + pass + try: + tmpf = open("./.objbrowse.h", "r") + tmpd = tmpf.read() + tmpf.close() + dmfph.write(tmpd) + print >> dmfph, "" + except: + pass + try: + exists = os.path.isfile("./.objadddel.c") + if exists: + print >> dmfpc, "/*************************************************************" + print >> dmfpc, " * ADD & DEL OBJ" + print >> dmfpc, "/*************************************************************/" + tmpf = open("./.objadddel.c", "r") + tmpd = tmpf.read() + tmpf.close() + dmfpc.write(tmpd) + except: + pass + try: + tmpf = open("./.objadddel.h", "r") + tmpd = tmpf.read() + tmpf.close() + dmfph.write(tmpd) + print >> dmfph, "" + except: + pass + try: + exists = os.path.isfile("./.getstevalue.c") + if exists: + print >> dmfpc, "/*************************************************************" + print >> dmfpc, " * GET & SET PARAM" + print >> dmfpc, "/*************************************************************/" + tmpf = open("./.getstevalue.c", "r") + tmpd = tmpf.read() + tmpf.close() + dmfpc.write(tmpd) + except: + pass + try: + tmpf = open("./.getstevalue.h", "r") + tmpd = tmpf.read() + tmpf.close() + dmfph.write(tmpd) + except: + pass + try: + exists = os.path.isfile("./.operate.c") + if exists: + print >> dmfpc, "/*************************************************************" + print >> dmfpc, " * OPERATE" + print >> dmfpc, "/*************************************************************/" + tmpf = open("./.operate.c", "r") + tmpd = tmpf.read() + tmpf.close() + dmfpc.write(tmpd) + except: + pass + try: + tmpf = open("./.operate.h", "r") + tmpd = tmpf.read() + tmpf.close() + dmfph.write(tmpd) + except: + pass + hprintfootfile(dmfph) + removetmpfiles() + +def generatestartedobject( key , value ): + obj_type = getoptionparam(value, "type") + if obj_type == "operate": + key = key.replace(".{i}.", ".*.") + if key not in ListOperate: + ListOperate.append(key) + else: + key = key.replace(".{i}", "") + obj = '.'.join(key.split(".")[0:key.count('.')-1]) + '.' + if obj not in ListObjects: + ListObjects.append(obj) + +def generateRootDynamicarray( ): + cprintheaderRootDynamicObj() + for x in ListObjects: + printObjRootDynamic(x) + printtailArrayRootDynamic() + + cprintheaderRootDynamicOperate() + for x in ListOperate: + commonname = getname(x) + printOperateRootDynamic(x, commonname) + cprintOperate(commonname) + hprintOperate(commonname) + printtailArrayRootDynamic() + +def removetmpfiles( ): + removefile("./.objparamarray.c") + removefile("./.objparamarray.h") + removefile("./.objadddel.c") + removefile("./.objadddel.h") + removefile("./.objbrowse.c") + removefile("./.objbrowse.h") + removefile("./.getstevalue.c") + removefile("./.getstevalue.h") + removefile("./.operate.c") + removefile("./.operate.h") + removefile("./.objroot.c") + +### main ### +if len(sys.argv) < 2: + printusage() + exit(1) + +if (sys.argv[1]).lower() == "-h" or (sys.argv[1]).lower() == "--help": + printusage() + exit(1) + +json_file = sys.argv[1] +gendir = "example" +removetmpfiles() + +with open(json_file) as file: + data = json.loads(file.read(), object_pairs_hook=OrderedDict) + +ListObjects = [] +ListOperate = [] +for i,(key,value) in enumerate(data.items()): + generatestartedobject(key, value) + +generateRootDynamicarray() + +for x in ListObjects: + printheaderObjCommon(x) + cprintheaderOBJS(x) + hprintheaderOBJS(x) + for i,(key,value) in enumerate(data.items()): + obj_type = getoptionparam(value, "type") + if obj_type == "operate": + continue + objstart = key + key = key.replace(".{i}", "") + obj = '.'.join(key.split(".")[0:key.count('.')-1]) + '.' + if x == obj: + printOBJline(objstart, value) + printtailArray() + +for i,(key,value) in enumerate(data.items()): + objstart = key + device = key.split(".") + if device[0] == None: + print "Wrong JSON Data model format!" + exit(1) + object_parse_childs(objstart, value, 0) + +generatecfiles(gendir) + +if (os.path.isdir(gendir)): + print "Source code generated under \"./%s\" folder" % gendir +else: + print "No source code generated!" + diff --git a/pictures/rootdynamicobj.png b/pictures/rootdynamicobj.png new file mode 100644 index 00000000..62ab003c Binary files /dev/null and b/pictures/rootdynamicobj.png differ diff --git a/pictures/rootdynamincoperate.png b/pictures/rootdynamincoperate.png new file mode 100644 index 00000000..75fe6b3a Binary files /dev/null and b/pictures/rootdynamincoperate.png differ