mirror of
https://dev.iopsys.eu/bbf/bbfdm.git
synced 2026-03-08 02:17:10 +01:00
Ticket refs #4374: fix object Add for the whole data model
This commit is contained in:
parent
8f681b3e86
commit
f46d263952
10 changed files with 103 additions and 133 deletions
|
|
@ -23,11 +23,7 @@ struct atm_args
|
|||
***************************************************************************/
|
||||
static int get_atm_linker(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker)
|
||||
{
|
||||
if (data && ((struct atm_args *)data)->ifname) {
|
||||
*linker = ((struct atm_args *)data)->ifname;
|
||||
return 0;
|
||||
}
|
||||
*linker = "";
|
||||
*linker = (data && ((struct atm_args *)data)->ifname) ? ((struct atm_args *)data)->ifname : "";
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -103,10 +99,7 @@ static int set_atm_encapsulation(char *refparam, struct dmctx *ctx, void *data,
|
|||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
if (strcmp(value, "VCMUX") == 0)
|
||||
dmuci_set_value_by_section(((struct atm_args *)data)->atm_sec, "encapsulation", "vcmux");
|
||||
else if (strcmp(value, "LLC") == 0)
|
||||
dmuci_set_value_by_section(((struct atm_args *)data)->atm_sec, "encapsulation", "llc");
|
||||
dmuci_set_value_by_section(((struct atm_args *)data)->atm_sec, "encapsulation", (strcmp(value, "LLC") == 0) ? "llc" : "vcmux");
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -272,12 +265,10 @@ static int add_atm_link(char *refparam, struct dmctx *ctx, void *data, char **in
|
|||
|
||||
dmuci_set_value("dsl", atm_device, "", "atm-device");
|
||||
dmuci_set_value("dsl", atm_device, "name", "ATM");
|
||||
dmuci_set_value("dsl", atm_device, "enabled", "0");
|
||||
dmuci_set_value("dsl", atm_device, "vpi", "8");
|
||||
dmuci_set_value("dsl", atm_device, "vci", "35");
|
||||
dmuci_set_value("dsl", atm_device, "device", atm_device);
|
||||
dmuci_set_value("dsl", atm_device, "link_type", "eoa");
|
||||
dmuci_set_value("dsl", atm_device, "encapsulation", "llc");
|
||||
dmuci_set_value("dsl", atm_device, "qos_class", "ubr");
|
||||
|
||||
dmuci_add_section_bbfdm("dmmap_dsl", "atm-device", &dmmap_atm);
|
||||
dmuci_set_value_by_section(dmmap_atm, "section_name", atm_device);
|
||||
|
|
|
|||
|
|
@ -1403,6 +1403,7 @@ static int addObjBridgingBridge(char *refparam, struct dmctx *ctx, void *data, c
|
|||
// Add interface bridge section
|
||||
dmuci_set_value("network", bridge_name, "", "interface");
|
||||
dmuci_set_value("network", bridge_name, "type", "bridge");
|
||||
dmuci_set_value("network", bridge_name, "disabled", "1");
|
||||
|
||||
// Add dmmap bridge section
|
||||
dmuci_add_section_bbfdm("dmmap_bridge", "bridge", &dmmap_bridge);
|
||||
|
|
|
|||
|
|
@ -490,10 +490,8 @@ static int addObjDHCPv4ServerPool(char *refparam, struct dmctx *ctx, void *data,
|
|||
|
||||
dmuci_add_section("dhcp", "dhcp", &s);
|
||||
dmuci_rename_section_by_section(s, dhcp_sname);
|
||||
dmuci_set_value_by_section(s, "start", "100");
|
||||
dmuci_set_value_by_section(s, "leasetime", "12h");
|
||||
dmuci_set_value_by_section(s, "limit", "150");
|
||||
dmuci_set_value_by_section(s, "ignore", "0");
|
||||
dmuci_set_value_by_section(s, "dhcpv4", "disabled");
|
||||
|
||||
dmuci_add_section_bbfdm("dmmap_dhcp", "dhcp", &dmmap_dhcp);
|
||||
dmuci_set_value_by_section(dmmap_dhcp, "section_name", dhcp_sname);
|
||||
|
|
@ -553,14 +551,16 @@ static int addObjDHCPv4ServerPoolStaticAddress(char *refparam, struct dmctx *ctx
|
|||
snprintf(host_name, sizeof(host_name), "host_%d", instance ? atoi(instance) + 1 : 1);
|
||||
|
||||
dmuci_add_section("dhcp", "host", &s);
|
||||
dmuci_rename_section_by_section(s, host_name);
|
||||
dmuci_set_value_by_section(s, "name", host_name);
|
||||
dmuci_set_value_by_section(s, "dhcp", ((struct dhcp_args *)data)->interface);
|
||||
dmuci_set_value_by_section(s, "enable", "0");
|
||||
|
||||
browse_args.option = "dhcp";
|
||||
browse_args.value = ((struct dhcp_args *)data)->interface;
|
||||
|
||||
dmuci_add_section_bbfdm("dmmap_dhcp", "host", &dmmap_dhcp_host);
|
||||
dmuci_set_value_by_section(dmmap_dhcp_host, "section_name", section_name(s));
|
||||
dmuci_set_value_by_section(dmmap_dhcp_host, "section_name", host_name);
|
||||
dmuci_set_value_by_section(dmmap_dhcp_host, "dhcp", ((struct dhcp_args *)data)->interface);
|
||||
*instancepara = update_instance(instance, 5, dmmap_dhcp_host, "dhcp_host_instance", NULL, check_browse_section, (void *)&browse_args);
|
||||
return 0;
|
||||
|
|
@ -797,6 +797,7 @@ static int addObjDHCPv4RelayForwarding(char *refparam, struct dmctx *ctx, void *
|
|||
|
||||
dmuci_add_section("network", "interface", &s);
|
||||
dmuci_set_value_by_section(s, "proto", "relay");
|
||||
dmuci_set_value_by_section(s, "disabled", "1");
|
||||
|
||||
dmuci_add_section_bbfdm("dmmap_dhcp_relay", "interface", &dmmap_sect);
|
||||
dmuci_set_value_by_section(dmmap_sect, "section_name", section_name(s));
|
||||
|
|
|
|||
|
|
@ -357,11 +357,8 @@ static int addObjDHCPv6ServerPool(char *refparam, struct dmctx *ctx, void *data,
|
|||
|
||||
dmuci_add_section("dhcp", "dhcp", &s);
|
||||
dmuci_rename_section_by_section(s, dhcpv6_sname);
|
||||
dmuci_set_value_by_section(s, "dhcpv6", "server");
|
||||
dmuci_set_value_by_section(s, "start", "100");
|
||||
dmuci_set_value_by_section(s, "leasetime", "12h");
|
||||
dmuci_set_value_by_section(s, "limit", "150");
|
||||
dmuci_set_value_by_section(s, "ignore", "0");
|
||||
dmuci_set_value_by_section(s, "dhcpv6", "disabled");
|
||||
|
||||
dmuci_add_section_bbfdm("dmmap_dhcpv6", "dhcp", &dmmap_dhcp);
|
||||
dmuci_set_value_by_section(dmmap_dhcp, "section_name", dhcpv6_sname);
|
||||
|
|
|
|||
|
|
@ -71,10 +71,7 @@ static int add_firewall_rule(char *refparam, struct dmctx *ctx, void *data, char
|
|||
|
||||
dmuci_add_section("firewall", "rule", &s);
|
||||
dmuci_rename_section_by_section(s, s_name);
|
||||
dmuci_set_value_by_section(s, "name", "-");
|
||||
dmuci_set_value_by_section(s, "enabled", "0");
|
||||
dmuci_set_value_by_section(s, "dest", "");
|
||||
dmuci_set_value_by_section(s, "src", "");
|
||||
dmuci_set_value_by_section(s, "target", "DROP");
|
||||
|
||||
dmuci_add_section_bbfdm("dmmap_firewall", "rule", &dmmap_firewall_rule);
|
||||
|
|
@ -708,7 +705,7 @@ static int get_rule_source_mac(char *refparam, struct dmctx *ctx, void *data, ch
|
|||
|
||||
static int get_time_span_supported_days(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = "mon tue wed thu fri sat sun";
|
||||
*value = "mon,tue,wed,thu,fri,sat,sun";
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -1420,18 +1417,6 @@ static int set_rule_source_mac(char *refparam, struct dmctx *ctx, void *data, ch
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int set_time_span_supported_days(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
//TODO
|
||||
break;
|
||||
case VALUESET:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int set_time_span_days(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
switch (action) {
|
||||
|
|
@ -1560,7 +1545,7 @@ DMLEAF tFirewallChainRuleParams[] = {
|
|||
|
||||
DMLEAF tTimeSpanParams[] = {
|
||||
/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/
|
||||
{"SupportedDays", &DMWRITE, DMT_STRING, get_time_span_supported_days, set_time_span_supported_days, BBFDM_BOTH},
|
||||
{"SupportedDays", &DMREAD, DMT_STRING, get_time_span_supported_days, NULL, BBFDM_BOTH},
|
||||
{"Days", &DMWRITE, DMT_STRING, get_time_span_days, set_time_span_days, BBFDM_BOTH},
|
||||
{"StartTime", &DMWRITE, DMT_STRING, get_time_span_start_time, set_time_span_start_time, BBFDM_BOTH},
|
||||
{"StopTime", &DMWRITE, DMT_STRING, get_time_span_stop_time, set_time_span_stop_time, BBFDM_BOTH},
|
||||
|
|
|
|||
|
|
@ -26,13 +26,14 @@ static int add_NAT_InterfaceSetting(char *refparam, struct dmctx *ctx, void *dat
|
|||
snprintf(name, sizeof(name), "iface_set_%d", inst ? (atoi(inst)+1) : 1);
|
||||
|
||||
dmuci_add_section("firewall", "zone", &s);
|
||||
dmuci_rename_section_by_section(s, name);
|
||||
dmuci_set_value_by_section(s, "input", "REJECT");
|
||||
dmuci_set_value_by_section(s, "output", "ACCEPT");
|
||||
dmuci_set_value_by_section(s, "forward", "REJECT");
|
||||
dmuci_set_value_by_section(s, "name", name);
|
||||
|
||||
dmuci_add_section_bbfdm("dmmap_firewall", "zone", &dmmap_firewall);
|
||||
dmuci_set_value_by_section(dmmap_firewall, "section_name", section_name(s));
|
||||
dmuci_set_value_by_section(dmmap_firewall, "section_name", name);
|
||||
*instance = update_instance(inst, 2, dmmap_firewall, "interface_setting_instance");
|
||||
return 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -442,12 +442,9 @@ static int set_PPPInterfacePPPoE_ServiceName(char *refparam, struct dmctx *ctx,
|
|||
/**************************************************************************
|
||||
* LINKER
|
||||
***************************************************************************/
|
||||
static int get_linker_ppp_interface(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker) {
|
||||
|
||||
if(((struct uci_section *)data))
|
||||
dmasprintf(linker, "%s", section_name(((struct uci_section *)data)));
|
||||
else
|
||||
*linker = "";
|
||||
static int get_linker_ppp_interface(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker)
|
||||
{
|
||||
*linker = data ? dmstrdup(section_name(((struct uci_section *)data))) : "";
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -464,8 +461,7 @@ static int add_ppp_interface(char *refparam, struct dmctx *ctx, void *data, char
|
|||
|
||||
dmuci_set_value("network", name, "", "interface");
|
||||
dmuci_set_value("network", name, "proto", "ppp");
|
||||
dmuci_set_value("network", name, "username", name);
|
||||
dmuci_set_value("network", name, "password", name);
|
||||
dmuci_set_value("network", name, "disabled", "1");
|
||||
|
||||
dmuci_add_section_bbfdm("dmmap_network", "interface", &dmmap_ppp);
|
||||
dmuci_set_value_by_section(dmmap_ppp, "section_name", name);
|
||||
|
|
@ -485,7 +481,7 @@ static int delete_ppp_interface(char *refparam, struct dmctx *ctx, void *data, c
|
|||
dmuci_delete_by_section(((struct uci_section *)data), NULL, NULL);
|
||||
break;
|
||||
case DEL_ALL:
|
||||
uci_foreach_option_eq("network", "interface", "proto", "ppp", ppp_s) {
|
||||
uci_foreach_option_cont("network", "interface", "proto", "ppp", ppp_s) {
|
||||
if (found != 0) {
|
||||
get_dmmap_section_of_config_section("dmmap_network", "interface", section_name(ss), &dmmap_section);
|
||||
if (dmmap_section) dmuci_delete_by_section(dmmap_section, NULL, NULL);
|
||||
|
|
|
|||
|
|
@ -24,10 +24,7 @@ struct ptm_args
|
|||
***************************************************************************/
|
||||
static int get_ptm_linker(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker)
|
||||
{
|
||||
if (data && ((struct ptm_args *)data)->ifname)
|
||||
*linker = ((struct ptm_args *)data)->ifname;
|
||||
else
|
||||
*linker = "" ;
|
||||
*linker = (data && ((struct ptm_args *)data)->ifname) ? ((struct ptm_args *)data)->ifname : "";
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -44,6 +41,65 @@ static inline int init_ptm_link(struct ptm_args *args, struct uci_section *s, ch
|
|||
/**************************************************************************
|
||||
* SET & GET DSL LINK PARAMETERS
|
||||
***************************************************************************/
|
||||
/*#Device.PTM.Link.{i}.Enable!UCI:dsl/ptm-device,@i-1/enabled*/
|
||||
static int get_ptm_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = dmuci_get_value_by_section_fallback_def(((struct ptm_args *)data)->ptm_sec, "enabled", "1");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int set_ptm_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_by_section(((struct ptm_args *)data)->ptm_sec, "enabled", b ? "1" : "0");
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.PTM.Link.{i}.Status!SYSFS:/sys/class/net/@Name/operstate*/
|
||||
static int get_ptm_status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
return get_net_device_status(((struct ptm_args *)data)->ifname, value);
|
||||
}
|
||||
|
||||
/*#Device.PTM.Link.{i}.Alias!UCI:dmmap_dsl/ptm-device,@i-1/ptmlinkalias*/
|
||||
static int get_ptm_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
struct uci_section *dmmap_section = NULL;
|
||||
|
||||
get_dmmap_section_of_config_section("dmmap_dsl", "ptm-device", section_name(((struct ptm_args *)data)->ptm_sec), &dmmap_section);
|
||||
dmuci_get_value_by_section_string(dmmap_section, "ptmlinkalias", value);
|
||||
if ((*value)[0] == '\0')
|
||||
dmasprintf(value, "cpe-%s", instance);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int set_ptm_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
struct uci_section *dmmap_section = NULL;
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
get_dmmap_section_of_config_section("dmmap_dsl", "ptm-device", section_name(((struct ptm_args *)data)->ptm_sec), &dmmap_section);
|
||||
dmuci_set_value_by_section(dmmap_section, "ptmlinkalias", value);
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.PTM.Link.{i}.Name!UCI:dsl/ptm-device,@i-1/name*/
|
||||
static int get_ptm_link_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
|
|
@ -131,7 +187,7 @@ static int set_ptm_lower_layer(char *refparam, struct dmctx *ctx, void *data, ch
|
|||
return 0;
|
||||
}
|
||||
|
||||
static inline int ubus_ptm_stats(char **value, char *stat_mod, void *data)
|
||||
static inline int ubus_ptm_stats(char **value, const char *stat_mod, void *data)
|
||||
{
|
||||
json_object *res = NULL;
|
||||
dmubus_call("network.device", "status", UBUS_ARGS{{"name", ((struct ptm_args *)data)->ifname, String}}, 1, &res);
|
||||
|
|
@ -145,59 +201,25 @@ static inline int ubus_ptm_stats(char **value, char *stat_mod, void *data)
|
|||
/*#Device.PTM.Link.{i}.Stats.BytesReceived!UBUS:network.device/status/name,@Name/statistics.rx_bytes*/
|
||||
static int get_ptm_stats_bytes_received(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
ubus_ptm_stats(value, "rx_bytes", data);
|
||||
return 0;
|
||||
return ubus_ptm_stats(value, "rx_bytes", data);
|
||||
}
|
||||
|
||||
/*#Device.PTM.Link.{i}.Stats.BytesSent!UBUS:network.device/status/name,@Name/statistics.tx_bytes*/
|
||||
static int get_ptm_stats_bytes_sent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
ubus_ptm_stats(value, "tx_bytes", data);
|
||||
return 0;
|
||||
return ubus_ptm_stats(value, "tx_bytes", data);
|
||||
}
|
||||
|
||||
/*#Device.PTM.Link.{i}.Stats.PacketsReceived!UBUS:network.device/status/name,@Name/statistics.rx_packets*/
|
||||
static int get_ptm_stats_pack_received(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
ubus_ptm_stats(value, "rx_packets", data);
|
||||
return 0;
|
||||
return ubus_ptm_stats(value, "rx_packets", data);
|
||||
}
|
||||
|
||||
/*#Device.PTM.Link.{i}.Stats.PacketsSent!UBUS:network.device/status/name,@Name/statistics.tx_packets*/
|
||||
static int get_ptm_stats_pack_sent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
ubus_ptm_stats(value, "tx_packets", data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.PTM.Link.{i}.Enable!UCI:dsl/ptm-device,@i-1/enabled*/
|
||||
static int get_ptm_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = dmuci_get_value_by_section_fallback_def(((struct ptm_args *)data)->ptm_sec, "enabled", "1");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int set_ptm_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_by_section(((struct ptm_args *)data)->ptm_sec, "enabled", b ? "1" : "0");
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.PTM.Link.{i}.Status!SYSFS:/sys/class/net/@Name/operstate*/
|
||||
static int get_ptm_status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
return get_net_device_status(((struct ptm_args *)data)->ifname, value);
|
||||
return ubus_ptm_stats(value, "tx_packets", data);
|
||||
}
|
||||
|
||||
/*************************************************************
|
||||
|
|
@ -214,8 +236,7 @@ static int add_ptm_link(char *refparam, struct dmctx *ctx, void *data, char **in
|
|||
dmuci_set_value("dsl", ptm_device, "", "ptm-device");
|
||||
dmuci_set_value("dsl", ptm_device, "name", "PTM");
|
||||
dmuci_set_value("dsl", ptm_device, "device", ptm_device);
|
||||
dmuci_set_value("dsl", ptm_device, "priority", "1");
|
||||
dmuci_set_value("dsl", ptm_device, "portid", "1");
|
||||
dmuci_set_value("dsl", ptm_device, "enabled", "0");
|
||||
|
||||
dmuci_add_section_bbfdm("dmmap_dsl", "ptm-device", &dmmap_ptm);
|
||||
dmuci_set_value_by_section(dmmap_ptm, "section_name", ptm_device);
|
||||
|
|
@ -279,38 +300,6 @@ static int delete_ptm_link(char *refparam, struct dmctx *ctx, void *data, char *
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*************************************************************
|
||||
* SET AND GET ALIAS
|
||||
*************************************************************/
|
||||
/*#Device.PTM.Link.{i}.Alias!UCI:dmmap_dsl/ptm-device,@i-1/ptmlinkalias*/
|
||||
static int get_ptm_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
struct uci_section *dmmap_section = NULL;
|
||||
|
||||
get_dmmap_section_of_config_section("dmmap_dsl", "ptm-device", section_name(((struct ptm_args *)data)->ptm_sec), &dmmap_section);
|
||||
dmuci_get_value_by_section_string(dmmap_section, "ptmlinkalias", value);
|
||||
if ((*value)[0] == '\0')
|
||||
dmasprintf(value, "cpe-%s", instance);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int set_ptm_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
struct uci_section *dmmap_section = NULL;
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
get_dmmap_section_of_config_section("dmmap_dsl", "ptm-device", section_name(((struct ptm_args *)data)->ptm_sec), &dmmap_section);
|
||||
dmuci_set_value_by_section(dmmap_section, "ptmlinkalias", value);
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*************************************************************
|
||||
* ENTRY METHOD
|
||||
*************************************************************/
|
||||
|
|
@ -353,10 +342,10 @@ DMOBJ tPTMLinkObj[] = {
|
|||
|
||||
DMLEAF tPTMLinkParams[] = {
|
||||
/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/
|
||||
{"Alias", &DMWRITE, DMT_STRING, get_ptm_alias, set_ptm_alias, BBFDM_BOTH},
|
||||
{"Enable", &DMWRITE, DMT_BOOL, get_ptm_enable, set_ptm_enable, BBFDM_BOTH},
|
||||
{"Name", &DMREAD, DMT_STRING, get_ptm_link_name, NULL, BBFDM_BOTH},
|
||||
{"Status", &DMREAD, DMT_STRING, get_ptm_status, NULL, BBFDM_BOTH},
|
||||
{"Alias", &DMWRITE, DMT_STRING, get_ptm_alias, set_ptm_alias, BBFDM_BOTH},
|
||||
{"Name", &DMREAD, DMT_STRING, get_ptm_link_name, NULL, BBFDM_BOTH},
|
||||
{"LowerLayers", &DMWRITE, DMT_STRING, get_ptm_lower_layer, set_ptm_lower_layer, BBFDM_BOTH},
|
||||
{0}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -42,8 +42,8 @@ static int add_users_user(char *refparam, struct dmctx *ctx, void *data, char **
|
|||
|
||||
dmuci_add_section("users", "user", &s);
|
||||
dmuci_rename_section_by_section(s, username);
|
||||
dmuci_set_value_by_section(s, "enabled", "1");
|
||||
dmuci_set_value_by_section(s, "password", username);
|
||||
dmuci_set_value_by_section(s, "enabled", "0");
|
||||
dmuci_set_value_by_section(s, "remote_access", "0");
|
||||
|
||||
dmuci_add_section_bbfdm("dmmap_users", "user", &dmmap_user);
|
||||
dmuci_set_value_by_section(dmmap_user, "section_name", username);
|
||||
|
|
|
|||
|
|
@ -194,6 +194,12 @@ static int set_wlan_ssid(char *refparam, struct dmctx *ctx, void *data, char *in
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int get_wlan_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = dmstrdup(section_name(((struct wifi_ssid_args *)data)->wifi_ssid_sec));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.WiFi.SSID.{i}.MACAddress!SYSFS:/sys/class/net/@Name/address*/
|
||||
static int get_WiFiSSID_MACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
|
|
@ -1906,19 +1912,21 @@ static int get_ap_ssid_ref(char *refparam, struct dmctx *ctx, void *data, char *
|
|||
static int add_wifi_iface(char *inst_name, char **instance)
|
||||
{
|
||||
struct uci_section *s = NULL, *dmmap_wifi = NULL;
|
||||
char ssid[32] = {0};
|
||||
char ssid[32] = {0}, s_name[32] = {0};
|
||||
|
||||
char *inst = get_last_instance_bbfdm("dmmap_wireless", "wifi-iface", inst_name);
|
||||
snprintf(ssid, sizeof(ssid), "iopsys_%d", inst ? (atoi(inst)+1) : 1);
|
||||
snprintf(s_name, sizeof(s_name), "wlan_%d", inst ? (atoi(inst)+1) : 1);
|
||||
|
||||
dmuci_add_section("wireless", "wifi-iface", &s);
|
||||
dmuci_rename_section_by_section(s, s_name);
|
||||
dmuci_set_value_by_section(s, "disabled", "1");
|
||||
dmuci_set_value_by_section(s, "ssid", ssid);
|
||||
dmuci_set_value_by_section(s, "network", "lan");
|
||||
dmuci_set_value_by_section(s, "mode", "ap");
|
||||
dmuci_set_value_by_section(s, "disabled", "0");
|
||||
|
||||
dmuci_add_section_bbfdm("dmmap_wireless", "wifi-iface", &dmmap_wifi);
|
||||
dmuci_set_value_by_section(dmmap_wifi, "section_name", section_name(s));
|
||||
dmuci_set_value_by_section(dmmap_wifi, "section_name", s_name);
|
||||
*instance = update_instance(inst, 2, dmmap_wifi, inst_name);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1973,7 +1981,8 @@ static int addObjWiFiEndPoint(char *refparam, struct dmctx *ctx, void *data, cha
|
|||
instancepara = "0";
|
||||
|
||||
dmuci_add_section("wireless", "wifi-iface", &endpoint_sec);
|
||||
dmuci_set_value_by_section(endpoint_sec, "device", "wl2");
|
||||
dmuci_set_value_by_section(endpoint_sec, "disabled", "1");
|
||||
dmuci_set_value_by_section(endpoint_sec, "device", "wl2"); // Sould be removed after fixing Device.WiFi.EndPoint.{i}. object
|
||||
dmuci_set_value_by_section(endpoint_sec, "mode", "sta");
|
||||
dmuci_set_value_by_section(endpoint_sec, "network", "lan");
|
||||
|
||||
|
|
@ -2273,7 +2282,7 @@ DMLEAF tWiFiSSIDParams[] = {
|
|||
{"Enable", &DMWRITE, DMT_BOOL, get_wifi_enable, set_wifi_enable, BBFDM_BOTH},
|
||||
{"Status", &DMREAD, DMT_STRING, get_wifi_status, NULL, BBFDM_BOTH},
|
||||
{"SSID", &DMWRITE, DMT_STRING, get_wlan_ssid, set_wlan_ssid, BBFDM_BOTH},
|
||||
{"Name", &DMWRITE, DMT_STRING, get_wlan_ssid, set_wlan_ssid, BBFDM_BOTH},
|
||||
{"Name", &DMREAD, DMT_STRING, get_wlan_name, NULL, BBFDM_BOTH},
|
||||
{"LowerLayers", &DMWRITE, DMT_STRING, get_ssid_lower_layer, set_ssid_lower_layer, BBFDM_BOTH},
|
||||
{"BSSID", &DMREAD, DMT_STRING, os__get_wlan_bssid, NULL, BBFDM_BOTH},
|
||||
{"MACAddress", &DMREAD, DMT_STRING, get_WiFiSSID_MACAddress, NULL, BBFDM_BOTH},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue