Delete some unused functions && get ip_version from cwmp uci config

This commit is contained in:
Omar Kallel 2020-12-15 14:23:41 +01:00
parent 80839e0903
commit 3d4ac802c2
9 changed files with 3 additions and 89 deletions

View file

@ -46,12 +46,6 @@ void bbf_uci_revert_bbfdm(void)
dmuci_exit_bbfdm();
}
int bbf_set_ip_version(int ipversion)
{
ip_version = ipversion;
return 0;
}
void del_list_parameter(struct dm_parameter *dm_parameter)
{
api_del_list_parameter(dm_parameter);

View file

@ -21,7 +21,6 @@ void bbf_uci_commit_bbfdm(void);
void bbf_uci_revert_bbfdm(void);
int set_bbfdatamodel_type(int bbf_type);
int get_bbfdatamodel_type(void);
int bbf_set_ip_version(int ipversion);
void del_list_parameter(struct dm_parameter *dm_parameter);
void dmjson_parse_init(char *msg);
void dmjson_parse_fini(void);

View file

@ -725,72 +725,6 @@ static int get_SoftwareModulesExecutionUnit_ExecutionEnvRef(char *refparam, stru
return 0;
}
char *get_deployment_unit_reference(struct dmctx *ctx, char *package_name, char *package_env)
{
char *linker, *value;
dmasprintf(&linker, "%s-%s", package_name, package_env);
adm_entry_get_linker_param(ctx, dm_print_path("%s%cSoftwareModules%cDeploymentUnit%c", dmroot, dm_delim, dm_delim, dm_delim), linker, &value);
return value;
}
void get_deployment_unit_name_version(char *uuid, char **name, char **version, char **env)
{
json_object *res = NULL, *du_obj = NULL, *arrobj = NULL;
int j = 0;
char *cur_uuid;
dmubus_call("swmodules", "du_list", UBUS_ARGS{}, 0, &res);
if (res) {
dmjson_foreach_obj_in_array(res, arrobj, du_obj, j, 1, "deployment_unit") {
cur_uuid = dmjson_get_value(du_obj, 1, "uuid");
if (strcmp(cur_uuid, uuid) == 0) {
*name = dmjson_get_value(du_obj, 1, "name");
*version = dmjson_get_value(du_obj, 1, "version");
*env = dmjson_get_value(du_obj, 1, "environment");
return;
}
}
}
}
char *get_softwaremodules_uuid(char *url)
{
json_object *res = NULL, *du_obj = NULL, *arrobj = NULL;
char *cur_url, *uuid = "";
int j = 0;
dmubus_call("swmodules", "du_list", UBUS_ARGS{}, 0, &res);
if (res) {
dmjson_foreach_obj_in_array(res, arrobj, du_obj, j, 1, "deployment_unit") {
cur_url = dmjson_get_value(du_obj, 1, "url");
if (strcmp(cur_url, url) == 0) {
uuid = dmjson_get_value(du_obj, 1, "uuid");
break;
}
}
}
return uuid;
}
char *get_softwaremodules_url(char *uuid)
{
json_object *res = NULL, *du_obj = NULL, *arrobj = NULL;
char *cur_uuid, *url = "";
int j = 0;
dmubus_call("swmodules", "du_list", UBUS_ARGS{}, 0, &res);
if (res) {
dmjson_foreach_obj_in_array(res, arrobj, du_obj, j, 1, "deployment_unit") {
cur_uuid = dmjson_get_value(du_obj, 1, "uuid");
if (strcmp(cur_uuid, uuid) == 0) {
url = dmjson_get_value(du_obj, 1, "url");
break;
}
}
}
return url;
}
/* *** Device.SoftwareModules. *** */
DMOBJ tSoftwareModulesObj[] = {
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/

View file

@ -20,8 +20,6 @@ extern DMLEAF tSoftwareModulesDeploymentUnitParams[];
extern DMOBJ tSoftwareModulesExecutionUnitObj[];
extern DMLEAF tSoftwareModulesExecutionUnitParams[];
char *get_deployment_unit_reference(struct dmctx *ctx, char *package_name, char *package_env);
void get_deployment_unit_name_version(char *uuid, char **name, char **version, char **env);
char *get_softwaremodules_uuid(char *url);
char *get_softwaremodules_url(char *uuid);

View file

@ -86,15 +86,6 @@ char *get_softwareversion()
return os__get_softwareversion();
}
int lookup_vcf_name(char *instance, char **value)
{
struct uci_section *s = NULL;
uci_path_foreach_option_eq(bbfdm, DMMAP, "vcf", "vcf_instance", instance, s) {
dmuci_get_value_by_section_string(s, "name", value);
}
return 0;
}
static int get_device_manufacturer(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = get_deviceid_manufacturer();

View file

@ -32,6 +32,5 @@ char *get_deviceid_manufactureroui();
char *get_deviceid_productclass();
char *get_deviceid_serialnumber();
char *get_softwareversion();
int lookup_vcf_name(char *instance, char **value);
#endif

View file

@ -95,7 +95,6 @@ LIST_HEAD(list_upnp_changed_version);
LIST_HEAD(list_enabled_notify);
int ip_version = 4;
char dm_delim = DMDELIM_CWMP;
char dmroot[64] = "Device";
int bbfdatamodel_type = BBFDM_BOTH;

View file

@ -559,7 +559,6 @@ extern struct list_head list_upnp_changed_onalarm;
extern struct list_head list_upnp_changed_version;
#endif
extern int ip_version;
extern char dm_delim;
extern char dmroot[64];
extern char *DMT_TYPE[];

View file

@ -326,7 +326,7 @@ int network_get_ipaddr(char **value, char *iface)
{
json_object *res, *jobj;
char *ipv6_value = "";
char *ip_version = NULL;
dmubus_call("network.interface", "status", UBUS_ARGS{{"interface", iface, String}}, 1, &res);
DM_ASSERT(res, *value = "");
jobj = dmjson_select_obj_in_array_idx(res, 0, 1, "ipv4-address");
@ -334,10 +334,11 @@ int network_get_ipaddr(char **value, char *iface)
jobj = dmjson_select_obj_in_array_idx(res, 0, 1, "ipv6-address");
ipv6_value = dmjson_get_value(jobj, 1, "address");
dmuci_get_option_value_string("cwmp", "acs", "ip_version", &ip_version);
if((*value)[0] == '\0' || ipv6_value[0] == '\0') {
if ((*value)[0] == '\0')
*value = ipv6_value;
} else if (ip_version == 6) {
} else if (ip_version && ip_version[0] == '6') {
*value = ipv6_value;
return 0;
}