diff --git a/dmtree/tr181/device.c b/dmtree/tr181/device.c index b706d2a7..3c3ece86 100644 --- a/dmtree/tr181/device.c +++ b/dmtree/tr181/device.c @@ -15,10 +15,7 @@ #include "managementserver.h" #include "times.h" #include "upnp.h" -#include "x_iopsys_eu_ice.h" #include "x_iopsys_eu_igmp.h" -#include "x_iopsys_eu_ipacccfg.h" -#include "x_iopsys_eu_logincfg.h" #include "x_iopsys_eu_power_mgmt.h" #include "x_iopsys_eu_syslog.h" #include "xmpp.h" diff --git a/dmtree/tr181/x_iopsys_eu_ice.c b/dmtree/tr181/x_iopsys_eu_ice.c deleted file mode 100644 index d9b47944..00000000 --- a/dmtree/tr181/x_iopsys_eu_ice.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (C) 2019 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 Imen Bhiri - * - */ - -#include "x_iopsys_eu_ice.h" - -static int get_ice_cloud_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_option_value_string("ice", "cloud", "enabled", value); - return 0; -} - -static int set_ice_cloud_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - bool b; - - switch (action) { - case VALUECHECK: - if (dm_validate_boolean(value)) - return FAULT_9007; - return 0; - case VALUESET: - string_to_bool(value, &b); - dmuci_set_value("ice", "cloud", "enabled", b ? "1" : "0"); - return 0; - } - return 0; -} - -static int get_ice_cloud_server(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_option_value_string("ice", "cloud", "server", value); - return 0; -} - -static int set_ice_cloud_server(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - return 0; - case VALUESET: - if (value[0] == '\0') - return 0; - dmuci_set_value("ice", "cloud", "server", value); - return 0; - } - return 0; -} - -/*** DMROOT.X_IOPSYS_EU_ICE. ***/ -DMLEAF tSe_IceParam[] = { -/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification, bbfdm_type*/ -{"Enable", &DMWRITE, DMT_BOOL, get_ice_cloud_enable, set_ice_cloud_enable, NULL, NULL, BBFDM_BOTH}, -{"Server", &DMWRITE, DMT_STRING, get_ice_cloud_server, set_ice_cloud_server, NULL, NULL, BBFDM_BOTH}, -{0} -}; diff --git a/dmtree/tr181/x_iopsys_eu_ice.h b/dmtree/tr181/x_iopsys_eu_ice.h deleted file mode 100644 index 3efefd74..00000000 --- a/dmtree/tr181/x_iopsys_eu_ice.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (C) 2019 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 Imen Bhiri - * - */ - -#ifndef __SE_ICE_H -#define __SE_ICE_H - -#include - -extern DMLEAF tSe_IceParam[]; - -#endif diff --git a/dmtree/tr181/x_iopsys_eu_ipacccfg.c b/dmtree/tr181/x_iopsys_eu_ipacccfg.c deleted file mode 100644 index 1895501d..00000000 --- a/dmtree/tr181/x_iopsys_eu_ipacccfg.c +++ /dev/null @@ -1,727 +0,0 @@ -/* - * Copyright (C) 2019 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 Imen Bhiri - * Author Omar Kallel - * - */ - -#include "x_iopsys_eu_ipacccfg.h" - - -/************************************************************************************* -**** function related to get_object_ip_acc_list_cfgobj **** -**************************************************************************************/ -static int get_x_bcm_com_ip_acc_list_cfgobj_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string((struct uci_section *)data, "enabled", value); - if ((*value)[0] == '\0') { - *value = "1"; - } - return 0; -} - -static int set_x_bcm_com_ip_acc_list_cfgobj_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - bool b; - - switch (action) { - case VALUECHECK: - if (dm_validate_boolean(value)) - return FAULT_9007; - return 0; - case VALUESET: - string_to_bool(value, &b); - if(b) { - value = ""; - } - else { - value = "0"; - } - dmuci_set_value_by_section((struct uci_section *)data, "enabled", value); - return 0; - } - return 0; -} - -static int get_x_bcm_com_ip_acc_list_cfgobj_ipversion(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string((struct uci_section *)data, "family", value); - return 0; -} - -static int set_x_bcm_com_ip_acc_list_cfgobj_ipversion(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - return 0; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "family", value); - return 0; - } - return 0; -} - -static int get_x_bcm_com_ip_acc_list_cfgobj_protocol(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string((struct uci_section *)data, "proto", value); - return 0; -} - -static int set_x_bcm_com_ip_acc_list_cfgobj_protocol(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - return 0; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "proto", value); - return 0; - } - return 0; -} - -static int get_x_bcm_com_ip_acc_list_cfgobj_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string((struct uci_section *)data, "name", value); - return 0; -} - -static int set_x_bcm_com_ip_acc_list_cfgobj_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - return 0; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "name", value); - return 0; - } - return 0; -} - -static int get_x_iopsys_eu_cfgobj_address_netmask(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - struct uci_list *val; - - dmuci_get_value_by_section_list((struct uci_section *)data, "src_ip", &val); - if (val) { - *value = dmuci_list_to_string(val, ","); - } else - *value = ""; - if ((*value)[0] == '\0') { - *value = "0.0.0.0/0"; - return 0; - } - return 0; -} - -static int set_x_iopsys_eu_cfgobj_address_netmask(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - char *pch, *spch, *val; - - switch (action) { - case VALUECHECK: - return 0; - case VALUESET: - dmuci_delete_by_section((struct uci_section *)data, "src_ip", ""); - val = dmstrdup(value); - pch = strtok_r(val, " ,", &spch); - while (pch != NULL) { - dmuci_add_list_value_by_section((struct uci_section *)data, "src_ip", pch); - pch = strtok_r(NULL, " ,", &spch); - } - dmfree(val); - return 0; - } - return 0; -} - -static int get_x_bcm_com_ip_acc_list_cfgobj_acc_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string((struct uci_section *)data, "dest_port", value); - return 0; -} - -static int set_x_bcm_com_ip_acc_list_cfgobj_acc_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - return 0; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "dest_port", value); - return 0; - } - return 0; -} - -static int get_x_bcm_com_ip_acc_list_cfgobj_target(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string((struct uci_section *)data, "target", value); - return 0; -} - -static int set_x_bcm_com_ip_acc_list_cfgobj_target(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - return 0; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "target", value); - return 0; - } - return 0; -} - -/************************************************************************************* -**** function related to get_cache_object_port_forwarding **** -**************************************************************************************/ -static int get_port_forwarding_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string((struct uci_section *)data, "name", value); - return 0; -} - -static int set_port_forwarding_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - return 0; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "name", value); - return 0; - } - return 0; -} - -static int get_port_forwarding_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string((struct uci_section *)data, "enabled", value); - return 0; -} - -static int set_port_forwarding_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - bool b; - - switch (action) { - case VALUECHECK: - if (dm_validate_boolean(value)) - return FAULT_9007; - return 0; - case VALUESET: - string_to_bool(value, &b); - if(b) - dmuci_set_value_by_section((struct uci_section *)data, "enabled", "1"); - else - dmuci_set_value_by_section((struct uci_section *)data, "enabled", "0"); - return 0; - } - return 0; -} - -static int get_port_forwarding_loopback(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string((struct uci_section *)data, "reflection", value); - if((*value)[0] == '\0') { - *value = "1"; - } - return 0; -} - -static int set_port_forwarding_loopback(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - bool b; - - switch (action) { - case VALUECHECK: - if (dm_validate_boolean(value)) - return FAULT_9007; - return 0; - case VALUESET: - string_to_bool(value, &b); - dmuci_set_value_by_section((struct uci_section *)data, "reflection", b ? "1" : "0"); - return 0; - } - return 0; -} - -static int get_port_forwarding_protocol(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string((struct uci_section *)data, "proto", value); - return 0; -} - -static int set_port_forwarding_protocol(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - return 0; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "proto", value); - return 0; - } - return 0; -} - -static int get_port_forwarding_external_zone(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string((struct uci_section *)data, "src", value); - return 0; -} - -static int set_port_forwarding_external_zone(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - return 0; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "src", value); - return 0; - } - return 0; -} - -static int get_port_forwarding_internal_zone(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string((struct uci_section *)data, "dest", value); - return 0; -} - -static int set_port_forwarding_internal_zone(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - return 0; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "dest", value); - return 0; - } - return 0; -} - -static int get_port_forwarding_external_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string((struct uci_section *)data, "src_dport", value); - return 0; -} - -static int set_port_forwarding_external_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - return 0; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "src_dport", value); - return 0; - } - return 0; -} - -static int get_port_forwarding_internal_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string((struct uci_section *)data, "dest_port", value); - if ((*value)[0] == '\0') { - *value = "any"; - } - return 0; -} - -static int set_port_forwarding_internal_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - return 0; - case VALUESET: - if (strcasecmp(value, "any") == 0) { - value = ""; - } - dmuci_set_value_by_section((struct uci_section *)data, "dest_port", value); - return 0; - } - return 0; -} - -static int get_port_forwarding_source_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string((struct uci_section *)data, "src_port", value); - if ((*value)[0] == '\0') { - *value = "any"; - } - return 0; -} - -static int set_port_forwarding_source_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - return 0; - case VALUESET: - if (strcasecmp(value, "any") == 0) { - value = ""; - } - dmuci_set_value_by_section((struct uci_section *)data, "src_port", value); - return 0; - } - return 0; -} - -static int get_port_forwarding_internal_ipaddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string((struct uci_section *)data, "dest_ip", value); - return 0; -} - -static int set_port_forwarding_internal_ipaddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - return 0; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "dest_ip", value); - return 0; - } - return 0; -} - -static int get_port_forwarding_external_ipaddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - dmuci_get_value_by_section_string((struct uci_section *)data, "src_dip", value); - if ((*value)[0] == '\0') { - *value = "any"; - } - return 0; -} - -static int set_port_forwarding_external_ipaddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - switch (action) { - case VALUECHECK: - return 0; - case VALUESET: - if (strcasecmp(value, "any") == 0) { - value = ""; - } - dmuci_set_value_by_section((struct uci_section *)data, "src_dip", value); - return 0; - } - return 0; -} - -static int get_port_forwarding_source_ipaddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - struct uci_list *val; - - dmuci_get_value_by_section_list((struct uci_section *)data, "src_ip", &val); - if (val) { - *value = dmuci_list_to_string(val, ","); - } else { - *value = ""; - } - if ((*value)[0] == '\0') { - *value = "any"; - } - return 0; -} - -static int set_port_forwarding_source_ipaddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - char *pch, *val, *spch; - - switch (action) { - case VALUECHECK: - return 0; - case VALUESET: - if (strcasecmp(value, "any") == 0) { - dmuci_delete_by_section((struct uci_section *)data, "src_ip", ""); - } else { - dmuci_delete_by_section((struct uci_section *)data, "src_ip", ""); - val = dmstrdup(value); - pch = strtok_r(val, " ,", &spch); - while (pch != NULL) { - dmuci_add_list_value_by_section((struct uci_section *)data, "src_ip", pch); - pch = strtok_r(NULL, " ,", &spch); - } - dmfree(val); - } - return 0; - } - return 0; -} - -static int get_port_forwarding_src_mac(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - struct uci_list *list = NULL; - - dmuci_get_value_by_section_list((struct uci_section *)data, "src_mac", &list); - *value = dmuci_list_to_string(list, " "); - return 0; -} - -static int set_port_forwarding_src_mac(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - char *pch, *spch; - - switch (action) { - case VALUECHECK: - return 0; - case VALUESET: - dmuci_delete_by_section((struct uci_section *)data, "src_mac", NULL); - value = dmstrdup(value); - pch = strtok_r(value, " ", &spch); - while (pch != NULL) { - dmuci_add_list_value_by_section((struct uci_section *)data, "src_mac", pch); - pch = strtok_r(NULL, " ", &spch); - } - dmfree(value); - return 0; - } - return 0; -} - -/***** ADD DEL OBJ *******/ -static int add_ipacccfg_rule(char *refparam, struct dmctx *ctx, void *data, char **instancepara) -{ - char *value, *v, *instance; - struct uci_section *rule = NULL, *dmmap_rule = NULL; - - check_create_dmmap_package("dmmap_firewall"); - instance = get_last_instance_bbfdm("dmmap_firewall", "rule", "fruleinstance"); - dmuci_add_section_and_rename("firewall", "rule", &rule, &value); - dmuci_set_value_by_section(rule, "type", "generic"); - dmuci_set_value_by_section(rule, "name", "new_rule"); - dmuci_set_value_by_section(rule, "proto", "all"); - dmuci_set_value_by_section(rule, "target", "ACCPET"); - dmuci_set_value_by_section(rule, "family", "ipv4"); - dmuci_set_value_by_section(rule, "enabled", "1"); - dmuci_set_value_by_section(rule, "hidden", "1"); - dmuci_set_value_by_section(rule, "parental", "0"); - - dmuci_add_section_bbfdm("dmmap_firewall", "rule", &dmmap_rule, &v); - dmuci_set_value_by_section(dmmap_rule, "section_name", section_name(rule)); - *instancepara = update_instance_bbfdm(dmmap_rule, instance, "fruleinstance"); - return 0; -} - -static int delete_ipacccfg_rule(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action) -{ - struct uci_section *s = NULL, *ss = NULL, *dmmap_section = NULL; - int found = 0; - - switch (del_action) { - case DEL_INST: - get_dmmap_section_of_config_section("dmmap_firewall", "rule", section_name((struct uci_section *)data), &dmmap_section); - if (dmmap_section) - dmuci_delete_by_section(dmmap_section, NULL, NULL); - dmuci_delete_by_section((struct uci_section *)data, NULL, NULL); - break; - case DEL_ALL: - uci_foreach_sections("firewall", "rule", s) { - if (found != 0) { - get_dmmap_section_of_config_section("dmmap_firewall", "rule", section_name(s), &dmmap_section); - if (dmmap_section) - dmuci_delete_by_section(dmmap_section, NULL, NULL); - dmuci_delete_by_section(ss, NULL, NULL); - } - ss = s; - found++; - } - if (ss != NULL) { - get_dmmap_section_of_config_section("dmmap_firewall", "rule", section_name(ss), &dmmap_section); - if (dmmap_section) - dmuci_delete_by_section(dmmap_section, NULL, NULL); - dmuci_delete_by_section(ss, NULL, NULL); - } - break; - } - - return 0; -} - -static int add_ipacccfg_port_forwarding(char *refparam, struct dmctx *ctx, void *data, char **instancepara) -{ - char *value, *v, *instance; - struct uci_section *redirect = NULL, *dmmap_redirect = NULL; - - check_create_dmmap_package("dmmap_firewall"); - instance = get_last_instance_bbfdm("dmmap_firewall", "redirect", "forwardinstance"); - dmuci_add_section_and_rename("firewall", "redirect", &redirect, &value); - dmuci_set_value_by_section(redirect, "enabled", "0"); - dmuci_set_value_by_section(redirect, "target", "DNAT"); - dmuci_set_value_by_section(redirect, "proto", "tcp udp"); - - dmuci_add_section_bbfdm("dmmap_firewall", "redirect", &dmmap_redirect, &v); - dmuci_set_value_by_section(dmmap_redirect, "section_name", section_name(redirect)); - *instancepara = update_instance_bbfdm(dmmap_redirect, instance, "forwardinstance"); - return 0; -} - - -static int delete_ipacccfg_port_forwarding(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action) -{ - int found = 0; - struct uci_section *forwardsection = (struct uci_section *)data, *s = NULL, *ss = NULL, *dmmap_section = NULL; - - switch (del_action) { - case DEL_INST: - get_dmmap_section_of_config_section("dmmap_firewall", "redirect", section_name(forwardsection), &dmmap_section); - if (dmmap_section) - dmuci_delete_by_section(dmmap_section, NULL, NULL); - dmuci_delete_by_section(forwardsection, NULL, NULL); - break; - case DEL_ALL: - uci_foreach_option_eq("firewall", "redirect", "target", "DNAT", s) { - if (found != 0) { - get_dmmap_section_of_config_section("dmmap_firewall", "redirect", section_name(s), &dmmap_section); - if (dmmap_section) - dmuci_delete_by_section(dmmap_section, NULL, NULL); - dmuci_delete_by_section(ss, NULL, NULL); - } - ss = s; - found++; - } - if (ss != NULL) { - get_dmmap_section_of_config_section("dmmap_firewall", "redirect", section_name(ss), &dmmap_section); - if (dmmap_section) - dmuci_delete_by_section(dmmap_section, NULL, NULL); - dmuci_delete_by_section(ss, NULL, NULL); - } - break; - } - return 0; -} - -////////////////////////SET AND GET ALIAS///////////////////////////////// -static int get_x_iopsys_eu_cfgobj_address_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - struct uci_section *ipaccsection = (struct uci_section *)data; - struct uci_section *dmmap_section = NULL; - - get_dmmap_section_of_config_section("dmmap_firewall", "rule", section_name(ipaccsection), &dmmap_section); - if (dmmap_section) - dmuci_get_value_by_section_string(dmmap_section, "frulealias", value); - return 0; -} - -static int set_x_iopsys_eu_cfgobj_address_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - struct uci_section *ipaccsection = (struct uci_section *)data; - struct uci_section *dmmap_section = NULL; - - switch (action) { - case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) - return FAULT_9007; - return 0; - case VALUESET: - get_dmmap_section_of_config_section("dmmap_firewall", "rule", section_name(ipaccsection), &dmmap_section); - if (dmmap_section) - dmuci_set_value_by_section(dmmap_section, "frulealias", value); - return 0; - } - return 0; -} - -static int get_port_forwarding_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) -{ - struct uci_section *forwardsection = (struct uci_section *)data; - struct uci_section *dmmap_section = NULL; - - get_dmmap_section_of_config_section("dmmap_firewall", "redirect", section_name(forwardsection), &dmmap_section); - if (dmmap_section) - dmuci_get_value_by_section_string(dmmap_section, "forwardalias", value); - return 0; -} - -static int set_port_forwarding_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - struct uci_section *forwardsection = (struct uci_section *)data; - struct uci_section *dmmap_section = NULL; - - switch (action) { - case VALUECHECK: - if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0)) - return FAULT_9007; - return 0; - case VALUESET: - get_dmmap_section_of_config_section("dmmap_firewall", "redirect", section_name(forwardsection), &dmmap_section); - if (dmmap_section) - dmuci_set_value_by_section(dmmap_section, "forwardalias", value); - return 0; - } - return 0; -} - -static int browseAccListInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - char *irule = NULL, *irule_last = NULL; - struct dmmap_dup *p; - LIST_HEAD(dup_list); - - synchronize_specific_config_sections_with_dmmap("firewall", "rule", "dmmap_firewall", &dup_list); - list_for_each_entry(p, &dup_list, list) { - irule = handle_update_instance(1, dmctx, &irule_last, update_instance_alias_bbfdm, 3, p->dmmap_section, "fruleinstance", "frulealias"); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, irule) == DM_STOP) - break; - } - free_dmmap_config_dup_list(&dup_list); - return 0; -} - -static int browseport_forwardingInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) -{ - char *iforward = NULL, *iforward_last = NULL; - struct dmmap_dup *p; - LIST_HEAD(dup_list); - - synchronize_specific_config_sections_with_dmmap_eq("firewall", "redirect", "dmmap_firewall", "target", "DNAT", &dup_list); - list_for_each_entry(p, &dup_list, list) { - iforward = handle_update_instance(1, dmctx, &iforward_last, update_instance_alias, 3, p->dmmap_section, "forwardinstance", "forwardalias"); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, iforward) == DM_STOP) - break; - } - free_dmmap_config_dup_list(&dup_list); - return 0; -} - -/*** DMROOT.X_IOPSYS_EU_IpAccCfg. ***/ -DMOBJ tSe_IpAccObj[] = { -/* 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} -}; - -DMLEAF tSe_PortForwardingParam[] = { -/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification, bbfdm_type*/ -{"Alias", &DMWRITE, DMT_STRING, get_port_forwarding_alias, set_port_forwarding_alias, NULL, NULL, BBFDM_BOTH}, -{"Name", &DMWRITE, DMT_STRING, get_port_forwarding_name, set_port_forwarding_name, NULL, NULL, BBFDM_BOTH}, -{"Enable", &DMWRITE, DMT_BOOL, get_port_forwarding_enable, set_port_forwarding_enable, NULL, NULL, BBFDM_BOTH}, -{"EnalbeNatLoopback", &DMWRITE, DMT_BOOL, get_port_forwarding_loopback, set_port_forwarding_loopback, NULL, NULL, BBFDM_BOTH}, -{"Protocol", &DMWRITE, DMT_STRING, get_port_forwarding_protocol, set_port_forwarding_protocol, NULL, NULL, BBFDM_BOTH}, -{"ExternalZone", &DMWRITE, DMT_STRING, get_port_forwarding_external_zone, set_port_forwarding_external_zone, NULL, NULL, BBFDM_BOTH}, -{"InternalZone", &DMWRITE, DMT_STRING, get_port_forwarding_internal_zone, set_port_forwarding_internal_zone, NULL, NULL, BBFDM_BOTH}, -{"ExternalPort", &DMWRITE, DMT_STRING, get_port_forwarding_external_port, set_port_forwarding_external_port, NULL, NULL, BBFDM_BOTH}, -{"InternalPort", &DMWRITE, DMT_STRING, get_port_forwarding_internal_port, set_port_forwarding_internal_port, NULL, NULL, BBFDM_BOTH}, -{"SourcePort", &DMWRITE, DMT_STRING, get_port_forwarding_source_port, set_port_forwarding_source_port, NULL, NULL, BBFDM_BOTH}, -{"InternalIpAddress", &DMWRITE, DMT_STRING, get_port_forwarding_internal_ipaddress, set_port_forwarding_internal_ipaddress, NULL, NULL, BBFDM_BOTH}, -{"ExternalIpAddress", &DMWRITE, DMT_STRING, get_port_forwarding_external_ipaddress, set_port_forwarding_external_ipaddress, NULL, NULL, BBFDM_BOTH}, -{"SourceIpAddress", &DMWRITE, DMT_STRING, get_port_forwarding_source_ipaddress, set_port_forwarding_source_ipaddress, NULL, NULL, BBFDM_BOTH}, -{"SourceMacAddress", &DMWRITE, DMT_STRING, get_port_forwarding_src_mac, set_port_forwarding_src_mac, NULL, NULL, BBFDM_BOTH}, -{0} -}; - -DMLEAF tSe_IpAccCfgParam[] = { -/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification, bbfdm_type*/ -{"Alias", &DMWRITE, DMT_STRING, get_x_iopsys_eu_cfgobj_address_alias, set_x_iopsys_eu_cfgobj_address_alias, NULL, NULL, BBFDM_BOTH}, -{"Enable", &DMWRITE, DMT_BOOL, get_x_bcm_com_ip_acc_list_cfgobj_enable, set_x_bcm_com_ip_acc_list_cfgobj_enable, NULL, NULL, BBFDM_BOTH}, -{"IPVersion", &DMWRITE, DMT_STRING, get_x_bcm_com_ip_acc_list_cfgobj_ipversion, set_x_bcm_com_ip_acc_list_cfgobj_ipversion, NULL, NULL, BBFDM_BOTH}, -{"Protocol", &DMWRITE, DMT_STRING, get_x_bcm_com_ip_acc_list_cfgobj_protocol, set_x_bcm_com_ip_acc_list_cfgobj_protocol, NULL, NULL, BBFDM_BOTH}, -{"FilterName", &DMWRITE, DMT_STRING, get_x_bcm_com_ip_acc_list_cfgobj_name, set_x_bcm_com_ip_acc_list_cfgobj_name, NULL, NULL, BBFDM_BOTH}, -{"AccAddressAndNetMask", &DMWRITE, DMT_STRING, get_x_iopsys_eu_cfgobj_address_netmask, set_x_iopsys_eu_cfgobj_address_netmask, NULL, NULL, BBFDM_BOTH}, -{"AccPort", &DMWRITE, DMT_STRING, get_x_bcm_com_ip_acc_list_cfgobj_acc_port, set_x_bcm_com_ip_acc_list_cfgobj_acc_port, NULL, NULL, BBFDM_BOTH}, -{"Target", &DMWRITE, DMT_STRING, get_x_bcm_com_ip_acc_list_cfgobj_target, set_x_bcm_com_ip_acc_list_cfgobj_target, NULL, NULL, BBFDM_BOTH}, -{0} -}; diff --git a/dmtree/tr181/x_iopsys_eu_ipacccfg.h b/dmtree/tr181/x_iopsys_eu_ipacccfg.h deleted file mode 100644 index bf1b9a34..00000000 --- a/dmtree/tr181/x_iopsys_eu_ipacccfg.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2019 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 Imen Bhiri - * Author Omar Kallel - * - */ - -#ifndef __SE_IPACCCFG_H -#define __SE_IPACCCFG_H - -#include - -extern DMOBJ tSe_IpAccObj[]; -extern DMLEAF tSe_IpAccCfgParam[]; -extern DMLEAF tSe_PortForwardingParam[]; - -#endif diff --git a/dmtree/tr181/x_iopsys_eu_logincfg.c b/dmtree/tr181/x_iopsys_eu_logincfg.c deleted file mode 100644 index 1f7389e8..00000000 --- a/dmtree/tr181/x_iopsys_eu_logincfg.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (C) 2019 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 Imen Bhiri - * - */ - -#include "x_iopsys_eu_logincfg.h" - - -static int set_x_bcm_password(char *refparam, struct dmctx *ctx, int action, char *value, char *user_type) -{ - switch (action) { - case VALUECHECK: - return 0; - case VALUESET: - dmuci_set_value("passwords", user_type, "password", value); - return 0; - } - return 0; -} - -static int set_x_bcm_admin_password(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - set_x_bcm_password(refparam, ctx, action, value, "admin"); - return 0; -} - -static int set_x_bcm_support_password(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - set_x_bcm_password(refparam, ctx, action, value, "support"); - return 0; -} - -static int set_x_bcm_user_password(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - set_x_bcm_password(refparam, ctx, action, value, "user"); - return 0; -} - -static int set_x_bcm_root_password(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - set_x_bcm_password(refparam, ctx, action, value, "root"); - return 0; -} - -/*** DMROOT.X_IOPSYS_EU_LoginCfg. ***/ -DMLEAF tSe_LoginCfgParam[] = { -/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification, bbfdm_type*/ -{"AdminPassword", &DMWRITE, DMT_STRING, get_empty, set_x_bcm_admin_password, NULL, NULL, BBFDM_BOTH}, -{"SupportPassword", &DMWRITE, DMT_STRING, get_empty, set_x_bcm_support_password, NULL, NULL, BBFDM_BOTH}, -{"UserPassword", &DMWRITE, DMT_STRING, get_empty, set_x_bcm_user_password, NULL, NULL, BBFDM_BOTH}, -{"RootPassword", &DMWRITE, DMT_STRING, get_empty, set_x_bcm_root_password, NULL, NULL, BBFDM_BOTH}, -{0} -}; diff --git a/dmtree/tr181/x_iopsys_eu_logincfg.h b/dmtree/tr181/x_iopsys_eu_logincfg.h deleted file mode 100644 index b6467550..00000000 --- a/dmtree/tr181/x_iopsys_eu_logincfg.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (C) 2019 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 Imen Bhiri - * - */ - -#ifndef __SE_LOGINCFG_H -#define __SE_LOGINCFG_H - -#include - -extern DMLEAF tSe_LoginCfgParam[]; - -#endif