remove deprecated vendor extension parameters

This commit is contained in:
Sukru Senli 2020-04-10 13:45:28 +02:00
parent f214d0efa1
commit d4c51501a0
11 changed files with 5 additions and 259 deletions

View file

@ -51,10 +51,7 @@ libbbfdm_la_SOURCES += \
../dmtree/tr181/managementserver.c \
../dmtree/tr181/times.c \
../dmtree/tr181/upnp.c \
../dmtree/tr181/x_iopsys_eu_ice.c \
../dmtree/tr181/x_iopsys_eu_igmp.c \
../dmtree/tr181/x_iopsys_eu_ipacccfg.c \
../dmtree/tr181/x_iopsys_eu_logincfg.c \
../dmtree/tr181/x_iopsys_eu_power_mgmt.c \
../dmtree/tr181/x_iopsys_eu_syslog.c \
../dmtree/tr181/x_iopsys_eu_dropbear.c \

View file

@ -14,10 +14,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 "softwaremodules.h"

View file

@ -78,10 +78,7 @@ DMOBJ tRoot_181_Obj[] = {
#ifdef BBF_TR104
{"Services", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE, NULL, tServicesObj, NULL, NULL, BBFDM_BOTH},
#endif
{CUSTOM_PREFIX"ICE", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE, NULL, NULL, tSe_IceParam, NULL, BBFDM_BOTH},
{CUSTOM_PREFIX"IGMP", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE, NULL, NULL, tSe_IgmpParam, NULL, BBFDM_BOTH},
{CUSTOM_PREFIX"IpAccCfg", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE, NULL, tSe_IpAccObj, NULL, NULL, BBFDM_BOTH},
{CUSTOM_PREFIX"LoginCfg", &DMREAD, NULL, NULL, NULL, NULL,NULL, &DMNONE, NULL, NULL, tSe_LoginCfgParam, NULL, BBFDM_BOTH},
{CUSTOM_PREFIX"PowerManagement", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE, NULL, NULL, tSe_PowerManagementParam, NULL, BBFDM_BOTH},
{CUSTOM_PREFIX"SyslogCfg", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE, NULL, NULL, tSe_SyslogCfgParam, NULL, BBFDM_BOTH},
{CUSTOM_PREFIX"Owsd", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE, NULL, XIopsysEuOwsdObj, XIopsysEuOwsdParams, NULL, BBFDM_BOTH},

View file

@ -87,93 +87,6 @@ int os__get_base_mac_addr(char *refparam, struct dmctx *ctx, void *data, char *i
return 0;
}
int os_iopsys_get_device_memory_bank(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
json_object *res;
dmubus_call("router.system", "memory_bank", UBUS_ARGS{{}}, 0, &res);
DM_ASSERT(res, *value = "");
*value = dmjson_get_value(res, 1, "code");
return 0;
}
int os_iopsys_set_device_memory_bank(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
//TODO
return 0;
case VALUESET:
dmubus_call_set("router.system", "memory_bank", UBUS_ARGS{{"bank", value, Integer}}, 1);
return 0;
}
return 0;
}
int os_iopsys_get_catv_enabled(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char *catv;
dmuci_get_option_value_string("catv", "catv", "enable", &catv);
if (strcmp(catv, "on") == 0)
*value = "1";
else
*value = "0";
return 0;
}
int os_iopsys_set_device_catvenabled(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("catv", "catv", "enable", b ? "on" : "off");
return 0;
}
return 0;
}
int os_iopsys_get_catv_optical_input_level(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
json_object *res;
dmubus_call("catv", "vpd", UBUS_ARGS{}, 0, &res);
DM_ASSERT(res, *value = "");
*value = dmjson_get_value(res, 1, "VPD");
return 0;
}
int os_iopsys_get_catv_rf_output_level(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
json_object *res;
dmubus_call("catv", "rf", UBUS_ARGS{}, 0, &res);
DM_ASSERT(res, *value = "");
*value = dmjson_get_value(res, 1, "RF");
return 0;
}
int os_iopsys_get_catv_temperature(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
json_object *res;
dmubus_call("catv", "temp", UBUS_ARGS{}, 0, &res);
DM_ASSERT(res, *value = "");
*value = dmjson_get_value(res, 1, "Temperature");
return 0;
}
int os_iopsys_get_catv_voltage(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
json_object *res;
dmubus_call("catv", "vcc", UBUS_ARGS{}, 0, &res);
DM_ASSERT(res, *value = "");
*value = dmjson_get_value(res, 1, "VCC");
return 0;
}
/*#Device.DeviceInfo.MemoryStatus.Total!UBUS:router.system/memory//total*/
int os__get_memory_status_total(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{

View file

@ -353,7 +353,6 @@ static int browseVlfInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_da
/* *** Device.DeviceInfo. *** */
DMOBJ tDeviceInfoObj[] = {
/* 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},
{"MemoryStatus", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tDeviceInfoMemoryStatusParams, NULL, BBFDM_BOTH},
@ -374,11 +373,7 @@ DMLEAF tDeviceInfoParams[] = {
{"DeviceLog", &DMREAD, DMT_STRING, get_device_devicelog, NULL, NULL, NULL, BBFDM_BOTH},
{"SpecVersion", &DMREAD, DMT_STRING, get_device_specversion, NULL, &DMFINFRM, NULL, BBFDM_BOTH},
{"ProvisioningCode", &DMWRITE, DMT_STRING, get_device_provisioningcode, set_device_provisioningcode, &DMFINFRM, &DMACTIVE, BBFDM_BOTH},
{CUSTOM_PREFIX"BaseMacAddr", &DMREAD, DMT_STRING, os__get_base_mac_addr, NULL, NULL, NULL, BBFDM_BOTH},
#ifndef GENERIC_OPENWRT
{CUSTOM_PREFIX"CATVEnabled", &DMWRITE, DMT_BOOL, os_iopsys_get_catv_enabled, os_iopsys_set_device_catvenabled, NULL, NULL, BBFDM_BOTH},
{CUSTOM_PREFIX"MemoryBank", &DMWRITE, DMT_INT, os_iopsys_get_device_memory_bank, os_iopsys_set_device_memory_bank, NULL, NULL, BBFDM_BOTH},
#endif
{CUSTOM_PREFIX"BaseMACAddr", &DMREAD, DMT_STRING, os__get_base_mac_addr, NULL, NULL, NULL, BBFDM_BOTH},
{0}
};

View file

@ -628,48 +628,6 @@ static int set_dns_server(char *refparam, struct dmctx *ctx, void *data, char *i
return 0;
}
static int get_dhcp_configurable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *s = NULL;
uci_foreach_option_eq("dhcp", "dhcp", "interface", ((struct dhcp_args *)data)->interface, s) {
*value = "1";
return 0;
}
*value = "0";
return 0;
}
static int set_dhcp_configurable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
bool b;
struct uci_section *s = NULL;
switch (action) {
case VALUECHECK:
if (dm_validate_boolean(value))
return FAULT_9007;
return 0;
case VALUESET:
string_to_bool(value, &b);
uci_foreach_option_eq("dhcp", "dhcp", "interface", ((struct dhcp_args *)data)->interface, s) {
if (!b) {
dmuci_delete_by_section(s, NULL, NULL);
}
break;
}
if (s == NULL && b) {
dmuci_set_value("dhcp",((struct dhcp_args *)data)->interface, NULL, "dhcp");
dmuci_set_value("dhcp", ((struct dhcp_args *)data)->interface, "interface", ((struct dhcp_args *)data)->interface);
dmuci_set_value("dhcp", ((struct dhcp_args *)data)->interface, "start", "100");
dmuci_set_value("dhcp", ((struct dhcp_args *)data)->interface, "limit", "150");
dmuci_set_value("dhcp", ((struct dhcp_args *)data)->interface, "leasetime", "12h");
}
return 0;
}
return 0;
}
/*#Device.DHCPv4.Server.Pool.{i}.Status!UCI:dhcp/interface,@i-1/ignore*/
static int get_dhcp_status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
@ -3013,7 +2971,6 @@ DMLEAF tDHCPv4ServerPoolParams[] = {
{"DNSServers", &DMWRITE, DMT_STRING, get_dns_server, set_dns_server, NULL, NULL, BBFDM_BOTH},
{"Status", &DMREAD, DMT_STRING, get_dhcp_status, NULL, NULL, NULL, BBFDM_BOTH},
{"Order", &DMWRITE, DMT_UNINT, get_dhcp_sever_pool_order, set_dhcp_sever_pool_order, NULL, NULL, BBFDM_BOTH},
{CUSTOM_PREFIX"DHCPServerConfigurable", &DMWRITE, DMT_BOOL, get_dhcp_configurable, set_dhcp_configurable, NULL, NULL, BBFDM_BOTH},
{"Enable", &DMWRITE, DMT_BOOL, get_dhcp_enable, set_dhcp_enable, NULL, NULL, BBFDM_BOTH},
{"MinAddress", &DMWRITE, DMT_STRING, get_dhcp_interval_address_min, set_dhcp_address_min, NULL, NULL, BBFDM_BOTH},
{"MaxAddress", &DMWRITE, DMT_STRING,get_dhcp_interval_address_max, set_dhcp_address_max, NULL, NULL, BBFDM_BOTH},

View file

@ -1279,8 +1279,8 @@ DMLEAF tFirewallChainRuleParams[] = {
{"DestPortRangeMax", &DMWRITE, DMT_INT, get_rule_dest_port_range_max, set_rule_dest_port_range_max, NULL, NULL, BBFDM_BOTH},
{"SourcePort", &DMWRITE, DMT_INT, get_rule_source_port, set_rule_source_port, NULL, NULL, BBFDM_BOTH},
{"SourcePortRangeMax", &DMWRITE, DMT_INT, get_rule_source_port_range_max, set_rule_source_port_range_max, NULL, NULL, BBFDM_BOTH},
{CUSTOM_PREFIX"IcmpType", &DMWRITE, DMT_STRING, get_rule_icmp_type, set_rule_icmp_type, NULL, NULL, BBFDM_BOTH},
{CUSTOM_PREFIX"SourceMac", &DMWRITE, DMT_STRING, get_rule_source_mac, set_rule_source_mac, NULL, NULL, BBFDM_BOTH},
{CUSTOM_PREFIX"ICMPType", &DMWRITE, DMT_STRING, get_rule_icmp_type, set_rule_icmp_type, NULL, NULL, BBFDM_BOTH},
{CUSTOM_PREFIX"SourceMACAddress", &DMWRITE, DMT_STRING, get_rule_source_mac, set_rule_source_mac, NULL, NULL, BBFDM_BOTH},
{0}
};

View file

@ -7,42 +7,6 @@ struct host_args
char *key;
};
static char * get_interface_type(char *mac, char *ndev)
{
json_object *res;
int wlctl_num;
struct uci_section *s, *d;
char buf[8], *p, *network, *value, *wunit;
uci_foreach_sections("wireless", "wifi-device", d) {
wlctl_num = 0;
wunit = section_name(d);
uci_foreach_option_eq("wireless", "wifi-iface", "device", wunit, s) {
dmuci_get_value_by_section_string(s, "network", &network);
if (strcmp(network, ndev) == 0) {
if (wlctl_num != 0) {
snprintf(buf, sizeof(buf), "%s.%d", wunit, wlctl_num);
p = buf;
} else {
p = wunit;
}
dmubus_call("router.wireless", "stas", UBUS_ARGS{{"vif", p, String}}, 1, &res);
if(res) {
json_object_object_foreach(res, key, val) {
UNUSED(key);
value = dmjson_get_value(val, 1, "macaddr");
if (strcasecmp(value, mac) == 0)
return "802.11";
}
}
wlctl_num++;
}
}
}
return "Ethernet";
}
static inline int init_host_args(struct host_args *args, json_object *clients, char *key)
{
args->client = clients;
@ -88,16 +52,6 @@ int os__get_host_nbr_entries(char *refparam, struct dmctx *ctx, void *data, char
return 0;
}
int os__get_host_interfacetype(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char *mac, *network;
mac = dmjson_get_value(((struct host_args *)data)->client, 1, "macaddr");
network = dmjson_get_value(((struct host_args *)data)->client, 1, "network");
*value = get_interface_type(mac, network);
return 0;
}
/*************************************************************
* GET & SET PARAM
**************************************************************/
@ -131,43 +85,6 @@ int os__get_host_layer3interface(char *refparam, struct dmctx *ctx, void *data,
return 0;
}
int os__get_host_interface_type(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char *type= NULL;
char *ifname = dmjson_get_value(((struct host_args *)data)->client, 1, "network");
struct uci_section *ss = NULL;
uci_foreach_sections("network", "interface", ss) {
if (!strcmp(ifname, section_name(ss))) {
dmuci_get_value_by_section_string(ss, "type", &type);
if (type!=NULL) {
if (!strcmp(type, "bridge")) *value="Bridge";else *value= "Normal";
break;
}
}
}
return 0;
}
int os__get_host_interfacename(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char *frequency, *wireless;
frequency = dmjson_get_value(((struct host_args *)data)->client, 1, "frequency");
wireless = dmjson_get_value(((struct host_args *)data)->client, 1, "wireless");
if ((*frequency != '\0') && (strcmp(wireless, "true")==0)) {
if(strcmp(frequency,"5GHz")==0)
*value = "WiFi@5GHz";
else
*value = "WiFi@2.4GHz";
} else {
*value = dmjson_get_value(((struct host_args *)data)->client, 1, "ethport");
if (*value == NULL)
*value = "";
}
return 0;
}
int os__get_host_ipaddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = dmjson_get_value(((struct host_args *)data)->client, 1, "ipaddr");

View file

@ -35,11 +35,8 @@ DMLEAF tHostsHostParams[] = {
{"HostName", &DMREAD, DMT_STRING, os__get_host_hostname, NULL, NULL, NULL, BBFDM_BOTH},
{"Active", &DMREAD, DMT_BOOL, os__get_host_active, NULL, NULL, NULL, BBFDM_BOTH},
{"PhysAddress", &DMREAD, DMT_STRING, os__get_host_phy_address, NULL, NULL, NULL, BBFDM_BOTH},
{CUSTOM_PREFIX"LinkType", &DMREAD, DMT_STRING, os__get_host_interfacetype, NULL, NULL, NULL, BBFDM_BOTH},
{"AddressSource", &DMREAD, DMT_STRING, os__get_host_address_source, NULL, NULL, NULL, BBFDM_BOTH},
{"LeaseTimeRemaining", &DMREAD, DMT_INT, os__get_host_leasetime_remaining, NULL, NULL, NULL, BBFDM_BOTH},
{"DHCPClient", &DMREAD, DMT_STRING, os__get_host_dhcp_client, NULL, NULL, NULL, BBFDM_BOTH},
{CUSTOM_PREFIX"InterfaceType", &DMREAD, DMT_STRING, os__get_host_interface_type, NULL, NULL, NULL, BBFDM_BOTH},
{CUSTOM_PREFIX"ifname", &DMREAD, DMT_STRING, os__get_host_interfacename, NULL, NULL, NULL, BBFDM_BOTH},
{0}
};

View file

@ -90,7 +90,7 @@ static int set_time_LocalTimeZone(char *refparam, struct dmctx *ctx, void *data,
return 0;
}
static int get_local_time_zone_olson(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
static int get_local_time_zone_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string("system", "@system[0]", "zonename", value);
return 0;
@ -260,7 +260,7 @@ DMLEAF tTimeParams[] = {
{"NTPServer5", &DMWRITE, DMT_STRING, get_time_ntpserver5, set_time_ntpserver5, NULL, NULL, BBFDM_BOTH},
{"CurrentLocalTime", &DMREAD, DMT_TIME, get_time_CurrentLocalTime, NULL, NULL, NULL, BBFDM_BOTH},
{"LocalTimeZone", &DMWRITE, DMT_STRING, get_time_LocalTimeZone, set_time_LocalTimeZone, NULL, NULL, BBFDM_BOTH},
{CUSTOM_PREFIX"LocalTimeZoneOlson", &DMREAD, DMT_STRING, get_local_time_zone_olson, NULL, NULL, NULL, BBFDM_BOTH},
{CUSTOM_PREFIX"LocalTimeZoneName", &DMREAD, DMT_STRING, get_local_time_zone_name, NULL, NULL, NULL, BBFDM_BOTH},
{CUSTOM_PREFIX"SourceInterface", &DMWRITE, DMT_STRING, get_time_source_interface, set_time_source_interface, NULL, NULL, BBFDM_BOTH},
{0}
};

View file

@ -141,29 +141,6 @@ static int get_WiFi_EndPointNumberOfEntries(char *refparam, struct dmctx *ctx, v
return 0;
}
static int get_wifi_bandsteering_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string("wireless", "bandsteering", "enabled", value);
return 0;
}
static int set_wifi_bandsteering_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("wireless", "bandsteering", "enabled", b ? "1" : "0");
return 0;
}
return 0;
}
/*#Device.WiFi.SSID.{i}.Enable!UCI:wireless/wifi-iface,@i-1/disabled*/
static int get_wifi_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
@ -2437,7 +2414,6 @@ DMLEAF tWiFiParams[] = {
{"SSIDNumberOfEntries", &DMREAD, DMT_UNINT, get_WiFi_SSIDNumberOfEntries, NULL, NULL, NULL, BBFDM_BOTH},
{"AccessPointNumberOfEntries", &DMREAD, DMT_UNINT, get_WiFi_AccessPointNumberOfEntries, NULL, NULL, NULL, BBFDM_BOTH},
{"EndPointNumberOfEntries", &DMREAD, DMT_UNINT, get_WiFi_EndPointNumberOfEntries, NULL, NULL, NULL, BBFDM_BOTH},
{CUSTOM_PREFIX"Bandsteering_Enable", &DMWRITE, DMT_BOOL, get_wifi_bandsteering_enable, set_wifi_bandsteering_enable, NULL, NULL, BBFDM_BOTH},
{0}
};