Add sysfs and procfs mapping + update mapping of some parameters + clean up

This commit is contained in:
Amin Ben Ramdhane 2020-05-12 00:05:40 +01:00
parent 44682f5fcd
commit 61a1c57664
21 changed files with 2027 additions and 468 deletions

View file

@ -1080,7 +1080,6 @@ static int set_sip_re_invite_expires(char *refparam, struct dmctx *ctx, void *da
return 0;
}
static int get_sip_call_lines(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct sip_args *sipargs = (struct sip_args *)data;
@ -1381,6 +1380,7 @@ static int set_voice_service_vp_rtp_srtp_enable(char *refparam, struct dmctx *ct
}
/*******************LINE **********************************/
/*#Device.Services.VoiceService.{i}.VoiceProfile.{i}.Line.{i}.Enable!UCI:voice_client/tel_line,@i-1/enabled*/
static int get_voice_profile_line_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char *tmp;
@ -1413,6 +1413,7 @@ static int set_voice_profile_line_enable(char *refparam, struct dmctx *ctx, void
return 0;
}
/*#Device.Services.VoiceService.{i}.VoiceProfile.{i}.Line.{i}.DirectoryNumber!UCI:voice_client/tel_line,@i-1/extension*/
static int get_line_directory_number(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct tel_args *telargs = (struct tel_args *)data;

View file

@ -44,7 +44,7 @@ static inline int init_atm_link(struct atm_args *args, struct uci_section *s, ch
/**************************************************************************
* SET & GET DSL LINK PARAMETERS
***************************************************************************/
/*#Device.ATM.Link.{i}.DestinationAddress!UCI:dsl/atm-device,@i-1/vpi*/
/*#Device.ATM.Link.{i}.DestinationAddress!UCI:dsl/atm-device,@i-1/vpi&UCI:dsl/atm-device,@i-1/vci*/
static int get_atm_destination_address(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char *vpi, *vci;

View file

@ -112,6 +112,7 @@ int os__get_process_cpu_usage(char* refparam, struct dmctx *ctx, void *data, cha
return 0;
}
/*#Device.DeviceInfo.ProcessStatus.ProcessNumberOfEntries!UBUS:router.system/processes//processes*/
int os__get_process_number_of_entries(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
json_object *res = NULL, *processes = NULL;
@ -127,42 +128,49 @@ int os__get_process_number_of_entries(char* refparam, struct dmctx *ctx, void *d
return 0;
}
/*#Device.DeviceInfo.ProcessStatus.Process.{i}.PID!UBUS:router.system/processes//processes[@i-1].pid*/
int os__get_process_pid(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = dmjson_get_value((json_object *)data, 1, "pid");
return 0;
}
/*#Device.DeviceInfo.ProcessStatus.Process.{i}.Command!UBUS:router.system/processes//processes[@i-1].command*/
int os__get_process_command(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = dmjson_get_value((json_object *)data, 1, "command");
return 0;
}
/*#Device.DeviceInfo.ProcessStatus.Process.{i}.Size!UBUS:router.system/processes//processes[@i-1].vsz*/
int os__get_process_size(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = dmjson_get_value((json_object *)data, 1, "vsz");
return 0;
}
/*#Device.DeviceInfo.ProcessStatus.Process.{i}.Priority!UBUS:router.system/processes//processes[@i-1].priority*/
int os__get_process_priority(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = dmjson_get_value((json_object *)data, 1, "priority");
return 0;
}
/*#Device.DeviceInfo.ProcessStatus.Process.{i}.CPUTime!UBUS:router.system/processes//processes[@i-1].cputime*/
int os__get_process_cpu_time(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = dmjson_get_value((json_object *)data, 1, "cputime");
return 0;
}
/*#Device.DeviceInfo.ProcessStatus.Process.{i}.State!UBUS:router.system/processes//processes[@i-1].state*/
int os__get_process_state(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = dmjson_get_value((json_object *)data, 1, "state");
return 0;
}
/*#Device.DeviceInfo.ProcessStatus.Process.{i}.!UBUS:router.system/processes//processes*/
int os__browseProcessEntriesInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
json_object *res = NULL, *processes = NULL, *arrobj = NULL;

View file

@ -79,6 +79,7 @@ static int get_device_softwareversion(char *refparam, struct dmctx *ctx, void *d
return 0;
}
/*#Device.DeviceInfo.UpTime!PROCFS:/proc/uptime*/
static int get_device_info_uptime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
FILE *fp = NULL;
@ -278,7 +279,6 @@ static int browseVcfInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_da
return 0;
}
//Browse VendorLogFile instances
static int browseVlfInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
struct uci_section *sys_log_sec, *dm_sec;

View file

@ -462,6 +462,7 @@ static int set_EthernetInterface_Enable(char *refparam, struct dmctx *ctx, void
return 0;
}
/*#Device.Ethernet.Interface.{i}.Status!SYSFS:/sys/class/net/@Name/operstate*/
static int get_EthernetInterface_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
get_net_device_sysfs(((struct eth_port_args *)data)->ifname, "operstate", value);
@ -552,6 +553,7 @@ static int set_EthernetInterface_LowerLayers(char *refparam, struct dmctx *ctx,
return 0;
}
/*#Device.Ethernet.Interface.{i}.Upstream!UCI:ports/ethport,@i-1/uplink*/
static int get_EthernetInterface_Upstream(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_value_by_section_string(((struct eth_port_args *)data)->eth_port_sec, "uplink", value);
@ -560,7 +562,7 @@ static int get_EthernetInterface_Upstream(char *refparam, struct dmctx *ctx, voi
return 0;
}
/*#Device.Ethernet.Interface.{i}.MACAddress!UBUS:network.device/status/name,@Name/macaddr*/
/*#Device.Ethernet.Interface.{i}.MACAddress!SYSFS:/sys/class/net/@Name/address*/
static int get_EthernetInterface_MACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return eth_port_sysfs(data, "address", value);
@ -693,54 +695,55 @@ static int set_EthernetInterface_EEEEnable(char *refparam, struct dmctx *ctx, vo
return 0;
}
/*#Device.Ethernet.Interface.{i}.Stats.BytesSent!UBUS:network.device/status/name,@Name/statistics.tx_bytes*/
/*#Device.Ethernet.Interface.{i}.Stats.BytesSent!SYSFS:/sys/class/net/@Name/statistics/tx_bytes*/
static int get_EthernetInterfaceStats_BytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return eth_port_sysfs(data, "statistics/tx_bytes", value);
}
/*#Device.Ethernet.Interface.{i}.Stats.BytesReceived!UBUS:network.device/status/name,@Name/statistics.rx_bytes*/
/*#Device.Ethernet.Interface.{i}.Stats.BytesReceived!SYSFS:/sys/class/net/@Name/statistics/rx_bytes*/
static int get_EthernetInterfaceStats_BytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return eth_port_sysfs(data, "statistics/rx_bytes", value);
}
/*#Device.Ethernet.Interface.{i}.Stats.PacketsSent!UBUS:network.device/status/name,@Name/statistics.tx_packets*/
/*#Device.Ethernet.Interface.{i}.Stats.PacketsSent!SYSFS:/sys/class/net/@Name/statistics/tx_packets*/
static int get_EthernetInterfaceStats_PacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return eth_port_sysfs(data, "statistics/tx_packets", value);
}
/*#Device.Ethernet.Interface.{i}.Stats.PacketsReceived!UBUS:network.device/status/name,@Name/statistics.rx_packets*/
/*#Device.Ethernet.Interface.{i}.Stats.PacketsReceived!SYSFS:/sys/class/net/@Name/statistics/rx_packets*/
static int get_EthernetInterfaceStats_PacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return eth_port_sysfs(data, "statistics/rx_packets", value);
}
/*#Device.Ethernet.Interface.{i}.Stats.ErrorsSent!UBUS:network.device/status/name,@Name/statistics.tx_errors*/
/*#Device.Ethernet.Interface.{i}.Stats.ErrorsSent!SYSFS:/sys/class/net/@Name/statistics/tx_errors*/
static int get_EthernetInterfaceStats_ErrorsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return eth_port_sysfs(data, "statistics/tx_errors", value);
}
/*#Device.Ethernet.Interface.{i}.Stats.ErrorsReceived!UBUS:network.device/status/name,@Name/statistics.rx_errors*/
/*#Device.Ethernet.Interface.{i}.Stats.ErrorsReceived!SYSFS:/sys/class/net/@Name/statistics/rx_errors*/
static int get_EthernetInterfaceStats_ErrorsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return eth_port_sysfs(data, "statistics/rx_errors", value);
}
/*#Device.Ethernet.Interface.{i}.Stats.DiscardPacketsSent!UBUS:network.device/status/name,@Name/statistics.tx_dropped*/
/*#Device.Ethernet.Interface.{i}.Stats.DiscardPacketsSent!SYSFS:/sys/class/net/@Name/statistics/tx_dropped*/
static int get_EthernetInterfaceStats_DiscardPacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return eth_port_sysfs(data, "statistics/tx_dropped", value);
}
/*#Device.Ethernet.Interface.{i}.Stats.DiscardPacketsReceived!UBUS:network.device/status/name,@Name/statistics.rx_dropped*/
/*#Device.Ethernet.Interface.{i}.Stats.DiscardPacketsReceived!SYSFS:/sys/class/net/@Name/statistics/rx_dropped*/
static int get_EthernetInterfaceStats_DiscardPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return eth_port_sysfs(data, "statistics/rx_dropped", value);
}
/*#Device.Ethernet.Interface.{i}.Stats.DiscardPacketsReceived!SYSFS:/sys/class/net/@Name/statistics/multicast*/
static int get_EthernetInterfaceStats_MulticastPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return eth_port_sysfs(data, "statistics/multicast", value);
@ -1394,54 +1397,55 @@ static int set_EthernetVLANTermination_TPID(char *refparam, struct dmctx *ctx, v
return 0;
}
/*#Device.Ethernet.VLANTermination.{i}.Stats.BytesSent!UBUS:network.device/status/name,@Name/statistics.tx_bytes*/
/*#Device.Ethernet.VLANTermination.{i}.Stats.BytesSent!SYSFS:/sys/class/net/@Name/statistics/tx_bytes*/
static int get_EthernetVLANTerminationStats_BytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return eth_iface_sysfs(data, "statistics/tx_bytes", value);
}
/*#Device.Ethernet.VLANTermination.{i}.Stats.BytesReceived!UBUS:network.device/status/name,@Name/statistics.rx_bytes*/
/*#Device.Ethernet.VLANTermination.{i}.Stats.BytesReceived!SYSFS:/sys/class/net/@Name/statistics/rx_bytes*/
static int get_EthernetVLANTerminationStats_BytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return eth_iface_sysfs(data, "statistics/rx_bytes", value);
}
/*#Device.Ethernet.VLANTermination.{i}.Stats.PacketsSent!UBUS:network.device/status/name,@Name/statistics.tx_packets*/
/*#Device.Ethernet.VLANTermination.{i}.Stats.PacketsSent!SYSFS:/sys/class/net/@Name/statistics/tx_packets*/
static int get_EthernetVLANTerminationStats_PacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return eth_iface_sysfs(data, "statistics/tx_packets", value);
}
/*#Device.Ethernet.VLANTermination.{i}.Stats.PacketsReceived!UBUS:network.device/status/name,@Name/statistics.rx_packets*/
/*#Device.Ethernet.VLANTermination.{i}.Stats.PacketsReceived!SYSFS:/sys/class/net/@Name/statistics/rx_packets*/
static int get_EthernetVLANTerminationStats_PacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return eth_iface_sysfs(data, "statistics/rx_packets", value);
}
/*#Device.Ethernet.VLANTermination.{i}.Stats.ErrorsSent!UBUS:network.device/status/name,@Name/statistics.tx_errors*/
/*#Device.Ethernet.VLANTermination.{i}.Stats.ErrorsSent!SYSFS:/sys/class/net/@Name/statistics/tx_errors*/
static int get_EthernetVLANTerminationStats_ErrorsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return eth_iface_sysfs(data, "statistics/tx_errors", value);
}
/*#Device.Ethernet.VLANTermination.{i}.Stats.ErrorsReceived!UBUS:network.device/status/name,@Name/statistics.rx_errors*/
/*#Device.Ethernet.VLANTermination.{i}.Stats.ErrorsReceived!SYSFS:/sys/class/net/@Name/statistics/rx_errors*/
static int get_EthernetVLANTerminationStats_ErrorsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return eth_iface_sysfs(data, "statistics/rx_errors", value);
}
/*#Device.Ethernet.VLANTermination.{i}.Stats.DiscardPacketsSent!UBUS:network.device/status/name,@Name/statistics.tx_dropped*/
/*#Device.Ethernet.VLANTermination.{i}.Stats.DiscardPacketsSent!SYSFS:/sys/class/net/@Name/statistics/tx_dropped*/
static int get_EthernetVLANTerminationStats_DiscardPacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return eth_iface_sysfs(data, "statistics/tx_dropped", value);
}
/*#Device.Ethernet.VLANTermination.{i}.Stats.DiscardPacketsReceived!UBUS:network.device/status/name,@Name/statistics.rx_dropped*/
/*#Device.Ethernet.VLANTermination.{i}.Stats.DiscardPacketsReceived!SYSFS:/sys/class/net/@Name/statistics/rx_dropped*/
static int get_EthernetVLANTerminationStats_DiscardPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return eth_iface_sysfs(data, "statistics/rx_dropped", value);
}
/*#Device.Ethernet.VLANTermination.{i}.Stats.MulticastPacketsReceived!SYSFS:/sys/class/net/@Name/statistics/multicast*/
static int get_EthernetVLANTerminationStats_MulticastPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return eth_iface_sysfs(data, "statistics/multicast", value);

View file

@ -229,7 +229,7 @@ static int set_management_server_connection_request_passwd(char *refparam, struc
return 0;
}
/*#Device.ManagementServer.ConnectionRequestPassword!UCI:cwmp/cpe,cpe/upgrades_managed*/
/*#Device.ManagementServer.UpgradesManaged!UCI:cwmp/cpe,cpe/upgrades_managed*/
static int get_upgrades_managed(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string("cwmp", "cpe", "upgrades_managed", value);

View file

@ -80,16 +80,13 @@ static int set_ppp_enable(char *refparam, struct dmctx *ctx, void *data, char *i
/*#Device.PPP.Interface.{i}.Status!UBUS:network.interface/status/interface,@Name/up*/
static int get_PPPInterface_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
json_object *res;
json_object *res = NULL;
char *status;
dmubus_call("network.interface", "status", UBUS_ARGS{{"interface", section_name(((struct uci_section *)data)), String}}, 1, &res);
DM_ASSERT(res, *value = "Down");
status = dmjson_get_value(res, 1, "up");
if (strcmp(status, "true") == 0)
*value= "Up";
else
*value= "Down";
*value = (strcmp(status, "true") == 0) ? "Up" : "Down";
return 0;
}
@ -208,64 +205,63 @@ static int ppp_read_sysfs(struct uci_section *sect, const char *name, char **val
int rc = 0;
dmuci_get_value_by_section_string(sect, "proto", &proto);
if (!strcmp(proto, "pppoe")) {
char *ifname;
dmuci_get_value_by_section_string(sect, "ifname", &ifname);
rc = get_net_device_sysfs(ifname, name, value);
}
return rc;
}
/*#Device.PPP.Interface.{i}.Stats.BytesReceived!UBUS:network.device/status/name,@Name/statistics.rx_bytes*/
/*#Device.PPP.Interface.{i}.Stats.BytesReceived!SYSFS:/sys/class/net/@Name/statistics/rx_bytes*/
static int get_ppp_eth_bytes_received(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return ppp_read_sysfs(data, "statistics/rx_bytes", value);
}
/*#Device.PPP.Interface.{i}.Stats.BytesSent!UBUS:network.device/status/name,@Name/statistics.tx_bytes*/
/*#Device.PPP.Interface.{i}.Stats.BytesSent!SYSFS:/sys/class/net/@Name/statistics/tx_bytes*/
static int get_ppp_eth_bytes_sent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return ppp_read_sysfs(data, "statistics/tx_bytes", value);
}
/*#Device.PPP.Interface.{i}.Stats.PacketsReceived!UBUS:network.device/status/name,@Name/statistics.rx_packets*/
/*#Device.PPP.Interface.{i}.Stats.PacketsReceived!SYSFS:/sys/class/net/@Name/statistics/rx_packets*/
static int get_ppp_eth_pack_received(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return ppp_read_sysfs(data, "statistics/rx_packets", value);
}
/*#Device.PPP.Interface.{i}.Stats.PacketsSent!UBUS:network.device/status/name,@Name/statistics.tx_packets*/
/*#Device.PPP.Interface.{i}.Stats.PacketsSent!SYSFS:/sys/class/net/@Name/statistics/tx_packets*/
static int get_ppp_eth_pack_sent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return ppp_read_sysfs(data, "statistics/tx_packets", value);
}
/*#Device.PPP.Interface.{i}.Stats.ErrorsSent!UBUS:network.device/status/name,@Name/statistics.tx_errors*/
/*#Device.PPP.Interface.{i}.Stats.ErrorsSent!SYSFS:/sys/class/net/@Name/statistics/tx_errors*/
static int get_PPPInterfaceStats_ErrorsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return ppp_read_sysfs(data, "statistics/tx_errors", value);
}
/*#Device.PPP.Interface.{i}.Stats.ErrorsReceived!UBUS:network.device/status/name,@Name/statistics.rx_errors*/
/*#Device.PPP.Interface.{i}.Stats.ErrorsReceived!SYSFS:/sys/class/net/@Name/statistics/rx_errors*/
static int get_PPPInterfaceStats_ErrorsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return ppp_read_sysfs(data, "statistics/rx_errors", value);
}
/*#Device.PPP.Interface.{i}.Stats.DiscardPacketsSent!UBUS:network.device/status/name,@Name/statistics.tx_dropped*/
/*#Device.PPP.Interface.{i}.Stats.DiscardPacketsSent!SYSFS:/sys/class/net/@Name/statistics/tx_dropped*/
static int get_PPPInterfaceStats_DiscardPacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return ppp_read_sysfs(data, "statistics/tx_dropped", value);
}
/*#Device.PPP.Interface.{i}.Stats.DiscardPacketsReceived!UBUS:network.device/status/name,@Name/statistics.rx_dropped*/
/*#Device.PPP.Interface.{i}.Stats.DiscardPacketsReceived!SYSFS:/sys/class/net/@Name/statistics/rx_dropped*/
static int get_PPPInterfaceStats_DiscardPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return ppp_read_sysfs(data, "statistics/rx_dropped", value);
}
/*#Device.PPP.Interface.{i}.Stats.MulticastPacketsReceived!SYSFS:/sys/class/net/@Name/statistics/multicast*/
static int get_PPPInterfaceStats_MulticastPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return ppp_read_sysfs(data, "statistics/multicast", value);
@ -396,11 +392,10 @@ static int set_PPPInterfacePPPoE_ServiceName(char *refparam, struct dmctx *ctx,
***************************************************************************/
static int get_linker_ppp_interface(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker) {
if(((struct uci_section *)data)) {
if(((struct uci_section *)data))
dmasprintf(linker, "%s", section_name(((struct uci_section *)data)));
return 0;
}
*linker = "";
else
*linker = "";
return 0;
}

View file

@ -24,11 +24,10 @@ 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) {
if (data && ((struct ptm_args *)data)->ifname)
*linker = ((struct ptm_args *)data)->ifname;
return 0;
}
*linker = "" ;
else
*linker = "" ;
return 0;
}

View file

@ -59,41 +59,37 @@ struct upnp_description_file_info {
***************************************************************************/
static int get_root_device_linker(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker)
{
if (data && ((struct upnpdiscovery *)data)->uuid) {
if (data && ((struct upnpdiscovery *)data)->uuid)
dmasprintf(linker, "%s", ((struct upnpdiscovery *)data)->uuid);
return 0;
}
*linker = "" ;
else
*linker = "" ;
return 0;
}
static int get_device_linker(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker)
{
if (data && ((struct upnpdiscovery *)data)->uuid){
if (data && ((struct upnpdiscovery *)data)->uuid)
dmasprintf(linker, "%s", ((struct upnpdiscovery *)data)->uuid);
return 0;
}
*linker = "" ;
else
*linker = "" ;
return 0;
}
static int get_device_instance_linker(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker)
{
if (data && ((struct upnp_device_inst *)data)->udn){
if (data && ((struct upnp_device_inst *)data)->udn)
dmasprintf(linker, "%s", ((struct upnp_device_inst *)data)->udn);
return 0;
}
*linker = "" ;
else
*linker = "" ;
return 0;
}
static int get_service_linker(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker)
{
if (data && ((struct upnpdiscovery *)data)->usn){
if (data && ((struct upnpdiscovery *)data)->usn)
dmasprintf(linker, "%s", ((struct upnpdiscovery *)data)->usn);
return 0;
}
*linker = "" ;
else
*linker = "" ;
return 0;
}

View file

@ -34,6 +34,7 @@ static int add_users_user(char *refparam, struct dmctx *ctx, void *data, char **
struct uci_section *s, *dmmap_user;
char ib[8], *last_inst = NULL, *sect_name = NULL, *username, *v;
check_create_dmmap_package("dmmap_users");
last_inst = get_last_instance_bbfdm("dmmap_users", "user", "user_instance");
snprintf(ib, sizeof(ib), "%s", last_inst ? last_inst : "1");
dmasprintf(&username, "user_%d", atoi(ib)+1);
@ -41,7 +42,7 @@ static int add_users_user(char *refparam, struct dmctx *ctx, void *data, char **
dmuci_rename_section_by_section(s, username);
dmuci_set_value_by_section(s, "enabled", "1");
dmuci_set_value_by_section(s, "password", username);
check_create_dmmap_package("dmmap_users");
dmuci_add_section_bbfdm("dmmap_users", "user", &dmmap_user, &v);
dmuci_set_value_by_section(dmmap_user, "section_name", sect_name);
*instance = update_instance_bbfdm(dmmap_user, last_inst, "user_instance");

View file

@ -275,11 +275,9 @@ int os_get_wifi_access_point_status (char *refparam, struct dmctx *ctx, void *da
dmuci_get_value_by_section_string(((struct wifi_ssid_args *)data)->wifi_ssid_sec, "device", &iface);
snprintf(object, sizeof(object), "wifi.ap.%s", iface);
dmubus_call(object, "status", UBUS_ARGS{}, 0, &res);
DM_ASSERT(res, status = "");
status = dmjson_get_value(res, 1, "status");
if (strcmp(status, "running") == 0 || strcmp(status, "up") == 0)
*value = "Enabled";
else

View file

@ -6,187 +6,156 @@ static int not_implemented(char **value)
return 0;
}
/*#Device.WiFi.SSID.{i}.BSSID!UBUS:wifi.ap.@Name/status//bssid*/
int os__get_wlan_bssid(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return not_implemented(value);
}
/*#Device.WiFi.Radio.{i}.Stats.BytesSent!UBUS:wifi.radio.@Name/stats//tx_bytes*/
int os__get_WiFiRadioStats_BytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return not_implemented(value);
}
/*#Device.WiFi.Radio.{i}.Stats.BytesReceived!UBUS:wifi.radio.@Name/stats//rx_bytes*/
int os__get_WiFiRadioStats_BytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return not_implemented(value);
}
/*#Device.WiFi.Radio.{i}.Stats.PacketsSent!UBUS:wifi.radio.@Name/stats//tx_packets*/
int os__get_WiFiRadioStats_PacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return not_implemented(value);
}
/*#Device.WiFi.Radio.{i}.Stats.PacketsReceived!UBUS:wifi.radio.@Name/stats//rx_packets*/
int os__get_WiFiRadioStats_PacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return not_implemented(value);
}
/*#Device.WiFi.Radio.{i}.Stats.ErrorsSent!UBUS:wifi.radio.@Name/stats//tx_error_packets*/
int os__get_WiFiRadioStats_ErrorsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return not_implemented(value);
}
/*#Device.WiFi.Radio.{i}.Stats.ErrorsReceived!UBUS:wifi.radio.@Name/stats//rx_error_packets*/
int os__get_WiFiRadioStats_ErrorsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return not_implemented(value);
}
/*#Device.WiFi.Radio.{i}.Stats.DiscardPacketsSent!UBUS:wifi.radio.@Name/stats//tx_dropped_packets*/
int os__get_WiFiRadioStats_DiscardPacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return not_implemented(value);
}
/*#Device.WiFi.Radio.{i}.Stats.DiscardPacketsReceived!UBUS:wifi.radio.@Name/stats//rx_dropped_packets*/
int os__get_WiFiRadioStats_DiscardPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return not_implemented(value);
}
/*#Device.WiFi.Radio.{i}.Stats.FCSErrorCount!UBUS:wifi.radio.@Name/stats//rx_fcs_error_packets*/
int os__get_WiFiRadioStats_FCSErrorCount(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return not_implemented(value);
}
/*#Device.WiFi.SSID.{i}.Stats.BytesSent!UBUS:wifi.ap.@Name/stats//tx_bytes*/
int os__get_WiFiSSIDStats_BytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return not_implemented(value);
}
/*#Device.WiFi.SSID.{i}.Stats.BytesReceived!UBUS:wifi.ap.@Name/stats//rx_bytes*/
int os__get_WiFiSSIDStats_BytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return not_implemented(value);
}
/*#Device.WiFi.SSID.{i}.Stats.PacketsSent!UBUS:wifi.ap.@Name/stats//tx_packets*/
int os__get_WiFiSSIDStats_PacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return not_implemented(value);
}
/*#Device.WiFi.SSID.{i}.Stats.PacketsReceived!UBUS:wifi.ap.@Name/stats//rx_packets*/
int os__get_WiFiSSIDStats_PacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return not_implemented(value);
}
/*#Device.WiFi.SSID.{i}.Stats.ErrorsSent!UBUS:wifi.ap.@Name/stats//tx_error_packets*/
int os__get_WiFiSSIDStats_ErrorsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return not_implemented(value);
}
/*#Device.WiFi.SSID.{i}.Stats.ErrorsReceived!UBUS:wifi.ap.@Name/stats//rx_error_packets*/
int os__get_WiFiSSIDStats_ErrorsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return not_implemented(value);
}
/*#Device.WiFi.SSID.{i}.Stats.DiscardPacketsSent!UBUS:wifi.ap.@Name/stats//tx_dropped_packets*/
int os__get_WiFiSSIDStats_DiscardPacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return not_implemented(value);
}
/*#Device.WiFi.SSID.{i}.Stats.DiscardPacketsReceived!UBUS:wifi.ap.@Name/stats//rx_dropped_packets*/
int os__get_WiFiSSIDStats_DiscardPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return not_implemented(value);
}
/*#Device.WiFi.SSID.{i}.Stats.UnicastPacketsSent!UBUS:wifi.ap.@Name/stats//tx_unicast_packets*/
int os__get_WiFiSSIDStats_UnicastPacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return not_implemented(value);
}
/*#Device.WiFi.SSID.{i}.Stats.UnicastPacketsReceived!UBUS:wifi.ap.@Name/stats//rx_unicast_packets*/
int os__get_WiFiSSIDStats_UnicastPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return not_implemented(value);
}
/*#Device.WiFi.SSID.{i}.Stats.MulticastPacketsSent!UBUS:wifi.ap.@Name/stats//tx_multicast_packets*/
int os__get_WiFiSSIDStats_MulticastPacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return not_implemented(value);
}
/*#Device.WiFi.SSID.{i}.Stats.MulticastPacketsReceived!UBUS:wifi.ap.@Name/stats//rx_multicast_packets*/
int os__get_WiFiSSIDStats_MulticastPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return not_implemented(value);
}
/*#Device.WiFi.SSID.{i}.Stats.BroadcastPacketsSent!UBUS:wifi.ap.@Name/stats//tx_broadcast_packets*/
int os__get_WiFiSSIDStats_BroadcastPacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return not_implemented(value);
}
/*#Device.WiFi.SSID.{i}.Stats.BroadcastPacketsReceived!UBUS:wifi.ap.@Name/stats//rx_broadcast_packets*/
int os__get_WiFiSSIDStats_BroadcastPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return not_implemented(value);
}
/*#Device.WiFi.SSID.{i}.Stats.RetransCount!UBUS:wifi.ap.@Name/stats//tx_retrans_packets*/
int os__get_WiFiSSIDStats_RetransCount(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return not_implemented(value);
}
/*#Device.WiFi.SSID.{i}.Stats.FailedRetransCount!UBUS:wifi.ap.@Name/stats//tx_retrans_fail_packets*/
int os__get_WiFiSSIDStats_FailedRetransCount(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return not_implemented(value);
}
/*#Device.WiFi.SSID.{i}.Stats.RetryCount!UBUS:wifi.ap.@Name/stats//tx_retry_packets*/
int os__get_WiFiSSIDStats_RetryCount(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return not_implemented(value);
}
/*#Device.WiFi.SSID.{i}.Stats.MultipleRetryCount!UBUS:wifi.ap.@Name/stats//tx_multi_retry_packets*/
int os__get_WiFiSSIDStats_MultipleRetryCount(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return not_implemented(value);
}
/*#Device.WiFi.SSID.{i}.Stats.ACKFailureCount!UBUS:wifi.ap.@Name/stats//ack_fail_packets*/
int os__get_WiFiSSIDStats_ACKFailureCount(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return not_implemented(value);
}
/*#Device.WiFi.SSID.{i}.Stats.AggregatedPacketCount!UBUS:wifi.ap.@Name/stats//aggregate_packets*/
int os__get_WiFiSSIDStats_AggregatedPacketCount(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return not_implemented(value);
}
/*#Device.WiFi.SSID.{i}.Stats.UnknownProtoPacketsReceived!UBUS:wifi.ap.@Name/stats//rx_unknown_packets*/
int os__get_WiFiSSIDStats_UnknownProtoPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return not_implemented(value);
@ -237,7 +206,6 @@ int os__get_access_point_associative_device_statistics_multiple_retry_count(char
return not_implemented(value);
}
/*#Device.WiFi.AccessPoint.{i}.Status!UBUS:wifi.ap.@Name/status//status*/
int os_get_wifi_access_point_status (char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return not_implemented(value);
@ -332,7 +300,6 @@ int os__browseWifiNeighboringWiFiDiagnosticResultInst(struct dmctx *dmctx, DMNOD
return 0;
}
/*#Device.WiFi.Radio.{i}.OperatingStandards!UBUS:wifi.radio.@Name/status//standard*/
int os_get_radio_operating_standard(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return not_implemented(value);

View file

@ -22,31 +22,28 @@
***************************************************************************/
static int get_linker_Wifi_Radio(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker)
{
if (data && ((struct wifi_radio_args *)data)->wifi_radio_sec) {
if (data && ((struct wifi_radio_args *)data)->wifi_radio_sec)
*linker = section_name(((struct wifi_radio_args *)data)->wifi_radio_sec);
return 0;
}
*linker = "";
else
*linker = "";
return 0;
}
static int get_linker_Wifi_Ssid(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker)
{
if (data && ((struct wifi_ssid_args *)data)->ifname) {
if (data && ((struct wifi_ssid_args *)data)->ifname)
*linker = ((struct wifi_ssid_args *)data)->ifname;
return 0;
}
*linker = "";
else
*linker = "";
return 0;
}
static int get_linker_associated_device(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker)
{
if (data) {
if (data)
*linker = dmjson_get_value((json_object *)data, 1, "macaddr");
return 0;
}
*linker = "";
else
*linker = "";
return 0;
}
/**************************************************************************
@ -112,12 +109,12 @@ static int get_WiFi_SSIDNumberOfEntries(char *refparam, struct dmctx *ctx, void
static int get_WiFi_AccessPointNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *s;
int nbre= 0;
char *mode= NULL;
int nbre = 0;
char *mode = NULL;
uci_foreach_sections("wireless", "wifi-iface", s) {
dmuci_get_value_by_section_string(s, "mode", &mode);
if ((strlen(mode)>0 || mode[0] != '\0') && strcmp(mode, "ap") != 0)
if ((strlen(mode) > 0 || mode[0] != '\0') && strcmp(mode, "ap") != 0)
continue;
nbre++;
}
@ -142,15 +139,11 @@ static int get_WiFi_EndPointNumberOfEntries(char *refparam, struct dmctx *ctx, v
}
/*#Device.WiFi.SSID.{i}.Enable!UCI:wireless/wifi-iface,@i-1/disabled*/
/*#Device.WiFi.AccessPoint.{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)
{
char *val;
dmuci_get_value_by_section_string(((struct wifi_ssid_args *)data)->wifi_ssid_sec, "disabled", &val);
if ((val[0] == '\0') || (val[0] == '0'))
*value = "1";
else
*value = "0";
dmuci_get_value_by_section_string(((struct wifi_ssid_args *)data)->wifi_ssid_sec, "disabled", value);
*value = ((*value)[0] == '1') ? "0" : "1";
return 0;
}
@ -175,10 +168,7 @@ static int set_wifi_enable(char *refparam, struct dmctx *ctx, void *data, char *
static int get_wifi_status (char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_value_by_section_string(((struct wifi_ssid_args *)data)->wifi_ssid_sec, "disabled", value);
if ((*value)[0] == '\0' || (*value)[0] == '0')
*value = "Up";
else
*value = "Down";
*value = ((*value)[0] == '1') ? "Down" : "Up";
return 0;
}
@ -207,9 +197,8 @@ static int set_wlan_ssid(char *refparam, struct dmctx *ctx, void *data, char *in
/*#Device.WiFi.SSID.{i}.MACAddress!UBUS:network.device/status/name,@Name/macaddr*/
static int get_WiFiSSID_MACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
json_object *res;
json_object *res = NULL;
dmubus_call("network.device", "status", UBUS_ARGS{{"name", ((struct wifi_ssid_args *)data)->ifname, String}}, 1, &res);
DM_ASSERT(res, *value = "");
*value = dmjson_get_value(res, 1, "macaddr");
return 0;
@ -218,13 +207,8 @@ static int get_WiFiSSID_MACAddress(char *refparam, struct dmctx *ctx, void *data
/*#Device.WiFi.Radio.{i}.Enable!UCI:wireless/wifi-device,@i-1/disabled*/
static int get_radio_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char *val;
dmuci_get_value_by_section_string(((struct wifi_radio_args *)data)->wifi_radio_sec, "disabled", &val);
if (val[0] == '1')
*value = "0";
else
*value = "1";
dmuci_get_value_by_section_string(((struct wifi_radio_args *)data)->wifi_radio_sec, "disabled", value);
*value = ((*value)[0] == '1') ? "0" : "1";
return 0;
}
@ -249,10 +233,7 @@ static int set_radio_enable(char *refparam, struct dmctx *ctx, void *data, char
static int get_radio_status (char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_value_by_section_string(((struct wifi_radio_args *)data)->wifi_radio_sec, "disabled", value);
if ((*value)[0] == '1')
*value = "Down";
else
*value = "Up";
*value = ((*value)[0] == '1') ? "Down" : "Up";
return 0;
}
@ -281,6 +262,7 @@ static int get_WiFiRadio_Name(char *refparam, struct dmctx *ctx, void *data, cha
return 0;
}
/*#Device.WiFi.Radio.{i}.X_IOPSYS_EU_MaxAllowedAssociations!UCI:wireless/wifi-device,@i-1/maxassoc*/
static int get_radio_maxassoc(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_value_by_section_string(((struct wifi_radio_args *)data)->wifi_radio_sec, "maxassoc", value);
@ -300,6 +282,7 @@ static int set_radio_maxassoc(char *refparam, struct dmctx *ctx, void *data, cha
return 0;
}
/*#Device.WiFi.Radio.{i}.X_IOPSYS_EU_DFSEnable!UCI:wireless/wifi-device,@i-1/dfsc*/
static int get_radio_dfsenable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char *val;
@ -515,13 +498,8 @@ static int set_WiFiRadio_OperatingChannelBandwidth(char *refparam, struct dmctx
/*#Device.WiFi.Radio.{i}.PreambleType!UCI:wireless/wifi-device,@i-1/short_preamble*/
static int get_WiFiRadio_PreambleType(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char *preamble = NULL;
dmuci_get_value_by_section_string(((struct wifi_radio_args *)data)->wifi_radio_sec, "short_preamble", &preamble);
if (preamble[0] == '\0' || strlen(preamble) == 0 || strcmp(preamble, "1") != 0)
*value = "long";
else
*value = "short";
dmuci_get_value_by_section_string(((struct wifi_radio_args *)data)->wifi_radio_sec, "short_preamble", value);
*value = ((*value)[0] == '0') ? "short" : "long";
return 0;
}
@ -533,10 +511,7 @@ static int set_WiFiRadio_PreambleType(char *refparam, struct dmctx *ctx, void *d
return FAULT_9007;
break;
case VALUESET:
if(strcmp(value, "short") == 0)
dmuci_set_value_by_section(((struct wifi_radio_args *)data)->wifi_radio_sec, "short_preamble", "1");
else
dmuci_set_value_by_section(((struct wifi_radio_args *)data)->wifi_radio_sec, "short_preamble", "0");
dmuci_set_value_by_section(((struct wifi_radio_args *)data)->wifi_radio_sec, "short_preamble", (strcmp(value, "short") == 0) ? "1" : "0");
break;
}
return 0;
@ -600,11 +575,8 @@ static int get_WiFiRadio_RegulatoryDomain(char *refparam, struct dmctx *ctx, voi
dmuci_get_value_by_section_string(((struct wifi_radio_args *)data)->wifi_radio_sec, "country", &country);
arr = strsplit(country, "/", &length);
if(arr && arr[0])
if (arr && arr[0])
dmasprintf(value, "%s ", arr[0]);
else
*value= "";
return 0;
}
@ -684,12 +656,8 @@ static int set_radio_auto_channel_enable(char *refparam, struct dmctx *ctx, void
/*#Device.WiFi.SSID.{i}.SSIDAdvertisementEnabled!UCI:wireless/wifi-iface,@i-1/hidden*/
static int get_wlan_ssid_advertisement_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char *hidden;
dmuci_get_value_by_section_string(((struct wifi_ssid_args *)data)->wifi_ssid_sec, "hidden", &hidden);
if (hidden[0] == '1' && hidden[1] == '\0')
*value = "0";
else
*value = "1";
dmuci_get_value_by_section_string(((struct wifi_ssid_args *)data)->wifi_ssid_sec, "hidden", value);
*value = ((*value)[0] == '1') ? "0" : "1";
return 0;
}
@ -704,7 +672,7 @@ static int set_wlan_ssid_advertisement_enable(char *refparam, struct dmctx *ctx,
return 0;
case VALUESET:
string_to_bool(value, &b);
dmuci_set_value_by_section(((struct wifi_ssid_args *)data)->wifi_ssid_sec, "hidden", b ? "" : "1");
dmuci_set_value_by_section(((struct wifi_ssid_args *)data)->wifi_ssid_sec, "hidden", b ? "0" : "1");
return 0;
}
@ -714,11 +682,8 @@ static int set_wlan_ssid_advertisement_enable(char *refparam, struct dmctx *ctx,
/*#Device.WiFi.AccessPoint.{i}.WMMEnable!UCI:wireless/wifi-device,@i-1/wmm*/
static int get_wmm_enabled(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
bool b;
dmuci_get_value_by_section_string(((struct wifi_acp_args *)data)->wifi_acp_sec, "device", value);
dmuci_get_option_value_string("wireless", *value, "wmm", value);
string_to_bool(*value, &b);
*value = (b) ? "true" : "false";
return 0;
}
@ -735,15 +700,9 @@ static int set_wmm_enabled(char *refparam, struct dmctx *ctx, void *data, char *
case VALUESET:
string_to_bool(value, &b);
dmuci_get_value_by_section_string(((struct wifi_acp_args *)data)->wifi_acp_sec, "device", &device);
if (b) {
dmuci_set_value("wireless", device, "wmm", "1");
dmuci_set_value("wireless", device, "wmm_noack", "1");
dmuci_set_value("wireless", device, "wmm_apsd", "1");
} else {
dmuci_set_value("wireless", device, "wmm", "0");
dmuci_set_value("wireless", device, "wmm_noack", "");
dmuci_set_value("wireless", device, "wmm_apsd", "");
}
dmuci_set_value("wireless", device, "wmm", b ? "1" : "0");
dmuci_set_value("wireless", device, "wmm_noack", b ? "1" : "");
dmuci_set_value("wireless", device, "wmm_apsd", b ? "1" : "");
return 0;
}
return 0;
@ -752,9 +711,8 @@ static int set_wmm_enabled(char *refparam, struct dmctx *ctx, void *data, char *
/*#Device.WiFi.AccessPoint.{i}.MaxAssociatedDevices!UCI:wireless/wifi-iface,@i-1/maxassoc*/
static int get_access_point_maxassoc(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char *device;
dmuci_get_value_by_section_string(((struct wifi_ssid_args *)data)->wifi_ssid_sec, "device", &device);
dmuci_get_option_value_string("wireless", device, "maxassoc", value);
dmuci_get_value_by_section_string(((struct wifi_ssid_args *)data)->wifi_ssid_sec, "device", value);
dmuci_get_option_value_string("wireless", *value, "maxassoc", value);
return 0;
}
@ -797,10 +755,8 @@ static int get_WiFiAccessPoint_WMMCapability(char *refparam, struct dmctx *ctx,
/*#Device.WiFi.AccessPoint.{i}.MaxAllowedAssociations!UCI:wireless/wifi-iface,@i-1/maxassoc*/
static int get_WiFiAccessPoint_MaxAllowedAssociations(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char *device;
dmuci_get_value_by_section_string(((struct wifi_acp_args *)data)->wifi_acp_sec, "device", &device);
dmuci_get_option_value_string("wireless", device, "maxassoc", value);
dmuci_get_value_by_section_string(((struct wifi_acp_args *)data)->wifi_acp_sec, "device", value);
dmuci_get_option_value_string("wireless", *value, "maxassoc", value);
return 0;
}
@ -847,14 +803,13 @@ static int set_WiFiAccessPoint_IsolationEnable(char *refparam, struct dmctx *ctx
return 0;
}
/*#Device.WiFi.AccessPoint.{i}.AllowedMACAddress!UCI:wireless/wifi-iface,@i-1/maclist*/
static int get_WiFiAccessPoint_AllowedMACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_list *val;
dmuci_get_value_by_section_list(((struct wifi_acp_args *)data)->wifi_acp_sec, "maclist", &val);
if (val)
*value = dmuci_list_to_string(val, " ");
else
*value = "";
return 0;
}
@ -870,10 +825,9 @@ static int set_WiFiAccessPoint_AllowedMACAddress(char *refparam, struct dmctx *c
return FAULT_9007;
break;
case VALUESET:
arr= strsplit(value, " ", &length);
for (i = 0; i < length; i++){
arr = strsplit(value, " ", &length);
for (i = 0; i < length; i++)
dmuci_add_list_value_by_section(((struct wifi_acp_args *)data)->wifi_acp_sec, "maclist", arr[i]);
}
break;
}
return 0;
@ -972,6 +926,7 @@ static int reset_wlan(struct uci_section *s)
return 0;
}
/*#Device.WiFi.AccessPoint.{i}.Security.ModeEnabled!UCI:wireless/wifi-iface,@i-1/encryption&UCI:wireless/wifi-iface,@i-1/cipher*/
static int get_access_point_security_modes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char *encryption, *cipher;
@ -1092,15 +1047,13 @@ static int set_access_point_security_wepkey(char *refparam, struct dmctx *ctx, v
return 0;
}
/*#Device.WiFi.AccessPoint.{i}.Security.X_IOPSYS_EU_WEPKeyInde!UCI:wireless/wifi-iface,@i-1/key_index*/
static int get_access_point_security_wepkey_index(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char *key_index;
dmuci_get_value_by_section_string(((struct wifi_acp_args *)data)->wifi_acp_sec, "key_index", &key_index);
if (*key_index == '\0')
*value = "1";
else
*value = key_index;
*value = (*key_index == '\0') ? "1" : key_index;
return 0;
}
@ -1111,9 +1064,8 @@ static int set_access_point_security_wepkey_index(char *refparam, struct dmctx *
//TODO
return 0;
case VALUESET:
if (atoi(value)>=1 && atoi(value)<=4) {
if (atoi(value) >= 1 && atoi(value) <= 4)
dmuci_set_value_by_section(((struct wifi_acp_args *)data)->wifi_acp_sec, "key_index", value);
}
return 0;
}
return 0;
@ -1122,6 +1074,7 @@ static int set_access_point_security_wepkey_index(char *refparam, struct dmctx *
static int set_access_point_security_shared_key(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
char *encryption;
switch (action) {
case VALUECHECK:
if (dm_validate_hexBinary(value, RANGE_ARGS{{NULL,"32"}}, 1))
@ -1129,9 +1082,8 @@ static int set_access_point_security_shared_key(char *refparam, struct dmctx *ct
return 0;
case VALUESET:
dmuci_get_value_by_section_string(((struct wifi_acp_args *)data)->wifi_acp_sec, "encryption", &encryption);
if (strcmp(encryption, "psk") == 0 || strcmp(encryption, "psk2") == 0 || strcmp(encryption, "mixed-psk") == 0 ) {
if (strcmp(encryption, "psk") == 0 || strcmp(encryption, "psk2") == 0 || strcmp(encryption, "mixed-psk") == 0 )
dmuci_set_value_by_section(((struct wifi_acp_args *)data)->wifi_acp_sec, "key", value);
}
return 0;
}
return 0;
@ -1148,9 +1100,8 @@ static int set_access_point_security_passphrase(char *refparam, struct dmctx *ct
return 0;
case VALUESET:
dmuci_get_value_by_section_string(((struct wifi_acp_args *)data)->wifi_acp_sec, "encryption", &encryption);
if (strcmp(encryption, "psk") == 0 || strcmp(encryption, "psk2") == 0 || strcmp(encryption, "mixed-psk") == 0 ) {
if (strcmp(encryption, "psk") == 0 || strcmp(encryption, "psk2") == 0 || strcmp(encryption, "mixed-psk") == 0 )
set_access_point_security_shared_key(refparam, ctx, data, instance, value, action);
}
return 0;
}
return 0;
@ -1176,11 +1127,8 @@ static int set_access_point_security_rekey_interval(char *refparam, struct dmctx
return 0;
case VALUESET:
dmuci_get_value_by_section_string(((struct wifi_acp_args *)data)->wifi_acp_sec, "encryption", &encryption);
if (strcmp(encryption, "wep-open") == 0 || strcmp(encryption, "wep-shared") == 0 || strcmp(encryption, "none") == 0)
return 0;
else {
if (strcmp(encryption, "wep-open") != 0 && strcmp(encryption, "wep-shared") != 0 && strcmp(encryption, "none") != 0)
dmuci_set_value_by_section(((struct wifi_acp_args *)data)->wifi_acp_sec, "gtk_rekey", value);
}
return 0;
}
return 0;
@ -1719,7 +1667,7 @@ static int set_WiFiEndPointProfile_SSID(char *refparam, struct dmctx *ctx, void
return 0;
}
/*#Device.WiFi.EndPoint.{i}.Profile.{i}.Security.SSID!UCI:wireless/wifi-iface,@i-1/encryption*/
/*#Device.WiFi.EndPoint.{i}.Profile.{i}.Security.SSID!UCI:wireless/wifi-iface,@i-1/encryption&UCI:wireless/wifi-iface,@i-1/cipher*/
static int get_WiFiEndPointProfileSecurity_ModeEnabled(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char *encryption, *cipher;

View file

@ -0,0 +1,213 @@
{
"Device.X_IOPSYS_EU_Buttons.": {
"type": "object",
"protocols": [
"cwmp",
"usp"
],
"array": true,
"mapping": {
"type": "uci",
"uci": {
"file": "buttons",
"section": {
"type": "button"
},
"dmmapfile": "dmmap_buttons"
}
},
"Alias": {
"type": "string",
"protocols": [
"cwmp",
"usp"
],
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"uci": {
"file": "dmmap_buttons",
"section": {
"type": "button",
"index": "@i-1"
},
"option": {
"name": "buttonalias"
},
"path": "/etc/bbfdm"
}
}
]
},
"Enable": {
"type": "boolean",
"protocols": [
"cwmp",
"usp"
],
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"uci": {
"file": "buttons",
"section": {
"type": "button",
"index": "@i-1"
},
"option": {
"name": "enable"
}
}
}
]
},
"Name": {
"type": "string",
"protocols": [
"cwmp",
"usp"
],
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"uci": {
"file": "buttons",
"section": {
"type": "button",
"index": "@i-1"
},
"option": {
"name": "@Name"
}
}
}
]
},
"GPIOButton": {
"type": "string",
"protocols": [
"cwmp",
"usp"
],
"read": true,
"write": false,
"mapping": [
{
"type": "uci",
"uci": {
"file": "buttons",
"section": {
"type": "button",
"index": "@i-1"
},
"option": {
"name": "button"
}
}
}
]
},
"HotplugInterface": {
"type": "string",
"protocols": [
"cwmp",
"usp"
],
"read": true,
"write": false,
"mapping": [
{
"type": "uci",
"uci": {
"file": "buttons",
"section": {
"type": "button",
"index": "@i-1"
},
"option": {
"name": "hotplug"
}
}
}
]
},
"HotplugInterfaceForLongPress": {
"type": "string",
"protocols": [
"cwmp",
"usp"
],
"read": true,
"write": false,
"mapping": [
{
"type": "uci",
"uci": {
"file": "buttons",
"section": {
"type": "button",
"index": "@i-1"
},
"option": {
"name": "hotplug_long"
}
}
}
]
},
"MinPressTime": {
"type": "unsignedInt",
"protocols": [
"cwmp",
"usp"
],
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"uci": {
"file": "buttons",
"section": {
"type": "button",
"index": "@i-1"
},
"option": {
"name": "minpress"
}
}
}
]
},
"LongPressTime": {
"type": "unsignedInt",
"protocols": [
"cwmp",
"usp"
],
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"uci": {
"file": "buttons",
"section": {
"type": "button",
"index": "@i-1"
},
"option": {
"name": "longpress"
}
}
}
]
}
}
}

View file

@ -0,0 +1,333 @@
{
"Device.X_IOPSYS_EU_Dropbear.": {
"type": "object",
"protocols": [
"cwmp",
"usp"
],
"array": true,
"mapping": {
"type": "uci",
"uci": {
"file": "dropbear",
"section": {
"type": "dropbear"
},
"dmmapfile": "dmmap_dropbear"
}
},
"Alias": {
"type": "string",
"protocols": [
"cwmp",
"usp"
],
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"uci": {
"file": "dmmap_dropbear",
"section": {
"type": "dropbear",
"index": "@i-1"
},
"option": {
"name": "dropbearalias"
},
"path":"/etc/bbfdm",
}
}
]
},
"PasswordAuth": {
"type": "boolean",
"protocols": [
"cwmp",
"usp"
],
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"uci": {
"file": "dropbear",
"section": {
"type": "dropbear",
"index": "@i-1"
},
"option": {
"name": "PasswordAuth"
}
}
}
]
},
"RootPasswordAuth": {
"type": "boolean",
"protocols": [
"cwmp",
"usp"
],
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"uci": {
"file": "dropbear",
"section": {
"type": "dropbear",
"index": "@i-1"
},
"option": {
"name": "RootPasswordAuth"
}
}
}
]
},
"Port": {
"type": "unsignedInt",
"protocols": [
"cwmp",
"usp"
],
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"uci": {
"file": "dropbear",
"section": {
"type": "dropbear",
"index": "@i-1"
},
"option": {
"name": "Port"
}
}
}
]
},
"RootLogin": {
"type": "boolean",
"protocols": [
"cwmp",
"usp"
],
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"uci": {
"file": "dropbear",
"section": {
"type": "dropbear",
"index": "@i-1"
},
"option": {
"name": "RootLogin"
}
}
}
]
},
"GatewayPorts": {
"type": "boolean",
"protocols": [
"cwmp",
"usp"
],
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"uci": {
"file": "dropbear",
"section": {
"type": "dropbear",
"index": "@i-1"
},
"option": {
"name": "GatewayPorts"
}
}
}
]
},
"Interface": {
"type": "string",
"protocols": [
"cwmp",
"usp"
],
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"uci": {
"file": "dropbear",
"section": {
"type": "dropbear",
"index": "@i-1"
},
"option": {
"name": "Interface"
}
}
}
]
},
"RSAKeyFile": {
"type": "string",
"protocols": [
"cwmp",
"usp"
],
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"uci": {
"file": "dropbear",
"section": {
"type": "dropbear",
"index": "@i-1"
},
"option": {
"name": "rsakeyfile"
}
}
}
]
},
"DSSKeyFile": {
"type": "string",
"protocols": [
"cwmp",
"usp"
],
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"uci": {
"file": "dropbear",
"section": {
"type": "dropbear",
"index": "@i-1"
},
"option": {
"name": "dsskeyfile"
}
}
}
]
},
"SSHKeepAlive": {
"type": "unsignedInt",
"protocols": [
"cwmp",
"usp"
],
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"uci": {
"file": "dropbear",
"section": {
"type": "dropbear",
"index": "@i-1"
},
"option": {
"name": "SSHKeepAlive"
}
}
}
]
},
"IdleTimeout": {
"type": "unsignedInt",
"protocols": [
"cwmp",
"usp"
],
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"uci": {
"file": "dropbear",
"section": {
"type": "dropbear",
"index": "@i-1"
},
"option": {
"name": "IdleTimeout"
}
}
}
]
},
"Verbose": {
"type": "boolean",
"protocols": [
"cwmp",
"usp"
],
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"uci": {
"file": "dropbear",
"section": {
"type": "dropbear",
"index": "@i-1"
},
"option": {
"name": "verbose"
}
}
}
]
},
"BannerFile": {
"type": "string",
"protocols": [
"cwmp",
"usp"
],
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"uci": {
"file": "dropbear",
"section": {
"type": "dropbear",
"index": "@i-1"
},
"option": {
"name": "BannerFile"
}
}
}
]
}
}
}

417
json/X_IOPSYS_EU_OWSD.json Normal file
View file

@ -0,0 +1,417 @@
{
"Device.X_IOPSYS_EU_OWSD.": {
"type": "object",
"protocols": [
"cwmp",
"usp"
],
"array": false,
"UnixSocket": {
"type": "string",
"protocols": [
"cwmp",
"usp"
],
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"uci": {
"file": "owsd",
"section": {
"name": "global"
},
"option": {
"name": "sock"
}
}
}
]
},
"URLRedirect": {
"type": "string",
"protocols": [
"cwmp",
"usp"
],
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"uci": {
"file": "owsd",
"section": {
"name": "global"
},
"option": {
"name": "redirect"
}
}
}
]
},
"Device.X_IOPSYS_EU_OWSD.UbusProxy.": {
"type": "object",
"protocols": [
"cwmp",
"usp"
],
"array": false,
"Enable": {
"type": "boolean",
"protocols": [
"cwmp",
"usp"
],
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"uci": {
"file": "owsd",
"section": {
"name": "ubusproxy"
},
"option": {
"name": "enable"
}
}
}
]
},
"PeerCertificate": {
"type": "string",
"protocols": [
"cwmp",
"usp"
],
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"uci": {
"file": "owsd",
"section": {
"name": "ubusproxy"
},
"option": {
"name": "peer_cert"
}
}
}
]
},
"PeerKey": {
"type": "string",
"protocols": [
"cwmp",
"usp"
],
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"uci": {
"file": "owsd",
"section": {
"name": "ubusproxy"
},
"option": {
"name": "peer_key"
}
}
}
]
},
"PeerCA": {
"type": "string",
"protocols": [
"cwmp",
"usp"
],
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"uci": {
"file": "owsd",
"section": {
"name": "ubusproxy"
},
"option": {
"name": "peer_ca"
}
}
}
]
}
},
"Device.X_IOPSYS_EU_OWSD.VirtualHost.{i}.": {
"type": "object",
"protocols": [
"cwmp",
"usp"
],
"array": true,
"mapping": {
"type": "uci",
"uci": {
"file": "owsd",
"section": {
"type": "owsd-listen"
},
"dmmapfile": "dmmap_owsd"
}
},
"Alias": {
"type": "string",
"protocols": [
"cwmp",
"usp"
],
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"uci": {
"file": "dmmap_owsd",
"section": {
"type": "owsd-listen",
"index": "@i-1"
},
"option": {
"name": "olistenalias"
},
"path":"/etc/bbfdm",
}
}
]
},
"Interface": {
"type": "string",
"protocols": [
"cwmp",
"usp"
],
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"uci": {
"file": "owsd",
"section": {
"type": "owsd-listen",
"index": "@i-1"
},
"option": {
"name": "interface"
},
"ref": "Device.IP.Interface"
}
}
]
},
"Port": {
"type": "unsignedInt",
"protocols": [
"cwmp",
"usp"
],
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"uci": {
"file": "owsd",
"section": {
"type": "owsd-listen",
"index": "@i-1"
},
"option": {
"name": "port"
}
}
}
]
},
"IPv6Enable": {
"type": "boolean",
"protocols": [
"cwmp",
"usp"
],
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"uci": {
"file": "owsd",
"section": {
"type": "owsd-listen",
"index": "@i-1"
},
"option": {
"name": "ipv6"
}
}
}
]
},
"AllowInterfaceIPAddressAsOrigin": {
"type": "boolean",
"protocols": [
"cwmp",
"usp"
],
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"uci": {
"file": "owsd",
"section": {
"type": "owsd-listen",
"index": "@i-1"
},
"option": {
"name": "whitelist_interface_as_origin"
}
}
}
]
},
"AllowDHCPDomainsAsOrigin": {
"type": "boolean",
"protocols": [
"cwmp",
"usp"
],
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"uci": {
"file": "owsd",
"section": {
"type": "owsd-listen",
"index": "@i-1"
},
"option": {
"name": "whitelist_dhcp_domains"
}
}
}
]
},
"AllowedOrigins": {
"type": "string",
"protocols": [
"cwmp",
"usp"
],
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"uci": {
"file": "owsd",
"section": {
"type": "owsd-listen",
"index": "@i-1"
},
"option": {
"name": "origin"
}
}
}
]
},
"Certificate": {
"type": "string",
"protocols": [
"cwmp",
"usp"
],
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"uci": {
"file": "owsd",
"section": {
"type": "owsd-listen",
"index": "@i-1"
},
"option": {
"name": "cert"
}
}
}
]
},
"Key": {
"type": "string",
"protocols": [
"cwmp",
"usp"
],
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"uci": {
"file": "owsd",
"section": {
"type": "owsd-listen",
"index": "@i-1"
},
"option": {
"name": "key"
}
}
}
]
},
"CA": {
"type": "string",
"protocols": [
"cwmp",
"usp"
],
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"uci": {
"file": "owsd",
"section": {
"type": "owsd-listen",
"index": "@i-1"
},
"option": {
"name": "ca"
}
}
}
]
}
}
}
}

View file

@ -0,0 +1,79 @@
{
"Device.X_IOPSYS_EU_Syslog.": {
"type": "object",
"protocols": [
"cwmp",
"usp"
],
"array": false,
"ServerIPAddress": {
"type": "string",
"protocols": [
"cwmp",
"usp"
],
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"uci": {
"file": "system",
"section": {
"name": "@system[0]"
},
"option": {
"name": "log_ip"
}
}
}
]
},
"ServerPort": {
"type": "unsignedInt",
"protocols": [
"cwmp",
"usp"
],
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"uci": {
"file": "system",
"section": {
"name": "@system[0]"
},
"option": {
"name": "log_port"
}
}
}
]
},
"ConsoleLogLevel": {
"type": "unsignedInt",
"protocols": [
"cwmp",
"usp"
],
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"uci": {
"file": "system",
"section": {
"name": "@system[0]"
},
"option": {
"name": "conloglevel"
}
}
}
]
}
}
}

View file

@ -0,0 +1,99 @@
{
"Device.X_IOPSYS_EU_WiFiLife.": {
"type": "object",
"protocols": [
"cwmp",
"usp"
],
"array": false,
"Enable": {
"type": "boolean",
"protocols": [
"cwmp",
"usp"
],
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"uci": {
"file": "wifilife",
"section": {
"name": "@wifilife[0]"
},
"option": {
"name": "enabled"
}
}
}
]
},
"Device.X_IOPSYS_EU_WiFiLife.Steering": {
"type": "object",
"protocols": [
"cwmp",
"usp"
],
"array": true,
"mapping": {
"type": "uci",
"uci": {
"file": "wifilife",
"section": {
"type": "steer"
},
"dmmapfile": "dmmap_wifilife"
}
},
"Enable": {
"type": "boolean",
"protocols": [
"cwmp",
"usp"
],
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"uci": {
"file": "wifilife",
"section": {
"type": "steer",
"index": "@i-1"
},
"option": {
"name": "enabled"
}
}
}
]
},
"LegacyFallback": {
"type": "boolean",
"protocols": [
"cwmp",
"usp"
],
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"uci": {
"file": "wifilife",
"section": {
"type": "steer",
"index": "@i-1"
},
"option": {
"name": "fallback_legacy"
}
}
}
]
}
}
}
}

View file

@ -1958,7 +1958,32 @@
"max": 999
}
]
},
"X_IOPSYS_EU_CallLines": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"mapping": [
{
"type": "uci",
"uci": {
"file": "voice_client",
"section": {
"type": "sip_advanced",
"name": "SIP"
},
"option": {
"name": "call_lines"
}
}
}
]
},
"Device.Services.VoiceService.{i}.VoiceProfile.{i}.SIP.EventSubscribe.{i}.": {
"type": "object",
"protocols": [
@ -3777,6 +3802,21 @@
"Disabled",
"Quiescent",
"Enabled"
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "voice_client",
"section": {
"type": "tel_line",
"index": "@i-1"
},
"option": {
"name": "enabled"
}
}
}
]
},
"Alias": {
@ -3807,6 +3847,21 @@
{
"max": 32
}
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "voice_client",
"section": {
"type": "tel_line",
"index": "@i-1"
},
"option": {
"name": "extension"
}
}
}
]
},
"Status": {
@ -3887,6 +3942,55 @@
}
]
},
"X_IOPSYS_EU_LineProfile": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"mapping": [
]
},
"X_IOPSYS_EU_TELLine": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"mapping": [
]
},
"X_IOPSYS_EU_ComfortNoiseEnable": {
"type": "boolean",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "voice_client",
"section": {
"type": "tel_line",
"index": "@i-1"
},
"option": {
"name": "noise"
}
}
}
]
},
"Device.Services.VoiceService.{i}.VoiceProfile.{i}.Line.{i}.SIP.": {
"type": "object",
"protocols": [

File diff suppressed because it is too large Load diff

View file

@ -246,8 +246,8 @@ def getparammapping(dmobject, dmparam):
for value in listmapping:
if param in value:
hasmapping = 1
comment = value.split("!")
mapping = comment[1]
config_type = value.split("!")
mapping = config_type[1]
mapping = mapping.replace("*/\n", "")
break
@ -261,12 +261,12 @@ def getobjmapping(dmobject):
else:
obj = dmobject.get('name')
for value in listmapping:
comment = value.split("!")
mapping = comment[0]
config_type = value.split("!")
mapping = config_type[0]
mapping = mapping.replace("/*#", "")
if obj == mapping:
hasmapping = 1
mapping = comment[1]
mapping = config_type[1]
mapping = mapping.replace("*/\n", "")
break
@ -312,46 +312,56 @@ def printclosefile ():
def printOBJMaPPING (mapping):
fp = open('./.json_tmp', 'a')
comment = mapping.split(":")
config = comment[1].split("/")
if comment[0] == "UCI":
type = "uci"
elif comment[0] == "UBUS":
type = "ubus"
else:
type = "cli"
config_type = mapping.split(":")
config = config_type[1].split("/")
print >> fp, "\"mapping\": {"
print >> fp, "\"type\": \"%s\"," % type
print >> fp, "\"%s\": {" % type
if comment[0] == "UCI":
print >> fp, "\"type\": \"%s\"," % config_type[0].lower()
print >> fp, "\"%s\": {" % config_type[0].lower()
# UCI
if config_type[0] == "UCI":
print >> fp, "\"file\": \"%s\"," % config[0]
print >> fp, "\"section\": {"
print >> fp, "\"type\": \"%s\"" % config[1]
print >> fp, "},"
print >> fp, "\"dmmapfile\": \"%s\"" % config[2]
# UBUS
elif config_type[0] == "UBUS":
print >> fp, "\"object\": \"%s\"," % config[0]
print >> fp, "\"method\": \"%s\"," % config[1]
print >> fp, "\"args\": {"
if config[2] != "":
args = config[2].split(",")
print >> fp, "\"%s\": \"%s\"" % (args[0], args[1])
print >> fp, "}"
print >> fp, "}"
print >> fp, "\"key\": \"%s\"" % config[3]
print >> fp, "}\n}"
fp.close()
def printPARAMMaPPING (mapping):
fp = open('./.json_tmp', 'a')
lst = mapping.split("&")
count = len(lst)
print >> fp, "\"mapping\": ["
for i in range(count):
comment = lst[i].split(":")
config = comment[1].split("/")
if comment[0] == "UCI":
type = "uci"
elif comment[0] == "UBUS":
type = "ubus"
else:
type = "cli"
print >> fp, "{"
print >> fp, "\"type\": \"%s\"," % type
print >> fp, "\"%s\": {" % type
for i in range(len(lst)):
config_type = lst[i].split(":")
config = config_type[1].split("/")
if comment[0] == "UCI":
print >> fp, "{"
print >> fp, "\"type\": \"%s\"," % config_type[0].lower()
# SYSFS || PROCFS
if config_type[0] == "SYSFS" or config_type[0] == "PROCFS":
print >> fp, "\"file\": \"%s\"" % config_type[1]
# UCI, UBUS, CLI
else:
# Only for UCI, UBUS, CLI
print >> fp, "\"%s\": {" % config_type[0].lower()
# UCI
if config_type[0] == "UCI":
print >> fp, "\"file\": \"%s\"," % config[0]
print >> fp, "\"section\": {"
var = config[1].split(",")
@ -368,7 +378,9 @@ def printPARAMMaPPING (mapping):
print >> fp, "\"option\": {"
print >> fp, "\"name\": \"%s\"" % config[2]
print >> fp, "}"
elif comment[0] == "UBUS":
# UBUS
elif config_type[0] == "UBUS":
print >> fp, "\"object\": \"%s\"," % config[0]
print >> fp, "\"method\": \"%s\"," % config[1]
print >> fp, "\"args\": {"
@ -377,14 +389,16 @@ def printPARAMMaPPING (mapping):
print >> fp, "\"%s\": \"%s\"" % (args[0], args[1])
print >> fp, "}"
print >> fp, "\"key\": \"%s\"" % config[3]
else:
# CLI
elif config_type[0] == "CLI":
print >> fp, "\"command\": \"%s\"," % config[0]
print >> fp, "\"args\": \"%s\"" % config[1]
print >> fp, "}"
print >> fp, "}"
print >> fp, "]"
print >> fp, "}"
print >> fp, "]\n}"
fp.close()
def removelastline ():