mirror of
https://dev.iopsys.eu/bbf/bbfdm.git
synced 2025-12-10 07:44:39 +01:00
Delete some unused functions && get ip_version from cwmp uci config
This commit is contained in:
parent
80839e0903
commit
3d4ac802c2
9 changed files with 3 additions and 89 deletions
|
|
@ -46,12 +46,6 @@ void bbf_uci_revert_bbfdm(void)
|
||||||
dmuci_exit_bbfdm();
|
dmuci_exit_bbfdm();
|
||||||
}
|
}
|
||||||
|
|
||||||
int bbf_set_ip_version(int ipversion)
|
|
||||||
{
|
|
||||||
ip_version = ipversion;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void del_list_parameter(struct dm_parameter *dm_parameter)
|
void del_list_parameter(struct dm_parameter *dm_parameter)
|
||||||
{
|
{
|
||||||
api_del_list_parameter(dm_parameter);
|
api_del_list_parameter(dm_parameter);
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ void bbf_uci_commit_bbfdm(void);
|
||||||
void bbf_uci_revert_bbfdm(void);
|
void bbf_uci_revert_bbfdm(void);
|
||||||
int set_bbfdatamodel_type(int bbf_type);
|
int set_bbfdatamodel_type(int bbf_type);
|
||||||
int get_bbfdatamodel_type(void);
|
int get_bbfdatamodel_type(void);
|
||||||
int bbf_set_ip_version(int ipversion);
|
|
||||||
void del_list_parameter(struct dm_parameter *dm_parameter);
|
void del_list_parameter(struct dm_parameter *dm_parameter);
|
||||||
void dmjson_parse_init(char *msg);
|
void dmjson_parse_init(char *msg);
|
||||||
void dmjson_parse_fini(void);
|
void dmjson_parse_fini(void);
|
||||||
|
|
|
||||||
|
|
@ -725,72 +725,6 @@ static int get_SoftwareModulesExecutionUnit_ExecutionEnvRef(char *refparam, stru
|
||||||
return 0;
|
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. *** */
|
/* *** Device.SoftwareModules. *** */
|
||||||
DMOBJ tSoftwareModulesObj[] = {
|
DMOBJ tSoftwareModulesObj[] = {
|
||||||
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/
|
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,6 @@ extern DMLEAF tSoftwareModulesDeploymentUnitParams[];
|
||||||
extern DMOBJ tSoftwareModulesExecutionUnitObj[];
|
extern DMOBJ tSoftwareModulesExecutionUnitObj[];
|
||||||
extern DMLEAF tSoftwareModulesExecutionUnitParams[];
|
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_uuid(char *url);
|
||||||
char *get_softwaremodules_url(char *uuid);
|
char *get_softwaremodules_url(char *uuid);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -86,15 +86,6 @@ char *get_softwareversion()
|
||||||
return os__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)
|
static int get_device_manufacturer(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
{
|
{
|
||||||
*value = get_deviceid_manufacturer();
|
*value = get_deviceid_manufacturer();
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,5 @@ char *get_deviceid_manufactureroui();
|
||||||
char *get_deviceid_productclass();
|
char *get_deviceid_productclass();
|
||||||
char *get_deviceid_serialnumber();
|
char *get_deviceid_serialnumber();
|
||||||
char *get_softwareversion();
|
char *get_softwareversion();
|
||||||
int lookup_vcf_name(char *instance, char **value);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,6 @@ LIST_HEAD(list_upnp_changed_version);
|
||||||
|
|
||||||
LIST_HEAD(list_enabled_notify);
|
LIST_HEAD(list_enabled_notify);
|
||||||
|
|
||||||
int ip_version = 4;
|
|
||||||
char dm_delim = DMDELIM_CWMP;
|
char dm_delim = DMDELIM_CWMP;
|
||||||
char dmroot[64] = "Device";
|
char dmroot[64] = "Device";
|
||||||
int bbfdatamodel_type = BBFDM_BOTH;
|
int bbfdatamodel_type = BBFDM_BOTH;
|
||||||
|
|
|
||||||
|
|
@ -559,7 +559,6 @@ extern struct list_head list_upnp_changed_onalarm;
|
||||||
extern struct list_head list_upnp_changed_version;
|
extern struct list_head list_upnp_changed_version;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern int ip_version;
|
|
||||||
extern char dm_delim;
|
extern char dm_delim;
|
||||||
extern char dmroot[64];
|
extern char dmroot[64];
|
||||||
extern char *DMT_TYPE[];
|
extern char *DMT_TYPE[];
|
||||||
|
|
|
||||||
|
|
@ -326,7 +326,7 @@ int network_get_ipaddr(char **value, char *iface)
|
||||||
{
|
{
|
||||||
json_object *res, *jobj;
|
json_object *res, *jobj;
|
||||||
char *ipv6_value = "";
|
char *ipv6_value = "";
|
||||||
|
char *ip_version = NULL;
|
||||||
dmubus_call("network.interface", "status", UBUS_ARGS{{"interface", iface, String}}, 1, &res);
|
dmubus_call("network.interface", "status", UBUS_ARGS{{"interface", iface, String}}, 1, &res);
|
||||||
DM_ASSERT(res, *value = "");
|
DM_ASSERT(res, *value = "");
|
||||||
jobj = dmjson_select_obj_in_array_idx(res, 0, 1, "ipv4-address");
|
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");
|
jobj = dmjson_select_obj_in_array_idx(res, 0, 1, "ipv6-address");
|
||||||
ipv6_value = dmjson_get_value(jobj, 1, "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' || ipv6_value[0] == '\0') {
|
||||||
if ((*value)[0] == '\0')
|
if ((*value)[0] == '\0')
|
||||||
*value = ipv6_value;
|
*value = ipv6_value;
|
||||||
} else if (ip_version == 6) {
|
} else if (ip_version && ip_version[0] == '6') {
|
||||||
*value = ipv6_value;
|
*value = ipv6_value;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue