Separate icwmp and libdatamodel

This commit is contained in:
Amin Ben Ramdhane 2019-08-26 16:49:43 +01:00
parent 8b4d8c27b9
commit 7b419333d9
147 changed files with 85 additions and 158571 deletions

2
.gitignore vendored
View file

@ -27,4 +27,4 @@ missing
.dirstamp
.git_update
.pkgdir/
json/source_*

View file

@ -1,150 +1,6 @@
CWMP_VERSION = 3.0.0
LIB_DATAMODEL_VERSION = 3:0:0
lib_LTLIBRARIES = libdatamodel.la
libdatamodel_la_SOURCES = \
../md5.c \
../dm/dmcwmp.c \
../dm/dmentry.c \
../dm/dmmem.c \
../dm/dmubus.c \
../dm/dmjson.c \
../dm/dmuci.c \
../dm/dmcommon.c \
../dm/wepkey.c \
../dm/dmtree/common/deviceinfo.c \
../dm/dmtree/common/managementserver.c \
../dm/dmtree/common/softwaremodules.c \
../dm/dmtree/common/times.c \
../dm/dmtree/common/upnp.c \
../dm/dmtree/common/voice_services.c \
../dm/dmtree/common/x_iopsys_eu_ice.c \
../dm/dmtree/common/x_iopsys_eu_igmp.c \
../dm/dmtree/common/x_iopsys_eu_ipacccfg.c \
../dm/dmtree/common/x_iopsys_eu_logincfg.c \
../dm/dmtree/common/x_iopsys_eu_power_mgmt.c \
../dm/dmtree/common/x_iopsys_eu_syslog.c \
../dm/dmtree/common/x_iopsys_eu_dropbear.c \
../dm/dmtree/common/x_iopsys_eu_owsd.c \
../dm/dmtree/common/x_iopsys_eu_buttons.c \
../dm/dmtree/common/x_iopsys_eu_wifilife.c \
../dm/dmtree/common/root.c
if XMPP_ENABLE
libdatamodel_la_SOURCES += \
../dm/dmtree/common/xmpp.c
endif
libdatamodel_la_SOURCES += \
../dm/dmtree/tr098/lan_interfaces.c \
../dm/dmtree/tr098/landevice.c \
../dm/dmtree/tr098/layer_2_bridging.c \
../dm/dmtree/tr098/wandevice.c \
../dm/dmtree/tr098/x_iopsys_eu_wifi.c \
../dm/dmtree/tr098/ippingdiagnostics.c \
../dm/dmtree/tr098/downloaddiagnostic.c \
../dm/dmtree/tr098/uploaddiagnostic.c \
../dm/dmtree/tr098/deviceconfig.c \
../dm/dmtree/tr098/layer_3_forwarding.c
libdatamodel_la_SOURCES += \
../dm/dmtree/tr181/wifi.c \
../dm/dmtree/tr181/ethernet.c \
../dm/dmtree/tr181/wan.c \
../dm/dmtree/tr181/bridging.c \
../dm/dmtree/tr181/hosts.c \
../dm/dmtree/tr181/dhcp.c \
../dm/dmtree/tr181/ip.c \
../dm/dmtree/tr181/ppp.c \
../dm/dmtree/tr181/nat.c \
../dm/dmtree/tr181/routing.c \
../dm/dmtree/tr181/userinterface.c \
../dm/dmtree/tr181/firewall.c \
../dm/dmtree/tr181/dns.c \
../dm/dmtree/tr181/users.c \
../dm/dmtree/tr181/dhcpv6.c \
../dm/dmtree/tr181/dsl.c \
../dm/dmtree/tr181/interfacestack.c \
../dm/dmtree/tr181/qos.c \
../dm/dmtree/tr181/usb.c
if UPNP_TR064
libdatamodel_la_SOURCES += \
../dm/dmtree/upnp/upnp_deviceinfo.c \
../dm/dmtree/upnp/upnp_configuration.c \
../dm/dmtree/upnp/upnp_monitoring.c \
../dm/dmtree/upnp/upnp_common.c
endif
libdatamodel_la_CFLAGS = \
$(AM_CFLAGS) \
$(LIBUCI_CFLAGS) \
$(LIBUBOX_CFLAGS) \
$(LIBUBUS_CFLAGS)
libdatamodel_la_LDFLAGS = \
$(AM_LDFLAGS) \
$(LIBUCI_LDFLAGS) \
$(LIBUBOX_LDFLAGS) \
$(LIBUBUS_LDFLAGS) \
-share \
-version-info $(LIB_DATAMODEL_VERSION)
libdatamodel_la_LIBADD = \
$(AM_LIBS) \
$(LIBUCI_LIBS) \
$(LIBUBOX_LIBS) \
$(LIBUBUS_LIBS) \
$(LIBJSON_LIBS) \
$(LBLOBMSG_LIBS) \
-lusb-1.0
libdatamodel_la_CFLAGS+=-DCWMP_VERSION=\"$(CWMP_VERSION)\"
libdatamodel_la_LDFLAGS+=-DCWMP_VERSION=\"$(CWMP_VERSION)\"
libdatamodel_la_CFLAGS+=-I../inc/
libdatamodel_la_CFLAGS+=-I../dm/
libdatamodel_la_CFLAGS+=-I../dm/dmtree/
libdatamodel_la_CFLAGS+=-I../dm/dmtree/common
libdatamodel_la_CFLAGS+=-I../dm/dmtree/tr098
libdatamodel_la_CFLAGS+=-I../dm/dmtree/tr181
libdatamodel_la_CFLAGS+=-I../dm/dmtree/upnp
bin_PROGRAMS = icwmpd icwmp_stund
icwmp_stund_SOURCES = \
../stun/stun.c \
../stun/stun.h \
../stun/log.c \
../stun/log.h \
../stun/ubus.c \
../stun/ubus.h \
../stun/config.c \
../stun/config.h
icwmp_stund_CFLAGS = \
$(AM_CFLAGS) \
$(LIBUCI_CFLAGS) \
$(LIBUBUS_CFLAGS) \
$(LIBUBOX_CFLAGS)
icwmp_stund_LDFLAGS = \
$(AM_LDFLAGS) \
$(LIBUCI_LDFLAGS) \
$(LIBUBUS_LDFLAGS) \
$(LIBUBOX_LDFLAGS) \
$(LIBJSONC_LDFLAGS)
icwmp_stund_LDADD = \
$(AM_LIBS) \
$(LIBUCI_LIBS) \
$(LIBUBOX_LIBS) \
$(LIBJSON_LIBS) \
$(LBLOBMSG_LIBS) \
$(LIBUBUS_LIBS) \
$(LCRYPTO_LIBS)
bin_PROGRAMS = icwmpd
icwmpd_SOURCES = \
../backupSession.c \
@ -189,18 +45,15 @@ icwmpd_LDADD = \
$(LIBUBUS_LIBS) \
$(MICROXML_LIBS) \
$(LIBCURL_LIBS) \
$(LIBTRACE_LIBS) \
$(LIBZSTREAM_LIBS) \
$(LIBPTHREAD_LIBS) \
$(LIBSTROPHE_LIBS) \
$(LCRYPTO_LIBS) \
$(LSSL_LIBS) \
$(LIBJSON_LIBS) \
$(LBLOBMSG_LIBS) \
$(LIBZ_LIBS) \
$(LIBM_LIBS) \
-ldatamodel \
-lusb-1.0
-lbbfdm
icwmpd_CFLAGS+=-DCWMP_VERSION=\"$(CWMP_VERSION)\"
icwmpd_LDFLAGS+=-DCWMP_VERSION=\"$(CWMP_VERSION)\"
@ -208,16 +61,41 @@ icwmpd_LDFLAGS+=-DCWMP_VERSION=\"$(CWMP_VERSION)\"
CWMP_BKP_FILE=/etc/icwmpd/.icwmpd_backup_session.xml
icwmpd_CFLAGS+=-DCWMP_BKP_FILE=\"$(CWMP_BKP_FILE)\"
icwmpd_CFLAGS+=-I../inc
icwmpd_CFLAGS+=-I../dm/
icwmpd_CFLAGS+=-I../dm/dmtree/
icwmpd_CFLAGS+=-I../dm/dmtree/common
icwmpd_CFLAGS+=-I../dm/dmtree/tr098
icwmpd_CFLAGS+=-I../dm/dmtree/tr181
icwmpd_CFLAGS+=-I../dm/dmtree/upnp
icwmpd_CFLAGS+=-I../stun/
icwmpd_CFLAGS+=-I../stun/src/
if XMPP_ENABLE
bin_PROGRAMS += icwmp_stund
icwmp_stund_SOURCES = \
../stun/stun.c \
../stun/stun.h \
../stun/log.c \
../stun/log.h \
../stun/ubus.c \
../stun/ubus.h \
../stun/config.c \
../stun/config.h
icwmp_stund_CFLAGS = \
$(AM_CFLAGS) \
$(LIBUCI_CFLAGS) \
$(LIBUBUS_CFLAGS) \
$(LIBUBOX_CFLAGS)
icwmp_stund_LDFLAGS = \
$(AM_LDFLAGS) \
$(LIBUCI_LDFLAGS) \
$(LIBUBUS_LDFLAGS) \
$(LIBUBOX_LDFLAGS) \
$(LIBJSONC_LDFLAGS)
icwmp_stund_LDADD = \
$(AM_LIBS) \
$(LIBUCI_LIBS) \
$(LIBUBOX_LIBS) \
$(LIBJSON_LIBS) \
$(LBLOBMSG_LIBS) \
$(LIBUBUS_LIBS) \
$(LCRYPTO_LIBS)
bin_PROGRAMS += icwmp_xmppd
icwmp_xmppd_SOURCES = \
@ -247,7 +125,6 @@ icwmp_xmppd_LDADD = \
$(LIBUCI_LIBS) \
$(LIBUBOX_LIBS) \
$(LIBSTROPHE_LIBS)
endif
bin_PROGRAMS += icwmp_udpechoserverd

View file

@ -24,8 +24,8 @@
#include "backupSession.h"
#include "xml.h"
#include "log.h"
#include "dmentry.h"
#include "deviceinfo.h"
#include <libbbfdm/dmentry.h>
#include <libbbfdm/deviceinfo.h>
#include "config.h"
pthread_mutex_t mutex_config_load = PTHREAD_MUTEX_INITIALIZER;

View file

@ -36,9 +36,6 @@ config cwmp 'cpe'
# compression possible configs: InstanceNumber, InstanceAlias
option instance_mode 'InstanceAlias'
option session_timeout '60'
# datamodel: tr098 (Default)
# datamodel possible configs: tr098, tr181
option datamodel 'tr181'
option notification '1'
#vlan_method: 1: only tagged vlantermination 2: all vlanterminations (tagged and untagged)
option vlan_method '1'

View file

View file

@ -10,12 +10,6 @@ AC_ARG_ENABLE(acs, [AS_HELP_STRING([--enable-acs],
[specify which ACS is going to be used; there are some optimizations available for HDM and Fusion ACS (default --enable-acs=multi]))],,
[AC_DEFINE(ACS_MULTI)])
AC_ARG_ENABLE(upnptr064, [AS_HELP_STRING([--enable-upnptr064], [enable tr064 upnp feature])], AC_DEFINE(UPNP_TR064),)
AM_CONDITIONAL([UPNP_TR064],[test "x$enable_upnptr064" = "xyes"])
AC_ARG_ENABLE(xmpp, [AS_HELP_STRING([--enable-xmpp], [enable xmpp feature])], AC_DEFINE(XMPP_ENABLE),)
AM_CONDITIONAL([XMPP_ENABLE],[test "x$enable_xmpp" = "xyes"])
AS_IF([test "x$enable_acs" = "xhdm"], [AC_DEFINE(ACS_HDM)])
AS_IF([test "x$enable_acs" = "xfusion"], [AC_DEFINE(ACS_FUSION)])
AS_IF([test "x$enable_acs" = "xmulti"], [AC_DEFINE(ACS_MULTI)])
@ -67,9 +61,6 @@ AC_SUBST([LIBUCI_LDFLAGS])
LIBUCI_LIBS='-luci'
AC_SUBST([LIBUCI_LIBS])
LIBTRACE_LIBS='-ltrace'
AC_SUBST([LIBTRACE_LIBS])
AC_ARG_WITH([libubox-include-path],
[AS_HELP_STRING([--with-libubox-include-path],
[location of the libubox library headers])],

5
cwmp.c
View file

@ -22,11 +22,13 @@
#include "xml.h"
#include "log.h"
#include "external.h"
#include "dmentry.h"
#include "ubus.h"
#include "diagnostic.h"
#include "config.h"
#include <unistd.h>
#include <libbbfdm/dmentry.h>
#include <libbbfdm/dmcwmp.h>
#include <libbbfdm/dmdiagnostics.h>
struct cwmp cwmp_main = {0};
@ -669,6 +671,7 @@ int main(int argc, char **argv)
pthread_t http_cr_server_thread;
struct sigaction act = {0};
bbfdatamodel_type = BBFDM_CWMP; // To show only CWMP parameters
if (error = cwmp_init(argc, argv, cwmp))
{
return error;

View file

@ -10,563 +10,23 @@
*
*/
#include <pthread.h>
#include <signal.h>
#include <sys/types.h>
#include "cwmp.h"
#include "backupSession.h"
#include "xml.h"
#include "log.h"
#include "external.h"
#include "dmentry.h"
#include "dmcommon.h"
#include "ubus.h"
#include "diagnostic.h"
#include "config.h"
#include <netinet/in.h>
#include <netinet/if_ether.h>
#include <arpa/inet.h>
#include <libtrace.h>
#include <libpacketdump.h>
#include <stdio.h>
#include <inttypes.h>
#include <assert.h>
#include <getopt.h>
#include <string.h>
#include <time.h>
int read_next;
struct download_diag download_stats = {0};
struct upload_diagnostic_stats upload_stats = {0};
static void http_upload_per_packet(libtrace_packet_t *packet);
static void libtrace_cleanup(libtrace_t *trace, libtrace_packet_t *packet);
static void set_download_stats();
static void set_upload_stats();
void init_download_stats(void)
{
memset(&download_stats, 0, sizeof(download_stats));
}
void init_upload_stats(void)
{
memset(&upload_stats, 0, sizeof(upload_stats));
}
static void ftp_download_per_packet(libtrace_packet_t *packet)
{
struct tm lt;
struct timeval ts;
libtrace_tcp_t *tcp;
char tcp_flag[16] = "";
char *nexthdr;
char s_now[default_date_size];
uint8_t proto;
uint32_t remaining;
tcp = trace_get_transport(packet, &proto, &remaining);
if (tcp == NULL)
return;
else
nexthdr = trace_get_payload_from_tcp(tcp, &remaining);
if (tcp->ecn_ns) strcat(tcp_flag, "ECN_NS ");
if (tcp->cwr) strcat(tcp_flag, "CWR ");
if (tcp->ece) strcat(tcp_flag, "ECE ");
if (tcp->fin) strcat(tcp_flag, "FIN ");
if (tcp->syn) strcat(tcp_flag, "SYN ");
if (tcp->rst) strcat(tcp_flag, "RST ");
if (tcp->psh) strcat(tcp_flag, "PSH ");
if (tcp->ack) strcat(tcp_flag, "ACK ");
if (tcp->urg) strcat(tcp_flag, "URG ");
if (strcmp(tcp_flag, "PSH ACK ") == 0 && strlen(nexthdr) > strlen(FTP_SIZE_RESPONSE) && strncmp(nexthdr, FTP_SIZE_RESPONSE, strlen(FTP_SIZE_RESPONSE)) == 0)
{
char *val = strstr(nexthdr,"213");
char *pch, *pchr;
val += strlen("213 ");
pch=strtok_r(val, " \r\n\t", &pchr);
download_stats.test_bytes_received = atoi(pch);
}
if(strcmp(tcp_flag, "PSH ACK ") == 0 && strlen(nexthdr) > strlen(FTP_PASV_RESPONSE) && strncmp(nexthdr, FTP_PASV_RESPONSE, strlen(FTP_PASV_RESPONSE)) == 0)
{
download_stats.ftp_syn = 1;
return;
}
if (download_stats.random_seq == 0 && strcmp(tcp_flag, "SYN ") == 0 && download_stats.ftp_syn == 1)
{
ts = trace_get_timeval(packet);
(void) localtime_r(&(ts.tv_sec), &lt);
strftime(s_now, sizeof s_now, "%Y-%m-%dT%H:%M:%S", &lt);
download_stats.random_seq = ntohl(tcp->seq);
sprintf((download_stats.tcpopenrequesttime),"%s.%06ld", s_now, (long) ts.tv_usec);
}
if (strcmp(tcp_flag, "SYN ACK ") == 0 && download_stats.random_seq != 0 && (ntohl(tcp->ack_seq) - 1 ) == download_stats.random_seq)
{
ts = trace_get_timeval(packet);
(void) localtime_r(&(ts.tv_sec), &lt);
strftime(s_now, sizeof s_now, "%Y-%m-%dT%H:%M:%S", &lt);
sprintf((download_stats.tcpopenresponsetime),"%s.%06ld", s_now, (long) ts.tv_usec);
download_stats.random_seq = ntohl(tcp->ack_seq);
sprintf((download_stats.tcpopenresponsetime),"%s.%06ld", s_now, (long) ts.tv_usec);
}
if (strcmp(tcp_flag, "PSH ACK ") == 0 && strlen(nexthdr) > strlen(FTP_RETR_REQUEST) && strncmp(nexthdr, FTP_RETR_REQUEST, strlen(FTP_RETR_REQUEST)) == 0)
{
ts = trace_get_timeval(packet);
(void) localtime_r(&(ts.tv_sec), &lt);
strftime(s_now, sizeof s_now, "%Y-%m-%dT%H:%M:%S", &lt);
sprintf((download_stats.romtime),"%s.%06ld", s_now, (long) ts.tv_usec);
}
if(strcmp(tcp_flag, "ACK ") == 0 && ntohl(tcp->seq) == download_stats.random_seq && download_stats.ack_seq == 0)
{
download_stats.ack_seq = ntohl(tcp->seq);
return;
}
if(strcmp(tcp_flag, "ACK ") == 0 && ntohl(tcp->ack_seq) == download_stats.ack_seq )
{
ts = trace_get_timeval(packet);
(void) localtime_r(&(ts.tv_sec), &lt);
strftime(s_now, sizeof s_now, "%Y-%m-%dT%H:%M:%S", &lt);
if (download_stats.first_data == 0)
{
sprintf((download_stats.bomtime),"%s.%06ld", s_now, (long) ts.tv_usec);
}
download_stats.first_data = 1;
}
if ( (strcmp(tcp_flag, "PSH ACK ") == 0 || strcmp(tcp_flag, "FIN PSH ACK ") == 0) && ntohl(tcp->ack_seq) == download_stats.ack_seq)
{
ts = trace_get_timeval(packet);
(void) localtime_r(&(ts.tv_sec), &lt);
strftime(s_now, sizeof s_now, "%Y-%m-%dT%H:%M:%S", &lt);
if (download_stats.first_data == 0)
{
sprintf((download_stats.bomtime),"%s.%06ld", s_now, (long) ts.tv_usec);
download_stats.first_data = 1;
}
sprintf((download_stats.eomtime),"%s.%06ld", s_now, (long) ts.tv_usec);
}
}
static void http_download_per_packet(libtrace_packet_t *packet)
{
struct tm lt;
struct timeval ts;
libtrace_tcp_t *tcp;
uint32_t seq = 0;
char tcp_flag[16] = "";
char *nexthdr;
char s_now[default_date_size];
uint8_t proto;
uint32_t remaining;
tcp = trace_get_transport(packet, &proto, &remaining);
if (tcp == NULL)
return;
else
nexthdr = trace_get_payload_from_tcp(tcp, &remaining);
if (tcp->ecn_ns) strcat(tcp_flag, "ECN_NS ");
if (tcp->cwr) strcat(tcp_flag, "CWR ");
if (tcp->ece) strcat(tcp_flag, "ECE ");
if (tcp->fin) strcat(tcp_flag, "FIN ");
if (tcp->syn) strcat(tcp_flag, "SYN ");
if (tcp->rst) strcat(tcp_flag, "RST ");
if (tcp->psh) strcat(tcp_flag, "PSH ");
if (tcp->ack) strcat(tcp_flag, "ACK ");
if (tcp->urg) strcat(tcp_flag, "URG ");
if (strcmp(tcp_flag, "SYN ") == 0 && download_stats.random_seq == 0)
{
ts = trace_get_timeval(packet);
(void) localtime_r(&(ts.tv_sec), &lt);
strftime(s_now, sizeof s_now, "%Y-%m-%dT%H:%M:%S", &lt);
sprintf((download_stats.tcpopenrequesttime),"%s.%06ld", s_now, (long) ts.tv_usec);
download_stats.random_seq = ntohl(tcp->seq);
return;
}
if (strcmp(tcp_flag, "SYN ACK ") == 0 && download_stats.random_seq != 0 && (ntohl(tcp->ack_seq) - 1 ) == download_stats.random_seq)
{
ts = trace_get_timeval(packet);
(void) localtime_r(&(ts.tv_sec), &lt);
strftime(s_now, sizeof s_now, "%Y-%m-%dT%H:%M:%S", &lt);
sprintf((download_stats.tcpopenresponsetime),"%s.%06ld", s_now, (long) ts.tv_usec);
download_stats.random_seq = ntohl(tcp->seq);
return;
}
if (strcmp(tcp_flag, "PSH ACK ") == 0 && strncmp(nexthdr, "GET", 3) == 0)
{
ts = trace_get_timeval(packet);
(void) localtime_r(&(ts.tv_sec), &lt);
strftime(s_now, sizeof s_now, "%Y-%m-%dT%H:%M:%S", &lt);
sprintf((download_stats.romtime),"%s.%06ld", s_now, (long) ts.tv_usec);
download_stats.get_ack = ntohl(tcp->ack_seq);
return;
}
if(strcmp(tcp_flag, "ACK ") == 0 && ntohl(tcp->seq) == download_stats.get_ack && download_stats.ack_seq == 0)
{
download_stats.ack_seq = ntohl(tcp->ack_seq);
return;
}
if(strcmp(tcp_flag, "ACK ") == 0 && ntohl(tcp->ack_seq) == download_stats.ack_seq )
{
ts = trace_get_timeval(packet);
(void) localtime_r(&(ts.tv_sec), &lt);
strftime(s_now, sizeof s_now, "%Y-%m-%dT%H:%M:%S", &lt);
if (download_stats.first_data == 0)
{
sprintf((download_stats.bomtime),"%s.%06ld", s_now, (long) ts.tv_usec);
char *val = strstr(nexthdr,"Content-Length");
char *pch, *pchr;
val += strlen("Content-Length: ");
pch=strtok_r(val, " \r\n\t", &pchr);
download_stats.test_bytes_received = atoi(pch);
download_stats.first_data = 1;
}
return;
}
if ( (strcmp(tcp_flag, "PSH ACK ") == 0 || strcmp(tcp_flag, "FIN PSH ACK ") == 0) && ntohl(tcp->ack_seq) == download_stats.ack_seq)
{
ts = trace_get_timeval(packet);
(void) localtime_r(&(ts.tv_sec), &lt);
strftime(s_now, sizeof s_now, "%Y-%m-%dT%H:%M:%S", &lt);
if (download_stats.first_data == 0)
{
sprintf((download_stats.bomtime),"%s.%06ld", s_now, (long) ts.tv_usec);
char *val = strstr(nexthdr,"Content-Length");
char *pch, *pchr;
val += strlen("Content-Length: ");
pch=strtok_r(val, " \r\n\t", &pchr);
download_stats.test_bytes_received = atoi(pch);
download_stats.first_data = 1;
}
sprintf((download_stats.eomtime),"%s.%06ld", s_now, (long) ts.tv_usec);
return;
}
}
static void libtrace_cleanup(libtrace_t *trace, libtrace_packet_t *packet)
{
if (trace)
trace_destroy(trace);
if (packet)
trace_destroy_packet(packet);
}
static void set_download_stats()
{
char buf[128];
sprintf(buf,"cwmp.@downloaddiagnostic[0].ROMtime=%s", download_stats.romtime);
uci_set_state_value(buf);
sprintf(buf,"cwmp.@downloaddiagnostic[0].BOMtime=%s", download_stats.bomtime);
uci_set_state_value(buf);
sprintf(buf,"cwmp.@downloaddiagnostic[0].EOMtime=%s", download_stats.eomtime);
uci_set_state_value(buf);
sprintf(buf,"cwmp.@downloaddiagnostic[0].TCPOpenRequestTime=%s", download_stats.tcpopenrequesttime);
uci_set_state_value(buf);
sprintf(buf,"cwmp.@downloaddiagnostic[0].TCPOpenResponseTime=%s", download_stats.tcpopenresponsetime);
uci_set_state_value(buf);
sprintf(buf,"cwmp.@downloaddiagnostic[0].TestBytesReceived=%d", download_stats.test_bytes_received);
uci_set_state_value(buf);
}
static void set_upload_stats()
{
char buf[128];
sprintf(buf,"cwmp.@uploaddiagnostic[0].ROMtime=%s", upload_stats.romtime);
uci_set_state_value(buf);
sprintf(buf,"cwmp.@uploaddiagnostic[0].BOMtime=%s", upload_stats.bomtime);
uci_set_state_value(buf);
sprintf(buf,"cwmp.@uploaddiagnostic[0].EOMtime=%s", upload_stats.eomtime);
uci_set_state_value(buf);
sprintf(buf,"cwmp.@uploaddiagnostic[0].TCPOpenRequestTime=%s", upload_stats.tcpopenrequesttime);
uci_set_state_value(buf);
sprintf(buf,"cwmp.@uploaddiagnostic[0].TCPOpenResponseTime=%s", upload_stats.tcpopenresponsetime);
uci_set_state_value(buf);
}
static void http_upload_per_packet(libtrace_packet_t *packet)
{
struct tm lt;
struct timeval ts;
libtrace_tcp_t *tcp;
char tcp_flag[16] = "";
char *nexthdr;
char s_now[default_date_size];
uint8_t proto;
uint32_t remaining;
tcp = trace_get_transport(packet, &proto, &remaining);
if (tcp == NULL)
return;
else
nexthdr = trace_get_payload_from_tcp(tcp, &remaining);
if (tcp->ecn_ns) strcat(tcp_flag, "ECN_NS ");
if (tcp->cwr) strcat(tcp_flag, "CWR ");
if (tcp->ece) strcat(tcp_flag, "ECE ");
if (tcp->fin) strcat(tcp_flag, "FIN ");
if (tcp->syn) strcat(tcp_flag, "SYN ");
if (tcp->rst) strcat(tcp_flag, "RST ");
if (tcp->psh) strcat(tcp_flag, "PSH ");
if (tcp->ack) strcat(tcp_flag, "ACK ");
if (tcp->urg) strcat(tcp_flag, "URG ");
if (strcmp(tcp_flag, "SYN ") == 0 && download_stats.random_seq == 0)
{
ts = trace_get_timeval(packet);
(void) localtime_r(&(ts.tv_sec), &lt);
strftime(s_now, sizeof s_now, "%Y-%m-%dT%H:%M:%S", &lt);
sprintf((upload_stats.tcpopenrequesttime),"%s.%06ld", s_now, (long) ts.tv_usec);
upload_stats.random_seq = ntohl(tcp->seq);
}
if (strcmp(tcp_flag, "SYN ACK ") == 0 && upload_stats.random_seq != 0 && (ntohl(tcp->ack_seq) - 1 ) == upload_stats.random_seq)
{
ts = trace_get_timeval(packet);
(void) localtime_r(&(ts.tv_sec), &lt);
strftime(s_now, sizeof s_now, "%Y-%m-%dT%H:%M:%S", &lt);
sprintf((upload_stats.tcpopenresponsetime),"%s.%06ld", s_now, (long) ts.tv_usec);
upload_stats.random_seq = ntohl(tcp->seq);
}
if (strcmp(tcp_flag, "PSH ACK ") == 0 && strncmp(nexthdr, "PUT", 3) == 0)
{
ts = trace_get_timeval(packet);
(void) localtime_r(&(ts.tv_sec), &lt);
strftime(s_now, sizeof s_now, "%Y-%m-%dT%H:%M:%S", &lt);
sprintf((upload_stats.romtime),"%s.%06ld", s_now, (long) ts.tv_usec);
if (strstr(nexthdr, "Expect: 100-continue"))
{
upload_stats.tmp=1;
upload_stats.ack_seq = ntohl(tcp->ack_seq);
}
else
upload_stats.ack_seq = ntohl(tcp->ack_seq);
return;
}
if (strcmp(tcp_flag, "PSH ACK ") == 0 && upload_stats.tmp == 1 && strstr(nexthdr, "100 Continue"))
{
upload_stats.tmp = 2;
upload_stats.ack_seq = ntohl(tcp->ack_seq);
return;
}
if (strcmp(tcp_flag, "ACK ") == 0 && upload_stats.tmp == 2 && ntohl(tcp->seq) == upload_stats.ack_seq)
{
upload_stats.tmp = 0;
upload_stats.ack_seq = ntohl(tcp->ack_seq);
return;
}
if(strcmp(tcp_flag, "ACK ") == 0 && ntohl(tcp->ack_seq) == upload_stats.ack_seq && upload_stats.tmp == 0)
{
ts = trace_get_timeval(packet);
(void) localtime_r(&(ts.tv_sec), &lt);
strftime(s_now, sizeof s_now, "%Y-%m-%dT%H:%M:%S", &lt);
if (upload_stats.first_data == 0)
{
sprintf((upload_stats.bomtime),"%s.%06ld", s_now, (long) ts.tv_usec);
upload_stats.first_data = 1;
}
}
if ( (strcmp(tcp_flag, "PSH ACK ") == 0 || strcmp(tcp_flag, "FIN PSH ACK ") == 0) && ntohl(tcp->ack_seq) == upload_stats.ack_seq && upload_stats.tmp == 0)
{
ts = trace_get_timeval(packet);
(void) localtime_r(&(ts.tv_sec), &lt);
strftime(s_now, sizeof s_now, "%Y-%m-%dT%H:%M:%S", &lt);
if (upload_stats.first_data == 0)
{
sprintf((upload_stats.bomtime),"%s.%06ld", s_now, (long) ts.tv_usec);
upload_stats.first_data = 1;
}
}
if ( (strcmp(tcp_flag, "PSH ACK ") == 0 || strcmp(tcp_flag, "FIN PSH ACK ") == 0) && ntohl(tcp->seq) == upload_stats.ack_seq && upload_stats.tmp == 0)
{
ts = trace_get_timeval(packet);
(void) localtime_r(&(ts.tv_sec), &lt);
strftime(s_now, sizeof s_now, "%Y-%m-%dT%H:%M:%S", &lt);
sprintf((upload_stats.eomtime),"%s.%06ld", s_now, (long) ts.tv_usec);
}
}
static void ftp_upload_per_packet(libtrace_packet_t *packet)
{
struct tm lt;
struct timeval ts;
libtrace_tcp_t *tcp;
uint8_t proto;
uint32_t remaining;
char tcp_flag[16] = "";
char *nexthdr;
char s_now[default_date_size];
tcp = trace_get_transport(packet, &proto, &remaining);
if (tcp == NULL)
return;
else
nexthdr = trace_get_payload_from_tcp(tcp, &remaining);
if (tcp->ecn_ns) strcat(tcp_flag, "ECN_NS ");
if (tcp->cwr) strcat(tcp_flag, "CWR ");
if (tcp->ece) strcat(tcp_flag, "ECE ");
if (tcp->fin) strcat(tcp_flag, "FIN ");
if (tcp->syn) strcat(tcp_flag, "SYN ");
if (tcp->rst) strcat(tcp_flag, "RST ");
if (tcp->psh) strcat(tcp_flag, "PSH ");
if (tcp->ack) strcat(tcp_flag, "ACK ");
if (tcp->urg) strcat(tcp_flag, "URG ");
if(strcmp(tcp_flag, "PSH ACK ") == 0 && strlen(nexthdr) > strlen(FTP_PASV_RESPONSE) && strncmp(nexthdr, FTP_PASV_RESPONSE, strlen(FTP_PASV_RESPONSE)) == 0)
{
upload_stats.ftp_syn = 1;
return;
}
if (strcmp(tcp_flag, "SYN ") == 0 && upload_stats.ftp_syn == 1)
{
ts = trace_get_timeval(packet);
(void) localtime_r(&(ts.tv_sec), &lt);
strftime(s_now, sizeof s_now, "%Y-%m-%dT%H:%M:%S", &lt);
upload_stats.random_seq = ntohl(tcp->seq);
sprintf((upload_stats.tcpopenrequesttime),"%s.%06ld", s_now, (long) ts.tv_usec);
}
if (strcmp(tcp_flag, "SYN ACK ") == 0 && upload_stats.random_seq != 0 && (ntohl(tcp->ack_seq) - 1 ) == upload_stats.random_seq)
{
ts = trace_get_timeval(packet);
(void) localtime_r(&(ts.tv_sec), &lt);
strftime(s_now, sizeof s_now, "%Y-%m-%dT%H:%M:%S", &lt);
sprintf((upload_stats.tcpopenresponsetime),"%s.%06ld", s_now, (long) ts.tv_usec);
upload_stats.random_seq = ntohl(tcp->ack_seq);
}
if (strcmp(tcp_flag, "PSH ACK ") == 0 && strlen(nexthdr) > strlen(FTP_STOR_REQUEST) && strncmp(nexthdr, FTP_STOR_REQUEST, strlen(FTP_STOR_REQUEST)) == 0)
{
ts = trace_get_timeval(packet);
(void) localtime_r(&(ts.tv_sec), &lt);
strftime(s_now, sizeof s_now, "%Y-%m-%dT%H:%M:%S", &lt);
sprintf((upload_stats.romtime),"%s.%06ld", s_now, (long) ts.tv_usec);
}
if(strcmp(tcp_flag, "ACK ") == 0 && ntohl(tcp->seq) == upload_stats.random_seq && upload_stats.ack_seq == 0)
{
upload_stats.ack_seq = ntohl(tcp->ack_seq);
return;
}
if(strcmp(tcp_flag, "ACK ") == 0 && ntohl(tcp->ack_seq) == upload_stats.ack_seq )
{
ts = trace_get_timeval(packet);
(void) localtime_r(&(ts.tv_sec), &lt);
strftime(s_now, sizeof s_now, "%Y-%m-%dT%H:%M:%S", &lt);
if (upload_stats.first_data == 0)
{
sprintf((upload_stats.bomtime),"%s.%06ld", s_now, (long) ts.tv_usec);
upload_stats.first_data = 1;
}
}
if ( (strcmp(tcp_flag, "PSH ACK ") == 0 || strcmp(tcp_flag, "FIN PSH ACK ") == 0) && ntohl(tcp->ack_seq) == upload_stats.ack_seq) //&& strlen(nexthdr) > 16 && strncmp(nexthdr, "HTTP/1.1 200 OK", 16) == 0
{
ts = trace_get_timeval(packet);
(void) localtime_r(&(ts.tv_sec), &lt);
strftime(s_now, sizeof s_now, "%Y-%m-%dT%H:%M:%S", &lt);
if (upload_stats.first_data == 0)
{
sprintf((upload_stats.bomtime),"%s.%06ld", s_now, (long) ts.tv_usec);
upload_stats.first_data = 1;
}
}
if ( (strcmp(tcp_flag, "PSH ACK ") == 0 || strcmp(tcp_flag, "FIN PSH ACK ") == 0) && strlen(nexthdr) > strlen(FTP_TRANSFERT_COMPLETE) && strncmp(nexthdr, FTP_TRANSFERT_COMPLETE, strlen(FTP_TRANSFERT_COMPLETE)) == 0) //&& strlen(nexthdr) > 16 && strncmp(nexthdr, "HTTP/1.1 200 OK", 16) == 0
{
ts = trace_get_timeval(packet);
(void) localtime_r(&(ts.tv_sec), &lt);
strftime(s_now, sizeof s_now, "%Y-%m-%dT%H:%M:%S", &lt);
sprintf((upload_stats.eomtime),"%s.%06ld", s_now, (long) ts.tv_usec);
read_next = 0;
}
}
int extract_stats(char *dump_file, int proto, int diagnostic_type)
{
libtrace_t *trace = NULL;
libtrace_packet_t *packet = NULL;
read_next = 1;
packet = trace_create_packet();
if (packet == NULL) {
perror("Creating libtrace packet");
libtrace_cleanup(trace, packet);
return 1;
}
trace = trace_create(dump_file);
if (!trace) {
return -1;
}
if (trace_is_err(trace)) {
trace_perror(trace,"Opening trace file");
libtrace_cleanup(trace, packet);
return 1;
}
if (trace_start(trace) == -1) {
trace_perror(trace,"Starting trace");
libtrace_cleanup(trace, packet);
return 1;
}
if (proto == DOWNLOAD_DIAGNOSTIC_HTTP && diagnostic_type == DOWNLOAD_DIAGNOSTIC)
{
while (trace_read_packet(trace,packet)>0 && read_next == 1) {
http_download_per_packet(packet);
continue;
}
set_download_stats();
}
else if (proto == DOWNLOAD_DIAGNOSTIC_FTP && diagnostic_type == DOWNLOAD_DIAGNOSTIC)
{
while (trace_read_packet(trace,packet)>0 && read_next == 1) {
ftp_download_per_packet(packet);
continue;
}
set_download_stats();
}
else if (proto == DOWNLOAD_DIAGNOSTIC_HTTP && diagnostic_type == UPLOAD_DIAGNOSTIC)
{
while (trace_read_packet(trace,packet)>0 && read_next == 1) {
http_upload_per_packet(packet);
continue;
}
set_upload_stats();
}
else
{
while (trace_read_packet(trace,packet)>0 && read_next == 1) {
ftp_upload_per_packet(packet);
continue;
}
set_upload_stats();
}
libtrace_cleanup(trace, packet);
return 0;
}
int get_default_gateway_device( char **gw )
{
FILE *f;
char line[100], *p, *c, *saveptr;
f = fopen("/proc/net/route" , "r");
if (f != NULL)
{
while(fgets(line , 100 , f))
{
p = strtok_r(line, " \t", &saveptr);
c = strtok_r(NULL, " \t", &saveptr);
if(p!=NULL && c!=NULL)
{
if(strcmp(c, "00000000") == 0)
{
asprintf(gw, "%s", p);
fclose(f);
return 0;
}
}
}
fclose(f);
}
return -1;
}
#include "cwmp.h"
#include "backupSession.h"
#include "xml.h"
#include "log.h"
#include "external.h"
#include "ubus.h"
#include "diagnostic.h"
#include "config.h"
#include <libbbfdm/dmentry.h>
#include <libbbfdm/dmcommon.h>
#include <libbbfdm/dmdiagnostics.h>
int cwmp_start_diagnostic(int diagnostic_type)
{
@ -576,12 +36,15 @@ int cwmp_start_diagnostic(int diagnostic_type)
int error;
char *status;
if (diagnostic_type == DOWNLOAD_DIAGNOSTIC)
if (diagnostic_type == DOWNLOAD_DIAGNOSTIC) {
uci_get_state_value("cwmp.@downloaddiagnostic[0].url", &url);
uci_get_state_value("cwmp.@downloaddiagnostic[0].device", &interface);
}
else
{
uci_get_state_value("cwmp.@uploaddiagnostic[0].url", &url);
uci_get_state_value("cwmp.@uploaddiagnostic[0].TestFileLength", &size);
uci_get_state_value("cwmp.@uploaddiagnostic[0].device", &interface);
}
if( url == NULL || ((url != NULL) && (strcmp(url,"")==0))
|| ((strncmp(url,DOWNLOAD_PROTOCOL_FTP,strlen(DOWNLOAD_PROTOCOL_FTP))!=0) &&
@ -592,7 +55,7 @@ int cwmp_start_diagnostic(int diagnostic_type)
free(url);
return -1;
}
uci_get_state_value("cwmp.@downloaddiagnostic[0].device", &interface);
if ( interface == NULL || interface[0] == '\0' )
{
error = get_default_gateway_device(&interface);
@ -606,16 +69,16 @@ int cwmp_start_diagnostic(int diagnostic_type)
if (diagnostic_type == DOWNLOAD_DIAGNOSTIC)
{
CWMP_LOG(INFO,"Launch Download diagnostic with url %s", url);
dmcmd("/bin/sh", 4, DOWNLOAD_DIAGNOSTIC_PATH, "run", url, interface);
dmcmd("/bin/sh", 5, DOWNLOAD_DIAGNOSTIC_PATH, "run", "cwmp", url, interface);
uci_get_state_value("cwmp.@downloaddiagnostic[0].DiagnosticState", &status);
if (status && strcmp(status, "Completed") == 0)
{
init_download_stats();
CWMP_LOG(INFO,"Extract Download stats");
if(strncmp(url,DOWNLOAD_PROTOCOL_HTTP,strlen(DOWNLOAD_PROTOCOL_HTTP)) == 0)
extract_stats(DOWNLOAD_DUMP_FILE, DOWNLOAD_DIAGNOSTIC_HTTP, DOWNLOAD_DIAGNOSTIC);
extract_stats(DOWNLOAD_DUMP_FILE, DOWNLOAD_DIAGNOSTIC_HTTP, DOWNLOAD_DIAGNOSTIC, "cwmp");
if(strncmp(url,DOWNLOAD_PROTOCOL_FTP,strlen(DOWNLOAD_PROTOCOL_FTP)) == 0)
extract_stats(DOWNLOAD_DUMP_FILE, DOWNLOAD_DIAGNOSTIC_FTP, DOWNLOAD_DIAGNOSTIC);
extract_stats(DOWNLOAD_DUMP_FILE, DOWNLOAD_DIAGNOSTIC_FTP, DOWNLOAD_DIAGNOSTIC, "cwmp");
cwmp_root_cause_event_ipdiagnostic();
}
else if (status && strncmp(status, "Error_", strlen("Error_")) == 0)
@ -625,16 +88,16 @@ int cwmp_start_diagnostic(int diagnostic_type)
else
{
CWMP_LOG(INFO,"Launch Upload diagnostic with url %s", url);
dmcmd("/bin/sh", 5, UPLOAD_DIAGNOSTIC_PATH, "run", url, interface, size);
dmcmd("/bin/sh", 6, UPLOAD_DIAGNOSTIC_PATH, "run", "cwmp", url, interface, size);
uci_get_state_value("cwmp.@uploaddiagnostic[0].DiagnosticState", &status);
if (status && strcmp(status, "Completed") == 0)
{
init_upload_stats();
CWMP_LOG(INFO,"Extract Upload stats");
if(strncmp(url,DOWNLOAD_PROTOCOL_HTTP,strlen(DOWNLOAD_PROTOCOL_HTTP)) == 0)
extract_stats(UPLOAD_DUMP_FILE, DOWNLOAD_DIAGNOSTIC_HTTP, UPLOAD_DIAGNOSTIC);
extract_stats(UPLOAD_DUMP_FILE, DOWNLOAD_DIAGNOSTIC_HTTP, UPLOAD_DIAGNOSTIC, "cwmp");
if(strncmp(url,DOWNLOAD_PROTOCOL_FTP,strlen(DOWNLOAD_PROTOCOL_FTP)) == 0)
extract_stats(UPLOAD_DUMP_FILE, DOWNLOAD_DIAGNOSTIC_FTP, UPLOAD_DIAGNOSTIC);
extract_stats(UPLOAD_DUMP_FILE, DOWNLOAD_DIAGNOSTIC_FTP, UPLOAD_DIAGNOSTIC, "cwmp");
cwmp_root_cause_event_ipdiagnostic();
}
else if (status && strncmp(status, "Error_", strlen("Error_")) == 0)
@ -649,30 +112,30 @@ int cwmp_start_diagnostic(int diagnostic_type)
int cwmp_ip_ping_diagnostic()
{
dmcmd_no_wait("/bin/sh", 2, IPPING_PATH, "run");
dmcmd_no_wait("/bin/sh", 3, IPPING_PATH, "run", "cwmp");
return 0;
}
int cwmp_nslookup_diagnostic()
{
dmcmd_no_wait("/bin/sh", 2, NSLOOKUP_PATH, "run");
dmcmd_no_wait("/bin/sh", 3, NSLOOKUP_PATH, "run", "cwmp");
return 0;
}
int cwmp_traceroute_diagnostic()
{
dmcmd_no_wait("/bin/sh", 2, TRACEROUTE_PATH, "run");
dmcmd_no_wait("/bin/sh", 3, TRACEROUTE_PATH, "run", "cwmp");
return 0;
}
int cwmp_udp_echo_diagnostic()
{
dmcmd_no_wait("/bin/sh", 2, UDPECHO_PATH, "run");
dmcmd_no_wait("/bin/sh", 3, UDPECHO_PATH, "run", "cwmp");
return 0;
}
int cwmp_serverselection_diagnostic()
{
dmcmd_no_wait("/bin/sh", 2, SERVERSELECTION_PATH, "run");
dmcmd_no_wait("/bin/sh", 3, SERVERSELECTION_PATH, "run", "cwmp");
return 0;
}

File diff suppressed because it is too large Load diff

View file

@ -1,226 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2015 PIVA SOFTWARE (www.pivasoftware.com)
* Author: Imen Bhiri <imen.bhiri@pivasoftware.com>
* Author: Feten Besbes <feten.besbes@pivasoftware.com>
*/
#ifndef __DM_COMMON_H
#define __DM_COMMON_H
#include <sys/types.h>
#include <libubox/blobmsg_json.h>
#include <json-c/json.h>
#include <unistd.h>
#include "dmcwmp.h"
#define NVRAM_FILE "/proc/nvram/WpaKey"
#define MAX_DHCP_LEASES 256
#define MAX_PROC_ROUTING 256
#define ROUTING_FILE "/proc/net/route"
#define ARP_FILE "/proc/net/arp"
#define DHCP_LEASES_FILE "/tmp/dhcp.leases"
#define DMMAP "dmmap"
#define DHCPSTATICADDRESS_DISABLED_CHADDR "00:00:00:00:00:01"
#define DM_ASSERT(X, Y) \
do { \
if(!(X)) { \
Y; \
return -1; \
} \
} while(0)
#define dmstrappendstr(dest, src) \
do { \
int len = strlen(src); \
memcpy(dest, src, len); \
dest += len; \
} while(0)
#define dmstrappendchr(dest, c) \
do { \
*dest = c; \
dest += 1; \
} while(0)
#define dmstrappendend(dest) \
do { \
*dest = '\0'; \
} while(0)
#define DMCMD(CMD, N, ...) \
do { \
int mpp = dmcmd(CMD, N, ## __VA_ARGS__); \
if (mpp) close (mpp); \
} while (0)
#define IPPING_PATH "/usr/share/icwmp/functions/ipping_launch"
#define IPPING_STOP DMCMD("/bin/sh", 2, IPPING_PATH, "stop");
#define DOWNLOAD_DIAGNOSTIC_PATH "/usr/share/icwmp/functions/download_launch"
#define DOWNLOAD_DUMP_FILE "/tmp/download_dump"
#define DOWNLOAD_DIAGNOSTIC_STOP DMCMD("/bin/sh", 2, DOWNLOAD_DIAGNOSTIC_PATH, "stop");
#define UPLOAD_DIAGNOSTIC_PATH "/usr/share/icwmp/functions/upload_launch"
#define UPLOAD_DUMP_FILE "/tmp/upload_dump"
#define UPLOAD_DIAGNOSTIC_STOP DMCMD("/bin/sh", 2, UPLOAD_DIAGNOSTIC_PATH, "stop");
#define NSLOOKUP_PATH "/usr/share/icwmp/functions/nslookup_launch"
#define NSLOOKUP_LOG_FILE "/tmp/nslookup.log"
#define NSLOOKUP_STOP DMCMD("/bin/sh", 2, NSLOOKUP_PATH, "stop");
#define TRACEROUTE_PATH "/usr/share/icwmp/functions/traceroute_launch"
#define TRACEROUTE_STOP DMCMD("/bin/sh", 2, TRACEROUTE_PATH, "stop");
#define UDPECHO_PATH "/usr/share/icwmp/functions/udpecho_launch"
#define UDPECHO_STOP DMCMD("/bin/sh", 2, UDPECHO_PATH, "stop");
#define SERVERSELECTION_PATH "/usr/share/icwmp/functions/serverselection_launch"
#define SERVERSELECTION_STOP DMCMD("/bin/sh", 2, SERVERSELECTION_PATH, "stop");
#define sysfs_foreach_file(path,dir,ent) \
if ((dir = opendir(path)) == NULL) return 0; \
while ((ent = readdir (dir)) != NULL) \
enum notification_enum {
notification_none,
notification_passive,
notification_active,
notification_passive_lw,
notification_ppassive_passive_lw,
notification_aactive_lw,
notification_passive_active_lw,
__MAX_notification
};
enum strstructered_enum {
STRUCTERED_SAME,
STRUCTERED_PART,
STRUCTERED_NULL
};
struct proc_routing {
char *iface;
char *flags;
char *refcnt;
char *use;
char *metric;
char *mtu;
char *window;
char *irtt;
char destination[16];
char gateway[16];
char mask[16];
};
struct routingfwdargs
{
char *permission;
struct uci_section *routefwdsection;
struct proc_routing *proute;
int type;
};
struct dmmap_dup
{
struct list_head list;
struct uci_section *config_section;
struct uci_section *dmmap_section;
void* additional_attribute;
};
struct dmmap_sect {
struct list_head list;
char *section_name;
char *instance;
};
struct dm_args
{
struct uci_section *section;
struct uci_section *dmmap_section;
char *name;
};
struct sysfs_dmsection {
struct list_head list;
char *sysfs_folder_path;
char *sysfs_folder_name;
struct uci_section *dm;
};
void compress_spaces(char *str);
char *cut_fx(char *str, char *delimiter, int occurence);
pid_t get_pid(char *pname);
int check_file(char *path);
char *cidr2netmask(int bits);
void remove_substring(char *s, const char *str_remove);
bool is_strword_in_optionvalue(char *optionvalue, char *str);
int get_interface_enable_ubus(char *iface, char *refparam, struct dmctx *ctx, char **value);
int set_interface_enable_ubus(char *iface, char *refparam, struct dmctx *ctx, int action, char *value);
int get_interface_firewall_enabled(char *iface, char *refparam, struct dmctx *ctx, char **value);
struct uci_section *create_firewall_zone_config(char *fwl, char *iface, char *input, char *forward, char *output);
int set_interface_firewall_enabled(char *iface, char *refparam, struct dmctx *ctx, int action, char *value);
int dmcmd(char *cmd, int n, ...);
int dmcmd_read(int pipe, char *buffer, int size);
void dmcmd_read_alloc(int pipe, char **value);
int dmcmd_no_wait(char *cmd, int n, ...);
int ipcalc(char *ip_str, char *mask_str, char *start_str, char *end_str, char *ipstart_str, char *ipend_str);
int ipcalc_rev_start(char *ip_str, char *mask_str, char *ipstart_str, char *start_str);
int ipcalc_rev_end(char *ip_str, char *mask_str, char *start_str, char *ipend_str, char *end_str);
int network_get_ipaddr(char **value, char *iface);
void remove_vid_interfaces_from_ifname(char *vid, char *ifname, char *new_ifname);
void update_section_option_list(char *config, char *section, char *option, char *option_2,char *val, char *val_2, char *name);
void update_section_list_icwmpd(char *config, char *section, char *option, int number, char *filter, char *option1, char *val1, char *option2, char *val2);
void update_section_list(char *config, char *section, char *option, int number, char *filter, char *option1, char *val1, char *option2, char *val2);
char *get_nvram_wpakey();
int reset_wlan(struct uci_section *s);
int get_cfg_layer2idx(char *pack, char *section_type, char *option, int shift);
int wan_remove_dev_interface(struct uci_section *interface_setion, char *dev);
int filter_lan_device_interface(struct uci_section *s);
void remove_vlan_from_bridge_interface(char *bridge_key, struct uci_section *vb);
void update_remove_vlan_from_bridge_interface(char *bridge_key, struct uci_section *vb);
int filter_lan_ip_interface(struct uci_section *ss, void *v);
void remove_interface_from_ifname(char *iface, char *ifname, char *new_ifname);
int max_array(int a[], int size);
int check_ifname_is_vlan(char *ifname);
int set_uci_dhcpserver_option(struct dmctx *ctx, struct uci_section *s, char *option, char *value);
int update_uci_dhcpserver_option(struct dmctx *ctx, struct uci_section *s, char *option, char * new_option, char *value);
void parse_proc_route_line(char *line, struct proc_routing *proute);
int strstructered(char *str1, char *str2);
int dmcommon_check_notification_value(char *value);
void hex_to_ip(char *address, char *ret);
void ip_to_hex(char *address, char *ret);
void free_dmmap_config_dup_list(struct list_head *dup_list);
void synchronize_specific_config_sections_with_dmmap(char *package, char *section_type, char *dmmap_package, struct list_head *dup_list);
void synchronize_specific_config_sections_with_dmmap_eq(char *package, char *section_type, char *dmmap_package,char* option_name, char* option_value, struct list_head *dup_list);
void synchronize_specific_config_sections_with_dmmap_eq_no_delete(char *package, char *section_type, char *dmmap_package,char* option_name, char* option_value, struct list_head *dup_list);
void synchronize_specific_config_sections_with_dmmap_cont(char *package, char *section_type, char *dmmap_package,char* option_name, char* option_value, struct list_head *dup_list);
bool synchronize_multi_config_sections_with_dmmap_eq(char *package, char *section_type, char *dmmap_package, char* dmmap_section, char* option_name, char* option_value, void* additional_attribute, struct list_head *dup_list);
bool synchronize_multi_config_sections_with_dmmap_eq_diff(char *package, char *section_type, char *dmmap_package, char* dmmap_section, char* option_name, char* option_value, char* opt_diff_name, char* opt_diff_value, void* additional_attribute, struct list_head *dup_list);
void synchronize_system_folders_with_dmmap_opt(char *sysfsrep, char *dmmap_package, char *dmmap_section, char *opt_name, char* inst_opt, struct list_head *dup_list);
void get_dmmap_section_of_config_section(char* dmmap_package, char* section_type, char *section_name, struct uci_section **dmmap_section);
void get_dmmap_section_of_config_section_eq(char* dmmap_package, char* section_type, char *opt, char* value, struct uci_section **dmmap_section);
void get_config_section_of_dmmap_section(char* package, char* section_type, char *section_name, struct uci_section **config_section);
void check_create_dmmap_package(char *dmmap_package);
int is_section_unnamed(char *section_name);
void delete_sections_save_next_sections(char* dmmap_package, char *section_type, char *instancename, char *section_name, int instance, struct list_head *dup_list);
void update_dmmap_sections(struct list_head *dup_list, char *instancename, char* dmmap_package, char *section_type);
unsigned char isdigit_str(char *str);
char *dm_strword(char *src, char *str);
char **strsplit(const char* str, const char* delim, size_t* numtokens);
char *get_macaddr(char *ifname);
char *get_device(char *ifname);
int is_elt_exit_in_str_list(char *str_list, char *elt);
void add_elt_to_str_list(char **str_list, char *elt);
void remove_elt_from_str_list(char **iface_list, char *ifname);
struct uci_section *get_dup_section_in_dmmap_eq(char *dmmap_package, char* section_type, char*sect_name, char *opt_name, char* opt_value);
int is_array_elt_exist(char **str_array, char *str, int length);
int get_shift_time_time(int shift_time, char *local_time, int size);
int get_shift_time_shift(char *local_time, char *shift);
int get_stats_from_ifconfig_command(char *device, char *direction, char *option);
int command_exec_output_to_array(char *cmd, char **output, int *length);
char* int_period_to_date_time_format(int time);
struct uci_section *is_dmmap_section_exist(char* package, char* section);
struct uci_section *is_dmmap_section_exist_eq(char* package, char* section, char* opt, char* value);
int isfileexist(char *filepath);
char* readFileContent(char *filepath);
#endif

File diff suppressed because it is too large Load diff

View file

@ -1,581 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2015 Inteno Broadband Technology AB
* Author MOHAMED Kallel <mohamed.kallel@pivasoftware.com>
* Author Imen Bhiri <imen.bhiri@pivasoftware.com>
* Author Feten Besbes <feten.besbes@pivasoftware.com>
*
*/
#ifndef __DMCWMP_H__
#define __DMCWMP_H__
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdlib.h>
#include <libubox/list.h>
#include "dmuci.h"
#include "dmmem.h"
#ifdef UPNP_TR064
#define DMROOT_UPNP ""
#define DMDELIM_UPNP '/'
#endif
#define DMDELIM_CWMP '.'
#define DM_PROMPT "icwmp>"
#define DM_ENABLED_NOTIFY "/etc/icwmpd/.dm_enabled_notify"
#define DM_ENABLED_NOTIFY_TEMPORARY "/tmp/.dm_enabled_notify_temporary"
#ifdef UPNP_TR064
#define UPNP_CFG "tr064"
#endif
#ifdef UNDEF
#undef UNDEF
#endif
#define UNDEF -1
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
#endif
#ifndef FREE
#define FREE(x) do { free(x); x = NULL; } while (0)
#endif
extern struct dm_permession_s DMREAD;
extern struct dm_permession_s DMWRITE;
extern struct dm_forced_inform_s DMFINFRM;
extern struct dm_notif_s DMNONE;
extern struct dm_notif_s DMACTIVE;
extern struct dm_notif_s DMPASSIVE;
#define DMPARAM_ARGS \
struct dmctx *dmctx, \
struct dmnode *node, \
char *lastname, \
struct dm_permession_s *permission, \
int type, \
int (*get_cmd)(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value), \
int (*set_cmd)(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action), \
struct dm_forced_inform_s *forced_inform, \
struct dm_notif_s *notification, \
void *data, \
char *instance
#define DMOBJECT_ARGS \
struct dmctx *dmctx, \
struct dmnode *node, \
struct dm_permession_s *permission, \
int (*addobj)(char *refparam, struct dmctx *ctx, void *data, char **instance), \
int (*delobj)(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action), \
struct dm_forced_inform_s *forced_inform, \
struct dm_notif_s *notification, \
int (*get_linker)(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker), \
void *data, \
char *instance
#define TAILLE_MAX 1024
struct dm_forced_inform_s;
struct dm_permession_s;
struct dm_parameter;
struct dm_leaf_s;
struct dm_obj_s;
struct dmnode;
struct dmctx;
struct dm_notif_s;
struct dm_permession_s {
char *val;
char *(*get_permission)(char *refparam, struct dmctx *dmctx, void *data, char *instance);
};
struct dm_forced_inform_s {
unsigned char val;
unsigned char (*get_forced_inform)(char *refparam, struct dmctx *dmctx, void *data, char *instance);
};
struct dm_notif_s {
char *val;
char *(*get_notif)(char *refparam, struct dmctx *dmctx, void *data, char *instance);
};
typedef struct dm_leaf_s {
/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification(7)*/
char *parameter;
struct dm_permession_s *permission;
int type;
int (*getvalue)(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int (*setvalue)(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
struct dm_forced_inform_s *forced_inform;
struct dm_notif_s *notification;
} DMLEAF;
typedef struct dm_obj_s {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextobj, leaf, linker(11)*/
char *obj;
struct dm_permession_s *permission;
int (*addobj)(char *refparam, struct dmctx *ctx, void *data, char **instance);
int (*delobj)(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
bool (*checkobj)(struct dmctx *dmctx, void *data);
int (*browseinstobj)(struct dmctx *dmctx, struct dmnode *node, void *data, char *instance);
struct dm_forced_inform_s *forced_inform;
struct dm_notif_s *notification;
struct dm_obj_s *nextobj;
struct dm_leaf_s *leaf;
int (*get_linker)(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker);
} DMOBJ;
#ifdef UPNP_TR064
typedef struct dm_upnp_supported_dm_s {
char *location;
char *uri;
char *url;
char *description;
char *source_location;
} UPNP_SUPPORTED_DM;
#endif
struct set_tmp {
struct list_head list;
char *name;
char *value;
unsigned int flags;
};
struct param_fault {
struct list_head list;
char *name;
int fault;
};
struct dm_enabled_notify {
struct list_head list;
char *name;
char *notification;
char *value;
};
#ifdef UPNP_TR064
struct dm_upnp_enabled_track {
struct list_head list;
char *name;
char *key;
char *value;
unsigned int isobj;
};
#endif
struct dm_parameter {
struct list_head list;
char *name;
char *data;
char *type;
char *version;
unsigned int flags;
};
struct dmctx
{
bool stop;
bool match;
int (*method_param)(DMPARAM_ARGS);
int (*method_obj)(DMOBJECT_ARGS);
int (*checkobj)(DMOBJECT_ARGS);
int (*checkleaf)(DMOBJECT_ARGS);
struct list_head list_parameter;
struct list_head set_list_tmp;
struct list_head list_fault_param;
DMOBJ *dm_entryobj;
bool nextlevel;
int depth;
int faultcode;
int setaction;
char *in_param;
char *in_notification;
bool notification_change;
char *in_value;
char *addobj_instance;
char *linker;
char *linker_param;
unsigned int dmparam_flags;
unsigned int alias_register;
unsigned int nbrof_instance;
unsigned int amd_version;
unsigned int instance_mode;
unsigned int dm_type;
unsigned int user_mask;
unsigned char inparam_isparam;
unsigned char findparam;
char all_instances[512];
char *inst_buf[16];
char *instance_wildchar;
};
typedef struct dmnode {
DMOBJ *obj;
struct dmnode *parent;
char *current_object;
unsigned char instance_level;
unsigned char matched;
unsigned char is_instanceobj;
} DMNODE;
struct prefix_method {
const char *prefix_name;
bool enable;
bool (*set_enable)(void);
bool forced_inform;
int (*method)(struct dmctx *ctx);
};
struct notification {
char *value;
char *type;
};
struct dm_acl {
unsigned int flag;
char *user_access;
};
typedef struct execute_end_session {
struct list_head list;
int action;
unsigned int dm_type;
unsigned int amd_version;
unsigned int instance_mode;
void *data;
void (*function)(struct execute_end_session *);
} execute_end_session;
enum set_value_action {
VALUECHECK,
VALUESET
};
enum del_action_enum {
DEL_INST,
DEL_ALL
};
enum {
CMD_GET_VALUE,
CMD_GET_NAME,
CMD_GET_NOTIFICATION,
CMD_SET_VALUE,
CMD_SET_NOTIFICATION,
CMD_ADD_OBJECT,
CMD_DEL_OBJECT,
CMD_INFORM,
#ifdef UPNP_TR064
CMD_UPNP_GET_SUPPORTED_PARAMETERS,
CMD_UPNP_GET_INSTANCES,
CMD_UPNP_GET_SELECTED_VALUES,
CMD_UPNP_GET_VALUES,
CMD_UPNP_SET_VALUES,
CMD_UPNP_GET_ATTRIBUTES,
CMD_UPNP_SET_ATTRIBUTES,
CMD_UPNP_DEL_INSTANCE,
CMD_UPNP_ADD_INSTANCE,
CMD_UPNP_GET_ACLDATA,
CMD_UPNP_INIT_STATE_VARIABLES,
CMD_UPNP_LOAD_ENABLED_PARAMETRS_TRACK,
CMD_UPNP_GET_CONFIGURATION_UPDATE,
CMD_UPNP_GET_CURRENT_CONFIGURATION_VERSION,
CMD_UPNP_GET_SUPPORTED_DATA_MODEL_UPDATE,
CMD_UPNP_GET_SUPPORTED_PARAMETERS_UPDATE,
CMD_UPNP_GET_ATTRIBUTE_VALUES_UPDATE,
CMD_UPNP_GET_ENABLED_PARAMETRS_ALARM,
CMD_UPNP_GET_ENABLED_PARAMETRS_EVENT,
CMD_UPNP_GET_ENABLED_PARAMETRS_VERSION,
CMD_UPNP_CHECK_CHANGED_PARAMETRS_ALARM,
CMD_UPNP_CHECK_CHANGED_PARAMETRS_EVENT,
CMD_UPNP_CHECK_CHANGED_PARAMETRS_VERSION,
#endif
CMD_EXTERNAL_COMMAND
};
enum fault_code_enum {
FAULT_9000 = 9000,// Method not supported
FAULT_9001,// Request denied
FAULT_9002,// Internal error
FAULT_9003,// Invalid arguments
FAULT_9004,// Resources exceeded
FAULT_9005,// Invalid parameter name
FAULT_9006,// Invalid parameter type
FAULT_9007,// Invalid parameter value
FAULT_9008,// Attempt to set a non-writable parameter
FAULT_9009,// Notification request rejected
FAULT_9010,// Download failure
FAULT_9011,// Upload failure
FAULT_9012,// File transfer server authentication failure
FAULT_9013,// Unsupported protocol for file transfer
FAULT_9014,// Download failure: unable to join multicast group
FAULT_9015,// Download failure: unable to contact file server
FAULT_9016,// Download failure: unable to access file
FAULT_9017,// Download failure: unable to complete download
FAULT_9018,// Download failure: file corrupted
FAULT_9019,// Download failure: file authentication failure
FAULT_9020,// Download failure: unable to complete download
FAULT_9021,// Cancelation of file transfer not permitted
FAULT_9022,// Invalid UUID format
FAULT_9023,// Unknown Execution Environment
FAULT_9024,// Disabled Execution Environment
FAULT_9025,// Diployment Unit to Execution environment mismatch
FAULT_9026,// Duplicate Deployment Unit
FAULT_9027,// System Ressources Exceeded
FAULT_9028,// Unknown Deployment Unit
FAULT_9029,// Invalid Deployment Unit State
FAULT_9030,// Invalid Deployment Unit Update: Downgrade not permitted
FAULT_9031,// Invalid Deployment Unit Update: Version not specified
FAULT_9032,// Invalid Deployment Unit Update: Version already exist
__FAULT_MAX
};
#ifdef UPNP_TR064
enum upnp_fault_code_enum {
FAULT_UPNP_606 = 606,// Action not authorized
FAULT_UPNP_701 = 701,// Invalid Argument Syntax
FAULT_UPNP_702,//Invalid XML Argument
FAULT_UPNP_703,// No Such Name
FAULT_UPNP_704,// Invalid Value Type
FAULT_UPNP_705,// Invalid Value
FAULT_UPNP_706,// Read Only Violation
FAULT_UPNP_707,// Multiple Set
FAULT_UPNP_708,// Resource Temporarily Unavailable
__FAULT_UPNP_MAX
};
#endif
enum {
INSTANCE_UPDATE_NUMBER,
INSTANCE_UPDATE_ALIAS
};
enum instance_mode {
INSTANCE_MODE_NUMBER,
INSTANCE_MODE_ALIAS
};
enum end_session_enum {
END_SESSION_REBOOT = 1,
END_SESSION_EXTERNAL_ACTION = 1<<1,
END_SESSION_RELOAD = 1<<2,
END_SESSION_FACTORY_RESET = 1<<3,
END_SESSION_IPPING_DIAGNOSTIC = 1<<4,
END_SESSION_DOWNLOAD_DIAGNOSTIC = 1<<5,
END_SESSION_UPLOAD_DIAGNOSTIC = 1<<6,
END_SESSION_X_FACTORY_RESET_SOFT = 1<<7,
END_SESSION_NSLOOKUP_DIAGNOSTIC = 1<<8,
END_SESSION_TRACEROUTE_DIAGNOSTIC = 1<<9,
END_SESSION_UDPECHO_DIAGNOSTIC = 1<<10,
END_SESSION_SERVERSELECTION_DIAGNOSTIC = 1<<11
};
enum dm_browse_enum {
DM_ERROR = -1,
DM_OK = 0,
DM_STOP = 1
};
enum dmt_type_enum {
DMT_STRING,
DMT_UNINT,
DMT_INT,
DMT_LONG,
DMT_BOOL,
DMT_TIME,
DMT_HEXBIN,
};
enum amd_version_enum{
AMD_1 = 1,
AMD_2,
AMD_3,
AMD_4,
AMD_5,
};
enum dm_type_enum{
DM_CWMP,
DM_UPNP,
};
enum datamodel_type_enum{
DM_TR098,
DM_TR181,
};
enum dm_param_flags_enum{
/* UPNP OnChange flags flags */
DM_PARAM_ALARAM_ON_CHANGE = 1 << 0,
DM_PARAM_EVENT_ON_CHANGE = 1 << 1,
/* UPNP type flags */
NODE_DATA_ATTRIBUTE_INSTANCE = 0x0010,
NODE_DATA_ATTRIBUTE_MULTIINSTANCE = 0x0020,
NODE_DATA_ATTRIBUTE_TYPESTRING = 0x0100,
NODE_DATA_ATTRIBUTE_TYPEINT = 0x0200,
NODE_DATA_ATTRIBUTE_TYPELONG = 0x0400,
NODE_DATA_ATTRIBUTE_TYPEBOOL = 0x0800,
NODE_DATA_ATTRIBUTE_TYPEDATETIME = 0x1000,
NODE_DATA_ATTRIBUTE_TYPEBASE64 = 0x2000,
NODE_DATA_ATTRIBUTE_TYPEBIN = 0x4000,
NODE_DATA_ATTRIBUTE_TYPEPTR = 0x8000,
NODE_DATA_ATTRIBUTE_TYPEMASK = 0x0000FF00,
/*ACLRoles*/
DM_PUBLIC_LIST = 1 << 0,
DM_PUBLIC_READ = 1 << 1,
DM_PUBLIC_WRITE = 1 << 2,
DM_PUBLIC_MASK = DM_PUBLIC_LIST|DM_PUBLIC_READ|DM_PUBLIC_WRITE,
DM_BASIC_LIST = 1 << 3,
DM_BASIC_READ = 1 << 4,
DM_BASIC_WRITE = 1 << 5,
DM_BASIC_MASK = DM_PUBLIC_MASK|DM_BASIC_LIST|DM_BASIC_READ|DM_BASIC_WRITE,
DM_XXXADMIN_LIST = 1 << 6,
DM_XXXADMIN_READ = 1 << 7,
DM_XXXADMIN_WRITE = 1 << 8,
DM_XXXADMIN_MASK = DM_BASIC_MASK|DM_XXXADMIN_LIST|DM_XXXADMIN_READ|DM_XXXADMIN_WRITE,
DM_SUPERADMIN_MASK = DM_XXXADMIN_MASK | (1 << 9),
DM_LIST_MASK = DM_PUBLIC_LIST|DM_BASIC_LIST|DM_XXXADMIN_LIST,
DM_READ_MASK = DM_PUBLIC_READ|DM_BASIC_READ|DM_XXXADMIN_READ,
DM_WRITE_MASK = DM_PUBLIC_WRITE|DM_BASIC_WRITE|DM_XXXADMIN_WRITE,
DM_FACTORIZED = 1 << 31
};
extern struct list_head list_enabled_notify;
extern struct list_head list_enabled_lw_notify;
extern struct list_head list_execute_end_session;
#ifdef UPNP_TR064
extern struct list_head list_upnp_enabled_onevent;
extern struct list_head list_upnp_enabled_onalarm;
extern struct list_head list_upnp_enabled_version;
extern struct list_head list_upnp_changed_onevent;
extern struct list_head list_upnp_changed_onalarm;
extern struct list_head list_upnp_changed_version;
#endif
extern int end_session_flag;
extern int ip_version;
extern char dm_delim;
extern char dmroot[64];
extern unsigned int upnp_in_user_mask;
char *update_instance(struct uci_section *s, char *last_inst, char *inst_opt);
char *update_instance_icwmpd(struct uci_section *s, char *last_inst, char *inst_opt);
char *update_instance_alias_icwmpd(int action, char **last_inst , void *argv[]);
char *update_instance_alias(int action, char **last_inst , void *argv[]);
char *update_instance_without_section(int action, char **last_inst, void *argv[]);
int get_empty(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
void add_list_paramameter(struct dmctx *ctx, char *param_name, char *param_data, char *param_type, char *param_version, unsigned int flags);
void del_list_parameter(struct dm_parameter *dm_parameter);
void free_all_list_parameter(struct dmctx *ctx);
void add_set_list_tmp(struct dmctx *ctx, char *param, char *value, unsigned int flags);
void del_set_list_tmp(struct set_tmp *set_tmp);
void free_all_set_list_tmp(struct dmctx *ctx);
void add_list_fault_param(struct dmctx *ctx, char *param, int fault);
void del_list_fault_param(struct param_fault *param_fault);
void free_all_list_fault_param(struct dmctx *ctx);
int string_to_bool(char *v, bool *b);
int dm_entry_get_value(struct dmctx *ctx);
int dm_entry_get_name(struct dmctx *ctx);
int dm_entry_get_notification(struct dmctx *ctx);
int dm_entry_inform(struct dmctx *ctx);
int dm_entry_add_object(struct dmctx *ctx);
int dm_entry_delete_object(struct dmctx *ctx);
int dm_entry_set_value(struct dmctx *ctx);
int dm_entry_set_notification(struct dmctx *ctx);
int dm_entry_enabled_notify(struct dmctx *ctx);
int dm_entry_enabled_notify_check_value_change(struct dmctx *dmctx);
int dm_entry_get_linker(struct dmctx *ctx);
int dm_entry_get_linker_value(struct dmctx *ctx);
#ifdef UPNP_TR064
int dm_entry_upnp_get_instances(struct dmctx *ctx);
int dm_entry_upnp_get_selected_values(struct dmctx *dmctx);
int dm_entry_upnp_get_values(struct dmctx *dmctx);
int dm_entry_upnp_set_values(struct dmctx *dmctx);
int dm_entry_upnp_get_attributes(struct dmctx *dmctx);
int upnp_state_variables_init(struct dmctx *dmctx);
int dm_entry_upnp_tracked_parameters(struct dmctx *dmctx);
int dm_entry_upnp_get_instance_numbers(struct dmctx *dmctx);
char *dm_entry_get_all_instance_numbers(struct dmctx *pctx, char *param);
void free_all_list_enabled_notify();
void free_all_list_upnp_param_track(struct list_head *head);
#endif
void dm_update_enabled_notify(struct dm_enabled_notify *p, char *new_value);
int dm_update_file_enabled_notify(char *param, char *new_value);
void dm_update_enabled_notify_byname(char *name, char *new_value);
char *get_last_instance(char *package, char *section, char *opt_inst);
char *get_last_instance_icwmpd_without_update(char *package, char *section, char *opt_inst);
char *get_last_instance_icwmpd(char *package, char *section, char *opt_inst);
char *get_vlan_last_instance_icwmpd(char *package, char *section, char *opt_inst, char *vlan_method);
char *get_last_instance_lev2(char *package, char *section, char *opt_inst, char *opt_check, char *value_check);
char *get_last_instance_lev2_icwmpd_dmmap_opt(char* dmmap_package, char *section, char *opt_inst, char *opt_check, char *value_check);
char *get_last_instance_lev2_icwmpd(char *package, char *section, char* dmmap_package, char *opt_inst, char *opt_check, char *value_check);
char *handle_update_instance(int instance_ranck, struct dmctx *ctx, char **last_inst, char * (*up_instance)(int action, char **last_inst, void *argv[]), int argc, ...);
int dm_add_end_session(struct dmctx *ctx, void(*function)(struct execute_end_session *), int action, void *data);
int apply_end_session();
void cwmp_set_end_session (unsigned int flag);
char *dm_print_path(char *fpath, ...);
void free_all_list_enabled_lwnotify();
#ifdef UPNP_TR064
void dm_upnp_apply_config(void);
void add_list_upnp_param_track(struct dmctx *dmctx, struct list_head *pchead, char *param, char *key, char *value, unsigned int isobj);
int dm_link_inst_obj(struct dmctx *dmctx, DMNODE *parent_node, void *data, char *instance);
int dm_entry_upnp_get_supported_parameters(struct dmctx *dmctx);
int dm_entry_upnp_set_attributes(struct dmctx *dmctx);
int dm_entry_upnp_delete_instance(struct dmctx *dmctx);
int dm_entry_upnp_get_acl_data(struct dmctx *dmctx);
void free_all_list_enabled_lwnotify();
int dm_entry_upnp_add_instance(struct dmctx *dmctx);
#endif
static inline int DM_LINK_INST_OBJ(struct dmctx *dmctx, DMNODE *parent_node, void *data, char *instance)
{
dmctx->faultcode = dm_link_inst_obj(dmctx, parent_node, data, instance);
if (dmctx->stop)
return DM_STOP;
return DM_OK;
}
#ifndef TRACE
#define TRACE_TYPE 0
static inline void trace_empty_func()
{
}
#if TRACE_TYPE == 2
#define TRACE(MESSAGE,args...) do { \
const char *A[] = {MESSAGE}; \
fprintf(stderr, "TRACE: %s %s %d ",__FUNCTION__,__FILE__,__LINE__); \
if(sizeof(A) > 0) \
fprintf(stderr, *A,##args); \
fprintf(stderr, "\n"); \
fflush(stderr); \
} while(0)
#elif TRACE_TYPE == 1
#define TRACE(MESSAGE, ...) printf(MESSAGE, ## __VA_ARGS__)
#else
#define TRACE(MESSAGE, ...) trace_empty_func()
#endif
#endif
#ifndef DETECT_CRASH
#define DETECT_CRASH(MESSAGE,args...) { \
const char *A[] = {MESSAGE}; \
printf("DETECT_CRASH: %s %s %d\n",__FUNCTION__,__FILE__,__LINE__); fflush(stdout);\
if(sizeof(A) > 0) \
printf(*A,##args); \
sleep(1); \
}
#endif
#endif

File diff suppressed because it is too large Load diff

View file

@ -1,77 +0,0 @@
#ifndef __DMENTRY_H__
#define __DMENTRY_H__
#include "dmcwmp.h"
extern struct list_head head_package_change;
extern unsigned char dmcli_timetrack;
extern unsigned char dmcli_evaluatetest;
enum ctx_init_enum {
CTX_INIT_ALL,
CTX_INIT_SUB
};
int dm_ctx_init(struct dmctx *ctx, unsigned int dm_type, unsigned int amd_version, unsigned int instance_mode);
int dm_ctx_init_sub(struct dmctx *ctx, unsigned int dm_type, unsigned int amd_version, unsigned int instance_mode);
int dm_entry_param_method(struct dmctx *ctx, int cmd, char *inparam, char *arg1, char *arg2);
int dm_entry_apply(struct dmctx *ctx, int cmd, char *arg1, char *arg2);
int dm_entry_load_enabled_notify(unsigned int dm_type, unsigned int amd_version, int instance_mode);
int dm_entry_reload_enabled_notify(unsigned int dm_type, unsigned int amd_version, int instance_mode);
int adm_entry_get_linker_param(struct dmctx *ctx, char *param, char *linker, char **value);
int adm_entry_get_linker_value(struct dmctx *ctx, char *param, char **value);
int dm_entry_restart_services(void);
#ifdef UPNP_TR064
int dm_entry_upnp_restart_services(void);
void dm_upnp_apply_config(void);
int dm_entry_upnp_check_alarmonchange_param(struct dmctx *dmctx);
int dm_entry_upnp_check_eventonchange_param(struct dmctx *dmctx);
int dm_entry_upnp_check_versiononchange_param(struct dmctx *pctx);
int dm_entry_upnp_load_tracked_parameters(struct dmctx *dmctx);
int dm_entry_upnp_get_supported_parameters_update(struct dmctx *dmctx, char **value);
int dm_entry_upnp_get_supported_datamodel_update(struct dmctx *dmctx, char **value);
int dm_entry_upnp_get_attribute_values_update(struct dmctx *dmctx, char **value);
int dm_entry_upnp_get_configuration_update(struct dmctx *dmctx, char **value);
int dm_entry_upnp_get_current_configuration_version(struct dmctx *dmctx, char **value);
#endif
int dm_ctx_clean(struct dmctx *ctx);
int dm_ctx_clean_sub(struct dmctx *ctx);
void dm_execute_cli_shell(int argc, char** argv, unsigned int dmtype, unsigned int amd_version, unsigned int instance_mode);
void dm_execute_cli_command(char *file, unsigned int dmtype, unsigned int amd_version, unsigned int instance_mode);
void wepkey_cli(int argc, char** argv);
void dmentry_instance_lookup_inparam(struct dmctx *ctx);
#ifdef UPNP_TR064
#define DM_ENTRY_UPNP_CHECK_CHANGES(ALARM, EVENT, VERSION) \
do { \
struct dmctx dmctx_chg = {0}; \
dm_ctx_init(&dmctx_chg, DM_UPNP, AMD_2, INSTANCE_MODE_NUMBER); \
ALARM = dm_entry_upnp_check_alarmonchange_param(&dmctx_chg); \
dm_ctx_clean(&dmctx_chg); \
memset(&dmctx_chg, 0, sizeof(struct dmctx)); \
dm_ctx_init(&dmctx_chg, DM_UPNP, AMD_2, INSTANCE_MODE_NUMBER); \
EVENT = dm_entry_upnp_check_eventonchange_param(&dmctx_chg); \
dm_ctx_clean(&dmctx_chg); \
memset(&dmctx_chg, 0, sizeof(struct dmctx)); \
dm_ctx_init(&dmctx_chg, DM_UPNP, AMD_2, INSTANCE_MODE_NUMBER); \
VERSION = dm_entry_upnp_check_versiononchange_param(&dmctx_chg); \
dm_ctx_clean(&dmctx_chg); \
} while(0)
#define DM_ENTRY_UPNP_FREE_ALL_CHECK_CHANGES() \
do { \
free_all_list_upnp_param_track(&list_upnp_changed_onevent); \
free_all_list_upnp_param_track(&list_upnp_changed_onalarm); \
free_all_list_upnp_param_track(&list_upnp_changed_version); \
} while(0)
#define DM_ENTRY_UPNP_LOAD_TRACKED_PARAMETERS() \
do { \
struct dmctx dmctx_trk = {0}; \
dm_ctx_init(&dmctx_trk, DM_UPNP, AMD_2, INSTANCE_MODE_NUMBER); \
dm_entry_upnp_load_tracked_parameters(&dmctx_trk); \
dm_ctx_clean(&dmctx_trk); \
} while(0)
#endif
#endif

View file

@ -1,286 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <json-c/json.h>
#include <libubox/blobmsg_json.h>
#include "dmjson.h"
#include "dmmem.h"
static json_object *dmjson_jobj = NULL;
void dm_add_json_obj(json_object *json_obj_out, char *object, char *string)
{
json_object *json_obj_tmp = json_object_new_string(string);
json_object_object_add(json_obj_out, object, json_obj_tmp);
}
static void inline __dmjson_fprintf(FILE *fp, int argc, struct dmjson_arg dmarg[])
{
int i;
char *arg;
json_object *json_obj_out = json_object_new_object();
if (json_obj_out == NULL)
return;
if (argc) {
for (i = 0; i < argc; i++) {
dm_add_json_obj(json_obj_out, dmarg[i].key, dmarg[i].val);
}
arg = (char *)json_object_to_json_string(json_obj_out);
fprintf(fp, "%s\n", arg);
}
json_object_put(json_obj_out);
}
void dmjson_fprintf(FILE *fp, int argc, struct dmjson_arg dmarg[])
{
__dmjson_fprintf(fp, argc, dmarg);
}
void dmjson_parse_init(char *msg)
{
if (dmjson_jobj) {
json_object_put(dmjson_jobj);
dmjson_jobj = NULL;
}
dmjson_jobj = json_tokener_parse(msg);
}
void dmjson_parse_fini(void)
{
if (dmjson_jobj) {
json_object_put(dmjson_jobj);
dmjson_jobj = NULL;
}
}
static char *dmjson_print_value(json_object *jobj)
{
enum json_type type;
char *ret = "";
if (!jobj)
return ret;
type = json_object_get_type(jobj);
switch (type) {
case json_type_boolean:
case json_type_double:
case json_type_int:
case json_type_string:
ret = (char *)json_object_get_string(jobj);
break;
}
return ret;
}
char *____dmjson_get_value_in_obj(json_object *mainjobj, char *argv[])
{
json_object *jobj = NULL;
char *value = "";
jobj = dmjson_select_obj(mainjobj, argv);
value = dmjson_print_value(jobj);
return value;
}
char *__dmjson_get_value_in_obj(json_object *mainjobj, int argc, ...)
{
va_list arg;
char *argv[64], *v;
int i;
va_start(arg, argc);
for (i = 0; i < argc; i++)
{
argv[i] = va_arg(arg, char *);
}
argv[argc] = NULL;
va_end(arg);
v = ____dmjson_get_value_in_obj(mainjobj, argv);
return v;
}
json_object *__dmjson_get_obj(json_object *mainjobj, int argc, ...)
{
va_list arg;
char *argv[64];
int i;
va_start(arg, argc);
for (i = 0; i < argc; i++)
{
argv[i] = va_arg(arg, char *);
}
argv[argc] = NULL;
va_end(arg);
return dmjson_select_obj(mainjobj, argv);
//return v;
}
json_object *dmjson_select_obj(json_object * jobj, char *argv[])
{
int i;
for (i = 0; argv[i]; i++) {
if (jobj == NULL)
return NULL;
json_object_object_get_ex(jobj, argv[i], &jobj);
}
return jobj;
}
json_object *____dmjson_select_obj_in_array_idx(json_object *mainjobj, json_object **arrobj, int index, char *argv[])
{
json_object *jobj = NULL;
int i;
if (arrobj == NULL || *arrobj == NULL) {
jobj = dmjson_select_obj(mainjobj, argv);
if (arrobj)
*arrobj = jobj;
if (jobj && json_object_get_type(jobj) == json_type_array) {
jobj = json_object_array_get_idx(jobj, index);
return jobj;
}
else {
return NULL;
}
}
else {
jobj = json_object_array_get_idx(*arrobj, index);
return jobj;
}
return NULL;
}
json_object *__dmjson_select_obj_in_array_idx(json_object *mainjobj, json_object **arrobj, int index, int argc, ...)
{
va_list arg;
json_object *jobj;
char *argv[64];
int i;
if (mainjobj == NULL)
return NULL;
va_start(arg, argc);
for (i = 0; i < argc; i++)
{
argv[i] = va_arg(arg, char *);
}
argv[argc] = NULL;
va_end(arg);
jobj = ____dmjson_select_obj_in_array_idx(mainjobj, arrobj, index, argv);
return jobj;
}
char *____dmjson_get_value_in_array_idx(json_object *mainjobj, json_object **arrobj, int index, char *argv[])
{
json_object *jobj = NULL;
char *value = NULL;
int i;
if (arrobj == NULL || *arrobj == NULL) {
jobj = dmjson_select_obj(mainjobj, argv);
if (arrobj)
*arrobj = jobj;
if (jobj && json_object_get_type(jobj) == json_type_array) {
jobj = json_object_array_get_idx(jobj, index);
if (jobj == NULL)
return NULL;
value = dmjson_print_value(jobj);
return value;
}
}
else {
jobj = json_object_array_get_idx(*arrobj, index);
if (jobj == NULL)
return NULL;
value = dmjson_print_value(jobj);
return value;
}
return value;
}
char *__dmjson_get_value_in_array_idx(json_object *mainjobj, json_object **arrobj, char *defret, int index, int argc, ...)
{
va_list arg;
char *argv[64], *v;
int i;
if (mainjobj == NULL)
return defret;
va_start(arg, argc);
for (i = 0; i < argc; i++)
{
argv[i] = va_arg(arg, char *);
}
argv[argc] = NULL;
va_end(arg);
v = ____dmjson_get_value_in_array_idx(mainjobj, arrobj, index, argv);
return (v ? v : defret) ;
}
char *____dmjson_get_value_array_all(json_object *mainjobj, char *delim, char *argv[])
{
json_object *arrobj;
char *v, *ret = "";
int i, dlen;
delim = (delim) ? delim : ",";
dlen = strlen(delim);
for (i = 0, arrobj = NULL, v = ____dmjson_get_value_in_array_idx(mainjobj, &arrobj, i, argv);
v;
v = ____dmjson_get_value_in_array_idx(mainjobj, &arrobj, ++i, argv)) {
if (*ret == '\0') {
ret = dmstrdup(v);
}
else if (*v) {
ret = dmrealloc(ret, strlen(ret) + dlen + strlen(v) + 1);
strcat(ret, delim);
strcat(ret, v);
}
}
return ret;
}
char *__dmjson_get_value_array_all(json_object *mainjobj, char *delim, int argc, ...)
{
char *argv[64], *ret;
va_list arg;
int i;
va_start(arg, argc);
for (i = 0; i < argc; i++)
{
argv[i] = va_arg(arg, char *);
}
argv[argc] = NULL;
va_end(arg);
ret = ____dmjson_get_value_array_all(mainjobj, delim, argv);
return ret;
}
void dmjson_get_var(char *jkey, char **jval)
{
enum json_type type;
*jval = "";
if (dmjson_jobj == NULL)
return;
json_object_object_foreach(dmjson_jobj, key, val) {
if (strcmp(jkey, key) == 0) {
*jval = dmjson_print_value(val);
return;
}
}
}

View file

@ -1,50 +0,0 @@
#ifndef __DMJSON_H
#define __DMJSON_H
#include <string.h>
#include <json-c/json.h>
#include <libubox/blobmsg_json.h>
#include "dmcwmp.h"
struct dmjson_arg {
char *key;
char *val;
};
#define DMJSON_ARGS (struct dmjson_arg[])
void dm_add_json_obj(json_object *json_obj_out, char *object, char *string);
void dmjson_printf(int argc, struct dmjson_arg dmarg[]);
void dmjson_fprintf(FILE *fp, int argc, struct dmjson_arg dmarg[]);
void dmjson_parse_init(char *msg);
void dmjson_parse_fini(void);
void dmjson_get_var(char *jkey, char **jval);
json_object *dmjson_select_obj(json_object * jobj, char *argv[]);
json_object *__dmjson_get_obj(json_object *mainjobj, int argc, ...);
char *____dmjson_get_value_in_obj(json_object *mainjobj, char *argv[]);
char *__dmjson_get_value_in_obj(json_object *mainjobj, int argc, ...);
json_object *__dmjson_select_obj_in_array_idx(json_object *mainjobj, json_object **arrobj, int index, int argc, ...);
char *____dmjson_get_value_array_all(json_object *mainjobj, char *delim, char *argv[]);
char *__dmjson_get_value_array_all(json_object *mainjobj, char *delim, int argc, ...);
#define dmjson_get_value(JOBJ,ARGC,args...) \
__dmjson_get_value_in_obj(JOBJ, ARGC, ##args)
#define dmjson_get_obj(JOBJ,ARGC,args...) \
__dmjson_get_obj(JOBJ, ARGC, ##args)
#define dmjson_get_value_in_array_idx(MAINJOBJ,INDEX,ARGC,args...) \
__dmjson_get_value_in_array_idx(MAINJOBJ, NULL, "", INDEX, ARGC, ##args)
#define dmjson_select_obj_in_array_idx(MAINJOBJ,INDEX,ARGC,args...) \
__dmjson_select_obj_in_array_idx(MAINJOBJ, NULL, INDEX, ARGC, ##args)
#define dmjson_get_value_array_all(MAINJOBJ,DELIM,ARGC,args...) \
__dmjson_get_value_array_all(MAINJOBJ, DELIM, ARGC, ##args);
#define dmjson_foreach_value_in_array(MAINJOBJ,ARROBJ,VAL,INDEX,ARGC,args...) \
for (INDEX = 0, ARROBJ = NULL, VAL = __dmjson_get_value_in_array_idx(MAINJOBJ, &(ARROBJ), NULL, INDEX, ARGC, ##args);\
VAL; \
VAL = __dmjson_get_value_in_array_idx(MAINJOBJ, &(ARROBJ), NULL, ++INDEX, 0))
#endif

View file

@ -1,152 +0,0 @@
#include "dmmem.h"
#ifdef WITH_MEMLEACKSEC
LIST_HEAD(memhead);
inline void *__dmmalloc
(
#ifdef WITH_MEMTRACK
const char *file, const char *func, int line,
#endif /*WITH_MEMTRACK*/
size_t size
)
{
struct dmmem *m = malloc(sizeof(struct dmmem) + size);
if (m == NULL) return NULL;
list_add(&m->list, &memhead);
#ifdef WITH_MEMTRACK
m->file = (char *)file;
m->func = (char *)func;
m->line = line;
#endif /*WITH_MEMTRACK*/
return (void *)m->mem;
}
inline void *__dmcalloc
(
#ifdef WITH_MEMTRACK
const char *file, const char *func, int line,
#endif /*WITH_MEMTRACK*/
int n, size_t size
)
{
struct dmmem *m = calloc(n, sizeof(struct dmmem) + size);
if (m == NULL) return NULL;
list_add(&m->list, &memhead);
#ifdef WITH_MEMTRACK
m->file = (char *)file;
m->func = (char *)func;
m->line = line;
#endif /*WITH_MEMTRACK*/
return (void *)m->mem;
}
inline void *__dmrealloc
(
#ifdef WITH_MEMTRACK
const char *file, const char *func, int line,
#endif /*WITH_MEMTRACK*/
void *old, size_t size
)
{
struct dmmem *m = NULL;
if (old != NULL) {
m = container_of(old, struct dmmem, mem);
list_del(&m->list);
}
m = realloc(m, sizeof(struct dmmem) + size);
if (m == NULL) return NULL;
list_add(&m->list, &memhead);
#ifdef WITH_MEMTRACK
m->file = (char *)file;
m->func = (char *)func;
m->line = line;
#endif /*WITH_MEMTRACK*/
return (void *)m->mem;
}
inline void dmfree(void *m)
{
if (m == NULL) return;
struct dmmem *rm;
rm = container_of(m, struct dmmem, mem);
list_del(&rm->list);
free(rm);
}
void dmcleanmem()
{
struct dmmem *dmm;
while (memhead.next != &memhead) {
dmm = list_entry(memhead.next, struct dmmem, list);
#ifdef WITH_MEMTRACK
fprintf(stderr, "Allocated memory in {%s, %s(), line %d} is not freed\n", dmm->file, dmm->func, dmm->line);
#endif /*WITH_MEMTRACK*/
list_del(&dmm->list);
free(dmm);
}
}
char *__dmstrdup
(
#ifdef WITH_MEMTRACK
const char *file, const char *func, int line,
#endif /*WITH_MEMTRACK*/
const char *s
)
{
size_t len = strlen(s) + 1;
#ifdef WITH_MEMTRACK
void *new = __dmmalloc(file, func, line, len);
#else
void *new = __dmmalloc(len);
#endif /*WITH_MEMTRACK*/
if (new == NULL) return NULL;
return (char *) memcpy(new, s, len);
}
#endif /*WITH_MEMLEACKSEC*/
int __dmasprintf
(
#ifdef WITH_MEMTRACK
const char *file, const char *func, int line,
#endif /*WITH_MEMTRACK*/
char **s, const char *format, ...
)
{
char buf[512];
va_list arg;
int ret;
va_start(arg,format);
ret = vsprintf(buf, format, arg);
va_end(arg);
#ifdef WITH_MEMTRACK
*s = __dmstrdup(file, func, line, buf);
#else
*s = __dmstrdup(buf);
#endif /*WITH_MEMTRACK*/
if (*s == NULL) return -1;
return 0;
}
int __dmastrcat
(
#ifdef WITH_MEMTRACK
const char *file, const char *func, int line,
#endif /*WITH_MEMTRACK*/
char **s, char *obj, char *lastname
)
{
char buf[512];
int olen = strlen(obj);
memcpy(buf, obj, olen);
int llen = strlen(lastname) + 1;
memcpy(buf + olen, lastname, llen);
#ifdef WITH_MEMTRACK
*s = __dmstrdup(file, func, line, buf);
#else
*s = __dmstrdup(buf);
#endif /*WITH_MEMTRACK*/
if (*s == NULL) return -1;
return 0;
}

View file

@ -1,110 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <libubox/list.h>
#ifndef __DMMEM_H
#define __DMMEM_H
void dmfree(void *m);
static inline void dm_empty_func()
{
}
#define WITH_MEMLEACKSEC 1
//#define WITH_MEMTRACK 1
#ifndef WITH_MEMLEACKSEC
#undef WITH_MEMTRACK
#endif
#ifdef WITH_MEMLEACKSEC
struct dmmem {
struct list_head list;
#ifdef WITH_MEMTRACK
char *file;
char *func;
int line;
#endif /*WITH_MEMTRACK*/
char mem[0];
};
void *__dmmalloc
(
#ifdef WITH_MEMTRACK
const char *file, const char *func, int line,
#endif /*WITH_MEMTRACK*/
size_t size
);
void *__dmcalloc
(
#ifdef WITH_MEMTRACK
const char *file, const char *func, int line,
#endif /*WITH_MEMTRACK*/
int n, size_t size
);
void *__dmrealloc
(
#ifdef WITH_MEMTRACK
const char *file, const char *func, int line,
#endif /*WITH_MEMTRACK*/
void *n, size_t size
);
char *__dmstrdup
(
#ifdef WITH_MEMTRACK
const char *file, const char *func, int line,
#endif /*WITH_MEMTRACK*/
const char *s
);
void dmcleanmem();
#endif /*WITH_MEMLEACKSEC*/
int __dmasprintf
(
#ifdef WITH_MEMTRACK
const char *file, const char *func, int line,
#endif /*WITH_MEMTRACK*/
char **s, const char *format, ...
);
int __dmastrcat
(
#ifdef WITH_MEMTRACK
const char *file, const char *func, int line,
#endif /*WITH_MEMTRACK*/
char **s, char *obj, char *lastname
);
#ifdef WITH_MEMLEACKSEC
#ifdef WITH_MEMTRACK
#define dmmalloc(x) __dmmalloc(__FILE__, __func__, __LINE__, x)
#define dmcalloc(n, x) __dmcalloc(__FILE__, __func__, __LINE__, n, x)
#define dmrealloc(x, n) __dmrealloc(__FILE__, __func__, __LINE__, x, n)
#define dmstrdup(x) __dmstrdup(__FILE__, __func__, __LINE__, x)
#define dmasprintf(s, format, ...) __dmasprintf(__FILE__, __func__, __LINE__, s, format, ## __VA_ARGS__)
#define dmastrcat(s, b, m) __dmastrcat(__FILE__, __func__, __LINE__, s, b, m)
#else
#define dmmalloc(x) __dmmalloc(x)
#define dmcalloc(n, x) __dmcalloc(n, x)
#define dmrealloc(x, n) __dmrealloc(x, n)
#define dmstrdup(x) __dmstrdup(x)
#define dmasprintf(s, format, ...) __dmasprintf(s, format, ## __VA_ARGS__)
#define dmastrcat(s, b, m) __dmastrcat(s, b, m)
#endif /*WITH_MEMTRACK*/
#else
#define dmmalloc(x) malloc(x)
#define dmcalloc(n, x) calloc(n, x)
#define __dmstrdup(x) strdup(x)
#define dmstrdup(x) strdup(x)
#define dmasprintf(s, format, ...) __dmasprintf(s, format, ## __VA_ARGS__)
#define dmastrcat(s, b, m) __dmastrcat(s, b, m)
#define dmfree(x) free(x)
#define dmcleanmem() dm_empty_func()
#endif /*WITH_MEMLEACKSEC*/
#define DMFREE(x) do { dmfree(x); x = NULL; } while (0);
#endif

View file

@ -1,789 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2012-2014 PIVA SOFTWARE (www.pivasoftware.com)
* Author: Imen Bhiri <imen.bhiri@pivasoftware.com>
* Author: Feten Besbes <feten.besbes@pivasoftware.com>
*/
#include <ctype.h>
#include <uci.h>
#include <stdio.h>
#include <dirent.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/klog.h>
#include "dmcwmp.h"
#include "dmuci.h"
#include "dmubus.h"
#include "dmcommon.h"
#include "deviceinfo.h"
#include "dmjson.h"
/*** DeviceInfo. ***/
DMOBJ tDeviceInfoObj[] = {
/* OBJ, permission, addobj, delobj, browseinstobj, finform, notification, nextobj, leaf, linker*/
{CUSTOM_PREFIX"CATV", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tCatTvParams, NULL},
{"VendorConfigFile", &DMREAD, NULL, NULL, NULL, browseVcfInst, NULL, NULL, NULL, tVcfParams, NULL},
{"VendorLogFile", &DMREAD, NULL, NULL, NULL, browseVlfInst, NULL, NULL, NULL, tVlfParams, NULL},
{"MemoryStatus", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tMemoryStatusParams, NULL},
{"ProcessStatus", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tProcessEntriesObj, tProcessStatusParams, NULL},
{0}
};
DMLEAF tMemoryStatusParams[] = {
{"Total", &DMREAD, DMT_UNINT, get_memory_status_total, NULL, NULL, NULL},
{"Free", &DMREAD, DMT_UNINT, get_memory_status_free, NULL, NULL, NULL},
{0}
};
DMOBJ tProcessEntriesObj[] = {
{"Process", &DMREAD, NULL, NULL, NULL, browsePocessEntriesInst, NULL, NULL, NULL, tProcessEntrieParams, NULL},
{0}
};
DMLEAF tProcessStatusParams[] = {
{"CPUUsage", &DMREAD, DMT_UNINT, get_process_cpu_usage, NULL, NULL, NULL},
{"ProcessNumberOfEntries", &DMREAD, DMT_UNINT, get_process_number_of_entries, NULL, NULL, NULL},
{0}
};
DMLEAF tProcessEntrieParams[] = {
{"PID", &DMREAD, DMT_UNINT, get_process_pid, NULL, NULL, NULL},
{"Command", &DMREAD, DMT_STRING, get_process_command, NULL, NULL, NULL},
{"Size", &DMREAD, DMT_UNINT, get_process_size, NULL, NULL, NULL},
{"Priority", &DMREAD, DMT_UNINT, get_process_priority, NULL, NULL, NULL},
{"CPUTime", &DMREAD, DMT_UNINT, get_process_cpu_time, NULL, NULL, NULL},
{"State", &DMREAD, DMT_STRING, get_process_state, NULL, NULL, NULL},
{0}
};
DMLEAF tDeviceInfoParams[] = {
/* PARAM, permission, type, getvlue, setvalue, forced_inform, notification, linker*/
{"Manufacturer", &DMREAD, DMT_STRING, get_device_manufacturer, NULL, &DMFINFRM, NULL},
{"ManufacturerOUI", &DMREAD, DMT_STRING, get_device_manufactureroui, NULL, &DMFINFRM, NULL},
{"ModelName", &DMREAD, DMT_STRING, get_device_routermodel, NULL, &DMFINFRM, NULL},
{"ProductClass", &DMREAD, DMT_STRING, get_device_productclass, NULL, &DMFINFRM, NULL},
{"SerialNumber", &DMREAD, DMT_STRING, get_device_serialnumber, NULL, &DMFINFRM, NULL},
{"HardwareVersion", &DMREAD, DMT_STRING, get_device_hardwareversion, NULL, &DMFINFRM, NULL},
{"SoftwareVersion", &DMREAD, DMT_STRING, get_device_softwareversion, NULL, &DMFINFRM, &DMACTIVE},
{"UpTime", &DMREAD, DMT_UNINT, get_device_info_uptime, NULL, NULL, NULL},
{"DeviceLog", &DMREAD, DMT_STRING, get_device_devicelog, NULL, NULL, NULL},
{"SpecVersion", &DMREAD, DMT_STRING, get_device_specversion, NULL, &DMFINFRM, NULL},
{"ProvisioningCode", &DMWRITE, DMT_STRING, get_device_provisioningcode, set_device_provisioningcode, &DMFINFRM, &DMACTIVE},
{CUSTOM_PREFIX"BaseMacAddr", &DMREAD, DMT_STRING, get_base_mac_addr, NULL, NULL, NULL},
{CUSTOM_PREFIX"CATVEnabled", &DMWRITE, DMT_STRING, get_catv_enabled, set_device_catvenabled, NULL, NULL},
{CUSTOM_PREFIX"MemoryBank", &DMWRITE, DMT_STRING, get_device_memory_bank, set_device_memory_bank, NULL, NULL},
{0}
};
/*** DeviceInfo.X_IOPSYS_EU_CATV. ***/
DMLEAF tCatTvParams[] = {
/* PARAM, permission, type, getvlue, setvalue, forced_inform, notification*/
{"Enabled", &DMWRITE, DMT_STRING, get_catv_enabled, set_device_catvenabled, NULL, NULL},
{"OpticalInputLevel", &DMREAD, DMT_STRING, get_catv_optical_input_level, NULL, NULL, NULL},
{"RFOutputLevel", &DMREAD, DMT_STRING, get_catv_rf_output_level, NULL, NULL, NULL},
{"Temperature", &DMREAD, DMT_STRING, get_catv_temperature, NULL, NULL, NULL},
{"Voltage", &DMREAD, DMT_STRING, get_catv_voltage, NULL, NULL, NULL},
{0}
};
/*** DeviceInfo.VendorConfigFile.{i}. ***/
DMLEAF tVcfParams[] = {
/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification*/
{"Alias", &DMWRITE, DMT_STRING, get_vcf_alias, set_vcf_alias, NULL, NULL},
{"Name", &DMREAD, DMT_STRING, get_vcf_name, NULL, NULL, NULL},
{"Version", &DMREAD, DMT_STRING, get_vcf_version, NULL, NULL, NULL},
{"Date", &DMREAD, DMT_TIME, get_vcf_date, NULL, NULL, NULL},
{"Description", &DMREAD, DMT_STRING, get_vcf_desc, NULL, NULL, NULL},
{"UseForBackupRestore", &DMREAD, DMT_BOOL, get_vcf_backup_restore, NULL, NULL, NULL},
{0}
};
/*** DeviceInfo.VendorLogFile.{i}. ***/
DMLEAF tVlfParams[] = {
/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification*/
{"Alias", &DMWRITE, DMT_STRING, get_vlf_alias, set_vlf_alias, NULL, NULL},
{"Name", &DMREAD, DMT_STRING, get_vlf_name, NULL, NULL, NULL},
{"MaximumSize", &DMREAD, DMT_UNINT, get_vlf_max_size, NULL, NULL, NULL},
{"Persistent", &DMREAD, DMT_BOOL, get_vlf_persistent, NULL, NULL, NULL},
{0}
};
/*************************************************************
* INIT
/*************************************************************/
inline int init_process_args(struct process_args *args, char *pid, char *command, char* size, char* priority, char *cputime, char *state)
{
args->pid = pid;
args->command= command;
args->size= size;
args->priority= priority;
args->state= state;
args->cputime= cputime;
return 0;
}
/*
*DeviceInfo. functions
*/
char *get_deviceid_manufacturer()
{
char *v;
dmuci_get_option_value_string("cwmp","cpe","manufacturer", &v);
return v;
}
char *get_deviceid_manufactureroui()
{
char *v;
char str[16];
char *mac = NULL;
json_object *res;
FILE *nvrammac=NULL;
char macreadfile[18]={0};
dmuci_get_option_value_string("cwmp", "cpe", "override_oui", &v);
if (v[0] == '\0')
{
dmubus_call("router.system", "info", UBUS_ARGS{{}}, 0, &res);
if(!(res)){
db_get_value_string("hw", "board", "BaseMacAddr", &mac);
if(!mac || strlen(mac)==0 ){
if ((nvrammac = fopen("/proc/nvram/BaseMacAddr", "r")) == NULL)
{
mac = NULL;
}
else{
fscanf(nvrammac,"%[^\n]", macreadfile);
macreadfile[17]='\0';
sscanf(macreadfile,"%2c %2c %2c", str, str+2, str+4);
str[6]='\0';
v = dmstrdup(str); // MEM WILL BE FREED IN DMMEMCLEAN
fclose(nvrammac);
return v;
}
}
}
else
mac = dm_ubus_get_value(res, 2, "system", "basemac");
if(mac)
{
size_t ln = strlen(mac);
if (ln<17) goto not_found;
sscanf (mac,"%2c:%2c:%2c",str,str+2,str+4);
str[6] = '\0';
v = dmstrdup(str); // MEM WILL BE FREED IN DMMEMCLEAN
return v;
}
else
goto not_found;
}
return v;
not_found:
v = "";
return v;
}
char *get_deviceid_productclass()
{
char *v, *tmp, *val;
dmuci_get_option_value_string("cwmp", "cpe", "override_productclass", &v);
if (v[0] == '\0')
{
db_get_value_string("hw", "board", "iopVerBoard", &v);
tmp = dmstrdup(v);// MEM WILL BE FREED IN DMMEMCLEAN
val = tmp;
return val;
}
tmp = dmstrdup(v);// MEM WILL BE FREED IN DMMEMCLEAN
val = tmp;
return val;
}
char *get_deviceid_serialnumber()
{
char *v;
db_get_value_string("hw", "board", "serialNumber", &v);
return v;
}
char *get_softwareversion()
{
char *v, *tmp, *val;
db_get_value_string("hw", "board", "iopVersion", &v);
tmp = dmstrdup(v);// MEM WILL BE FREED IN DMMEMCLEAN
val = tmp;
return val;
}
/*#Device.DeviceInfo.Manufacturer!UCI:cwmp/cwmp,cpe/manufacturer*/
int get_device_manufacturer(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = get_deviceid_manufacturer();
return 0;
}
/*#Device.DeviceInfo.ManufacturerOUI!UCI:cwmp/cwmp,cpe/override_oui*/
int get_device_manufactureroui(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = get_deviceid_manufactureroui();
return 0;
}
/*#Device.DeviceInfo.ProductClass!UCI:cwmp/cwmp,cpe/override_productclass*/
int get_device_productclass(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = get_deviceid_productclass();
return 0;
}
int get_device_serialnumber(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = get_deviceid_serialnumber();
return 0;
}
int get_device_softwareversion(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = get_softwareversion();
return 0;
}
int get_device_hardwareversion(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
db_get_value_string("hw", "board", "hardwareVersion", value);
return 0;
}
int get_device_routermodel(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
db_get_value_string("hw", "board", "routerModel", value);
return 0;
}
int get_device_info_uptime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
FILE* fp = NULL;
char *pch, *spch;
char buf[64];
*value = "0";
fp = fopen(UPTIME, "r");
if (fp != NULL) {
fgets(buf, 64, fp);
pch = strtok_r(buf, ".", &spch);
if (pch)
*value = dmstrdup(pch); // MEM WILL BE FREED IN DMMEMCLEAN
fclose(fp);
}
return 0;
}
int get_device_devicelog(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = "";
int i = 0, nbrlines = 4;
char buff[512], *msg = NULL;
int len = klogctl(3 , buff, sizeof(buff) - 1); /* read ring buffer */
if (len <= 0)
return 0;
buff[len] = '\0';
char *p = buff;
while (*p) { //TODO to optimize, we can avoid this if the '<' and '>' does not cause problem in the tests.
if (*p == '<') {
*p = '(';
if (p == buff || *(p-1) == '\n') {
if(msg == NULL) msg = p;
i++;
if (i == nbrlines) {
*(p-1) = '\0';
break;
}
}
}
else if (*p == '>')
*p = ')';
p++;
}
if(msg == NULL)
*value = "";
else
*value = dmstrdup(msg);// MEM WILL BE FREED IN DMMEMCLEAN
return 0;
}
int get_device_specversion(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = "1.0";
return 0;
}
/*#Device.DeviceInfo.ProvisioningCode!UCI:cwmp/cwmp,cpe/provisioning_code*/
int get_device_provisioningcode(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string("cwmp", "cpe", "provisioning_code", value);
return 0;
}
int set_device_provisioningcode(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
bool b;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value("cwmp", "cpe", "provisioning_code", value);
return 0;
}
return 0;
}
int get_base_mac_addr(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
json_object *res;
dmubus_call("router.system", "info", UBUS_ARGS{{}}, 0, &res);
DM_ASSERT(res, *value = "");
*value = dm_ubus_get_value(res, 2, "system", "basemac");
return 0;
}
int 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 = dm_ubus_get_value(res, 1, "code");
return 0;
}
int set_device_memory_bank(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmubus_call_set("router.system", "memory_bank", UBUS_ARGS{{"bank", value, Integer}}, 1);
return 0;
}
return 0;
}
int 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 set_device_catvenabled(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
bool b;
char *stat;
switch (action) {
case VALUECHECK:
if (string_to_bool(value, &b))
return FAULT_9007;
return 0;
case VALUESET:
string_to_bool(value, &b);
if (b)
stat = "on";
else
stat = "off";
dmuci_set_value("catv", "catv", "enable", stat);
return 0;
}
return 0;
}
int get_catv_optical_input_level(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
json_object *res;
char *str;
*value = "";
dmubus_call("catv", "vpd", UBUS_ARGS{}, 0, &res);
if (!res)
return 0;
*value = dm_ubus_get_value(res, 1, "VPD");
return 0;
}
int get_catv_rf_output_level(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
json_object *res;
char *str;
*value = "";
dmubus_call("catv", "rf", UBUS_ARGS{}, 0, &res);
if (!res)
return 0;
*value = dm_ubus_get_value(res, 1, "RF");
return 0;
}
int get_catv_temperature(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
json_object *res;
char *str;
*value = "";
dmubus_call("catv", "temp", UBUS_ARGS{}, 0, &res);
if (!res)
return 0;
*value = dm_ubus_get_value(res, 1, "Temperature");
return 0;
}
int get_catv_voltage(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
json_object *res;
char *str;
*value = "";
dmubus_call("catv", "vcc", UBUS_ARGS{}, 0, &res);
if (!res)
return 0;
*value = dm_ubus_get_value(res, 1, "VCC");
return 0;
}
int get_vcf_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *vcf_sec = (struct uci_section *)data;
dmuci_get_value_by_section_string(vcf_sec, "name", value);
return 0;
}
int get_vcf_version(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *vcf_sec = (struct uci_section *)data;
dmuci_get_value_by_section_string(vcf_sec, "version", value);
return 0;
}
int get_vcf_date(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
DIR *dir;
struct dirent *d_file;
struct stat attr;
char path[128];
char date[sizeof "AAAA-MM-JJTHH:MM:SS.000Z"];
struct uci_section *vcf_sec = (struct uci_section *)data;
*value = "";
dmuci_get_value_by_section_string(vcf_sec, "name", value);
if ((dir = opendir (DEFAULT_CONFIG_DIR)) != NULL) {
while ((d_file = readdir (dir)) != NULL) {
if(strcmp(*value, d_file->d_name) == 0) {
sprintf(path, DEFAULT_CONFIG_DIR"%s", d_file->d_name);
stat(path, &attr);
strftime(date, sizeof date, "%Y-%m-%dT%H:%M:%S.000Z", localtime(&attr.st_mtime));
*value = dmstrdup(date);
}
}
closedir (dir);
}
return 0;
}
int get_vcf_backup_restore(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *vcf_sec = (struct uci_section *)data;
dmuci_get_value_by_section_string(vcf_sec, "backup_restore", value);
return 0;
}
int get_vcf_desc(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *vcf_sec = (struct uci_section *)data;
dmuci_get_value_by_section_string(vcf_sec, "description", value);
return 0;
}
int get_vcf_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *vcf_sec = (struct uci_section *)data;
dmuci_get_value_by_section_string(vcf_sec, "vcf_alias", value);
return 0;
}
int set_vcf_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct uci_section *vcf_sec = (struct uci_section *)data;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section(vcf_sec, "vcf_alias", value);
return 0;
}
return 0;
}
int lookup_vcf_name(char *instance, char **value)
{
struct uci_section *s = NULL;
uci_path_foreach_option_eq(icwmpd, DMMAP, "vcf", "vcf_instance", instance, s) {
dmuci_get_value_by_section_string(s, "name", value);
}
return 0;
}
int check_file_dir(char *name)
{
DIR *dir;
struct dirent *d_file;
if ((dir = opendir (DEFAULT_CONFIG_DIR)) != NULL) {
while ((d_file = readdir (dir)) != NULL) {
if(strcmp(name, d_file->d_name) == 0) {
closedir(dir);
return 1;
}
}
closedir(dir);
}
return 0;
}
int get_vlf_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *sys_log_sec = (struct uci_section *)data;
dmuci_get_value_by_section_string(sys_log_sec, "vlf_alias", value);
return 0;
}
int set_vlf_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct uci_section *sys_log_sec = (struct uci_section *)data;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section(sys_log_sec, "vlf_alias", value);
return 0;
}
return 0;
}
int get_vlf_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *sys_log_sec = (struct uci_section *)data;
dmuci_get_value_by_section_string(sys_log_sec, "log_file", value);
return 0;
}
int get_vlf_max_size (char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *sys_log_sec = (struct uci_section *)data;
dmuci_get_value_by_section_string(sys_log_sec, "log_size", value);
*value = (**value) ? *value : "0";
return 0;
}
int get_vlf_persistent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = "0";
return 0;
}
/*#Device.DeviceInfo.MemoryStatus.Total!UBUS:router.system/info//memoryKB.total*/
int get_memory_status_total(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value){
json_object *res;
dmubus_call("router.system", "info", UBUS_ARGS{{}}, 0, &res);
*value = dm_ubus_get_value(res, 2, "memoryKB", "total");
return 0;
}
/*#Device.DeviceInfo.MemoryStatus.Free!UBUS:router.system/info//memoryKB.free*/
int get_memory_status_free(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value){
json_object *res;
dmubus_call("router.system", "info", UBUS_ARGS{{}}, 0, &res);
*value = dm_ubus_get_value(res, 2, "memoryKB", "free");
return 0;
}
/*#Device.DeviceInfo.ProcessStatus.CPUUsage!UBUS:router.system/info//system.cpu_per*/
int get_process_cpu_usage(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value){
json_object *res;
dmubus_call("router.system", "info", UBUS_ARGS{{}}, 0, &res);
*value = dm_ubus_get_value(res, 2, "system", "cpu_per");
return 0;
}
int get_process_number_of_entries(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value){
json_object *res, *processes;
int nbre_process = 0;
dmubus_call("router.system", "processes", UBUS_ARGS{{}}, 0, &res);
processes = json_object_object_get(res, "processes");
nbre_process= json_object_array_length(processes);
dmasprintf(value,"%d",nbre_process);
return 0;
}
int get_process_pid(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value){
struct process_args *proc_args= (struct process_args*) data;
*value= proc_args->pid;
return 0;
}
int get_process_command(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value){
struct process_args *proc_args= (struct process_args*) data;
*value= proc_args->command;
return 0;
}
int get_process_size(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value){
struct process_args *proc_args= (struct process_args*) data;
if(proc_args->size!=NULL) *value= proc_args->size;
else *value= "0";
return 0;
}
int get_process_priority(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value){
struct process_args *proc_args= (struct process_args*) data;
long val;
if(proc_args->priority!=NULL) {
val = atol(proc_args->priority);
if(val<0) val=0;
dmasprintf(value, "%ld", val);
}
else *value= "0";
return 0;
}
int get_process_cpu_time(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value){
struct process_args *proc_args= (struct process_args*) data;
if(proc_args->cputime!=NULL) *value= proc_args->cputime;
return 0;
}
int get_process_state(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value){
struct process_args *proc_args= (struct process_args*) data;
if(strchr(proc_args->state, 'S')!=NULL) *value="Sleeping";
else if(strchr(proc_args->state, 'R')!=NULL) *value= "Running";
else if(strchr(proc_args->state, 'T')!=NULL) *value= "Stopped";
else if(strchr(proc_args->state, 'D')!=NULL) *value= "Uninterruptible";
else if(strchr(proc_args->state, 'Z')!=NULL) *value= "Zombie";
else *value= proc_args->state;
return 0;
}
int browsePocessEntriesInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance){
json_object *res, *processes, *fields, *process;
char *pid_field, *command_field, *state_field, *mem_size_field, *cpu_time_field, *priority_field, *pid, *command, *mem_size, *state, *cpu_time, *priority, *idx, *idx_last= NULL;
int i, id=0;
struct process_args proc_args={};
dmubus_call("router.system", "processes", UBUS_ARGS{{}}, 0, &res);
fields = json_object_object_get(res, "fields");
processes = json_object_object_get(res, "processes");
size_t nbre_process = json_object_array_length(processes);
pid_field = (char *)dmjson_get_value_in_array_idx(fields, 0, 0, NULL);
command_field = (char *)dmjson_get_value_in_array_idx(fields, 7, 0, NULL);
state_field = (char *)dmjson_get_value_in_array_idx(fields, 3, 0, NULL);
mem_size_field = (char *)dmjson_get_value_in_array_idx(fields, 4, 0, NULL);
priority_field = (char *)dmjson_get_value_in_array_idx(fields, 8, 0, NULL);
cpu_time_field = (char *)dmjson_get_value_in_array_idx(fields, 9, 0, NULL);
if(nbre_process>0){
for(i=0; i<nbre_process; i++){
process= json_object_array_get_idx(processes, i);
pid = dmjson_get_value(process, 1, pid_field);
command = dmjson_get_value(process, 1, command_field);
state = dmjson_get_value(process, 1, state_field);
mem_size= dmjson_get_value(process, 1, mem_size_field);
cpu_time= dmjson_get_value(process, 1, cpu_time_field);
priority= dmjson_get_value(process, 1, priority_field);
init_process_args(&proc_args, pid, command, mem_size, priority, cpu_time, state);
idx = handle_update_instance(2, dmctx, &idx_last, update_instance_without_section, 1, ++id);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&proc_args, idx) == DM_STOP)
break;
}
}
return 0;
}
int browseVcfInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *vcf = NULL, *vcf_last = NULL, *name;
struct uci_section *s = NULL, *del_sec = NULL;
DIR *dir;
struct dirent *d_file;
if ((dir = opendir (DEFAULT_CONFIG_DIR)) != NULL) {
while ((d_file = readdir (dir)) != NULL) {
if(d_file->d_name[0] == '.')
continue;
update_section_list(DMMAP,"vcf", "name", 1, d_file->d_name, NULL, NULL, "backup_restore", "1");
}
closedir (dir);
}
uci_path_foreach_sections(icwmpd, DMMAP, "vcf", s) {
dmuci_get_value_by_section_string(s, "name", &name);
if(del_sec) {
DMUCI_DELETE_BY_SECTION(icwmpd, del_sec, NULL, NULL);
del_sec = NULL;
}
if (check_file_dir(name) == 0) {
del_sec = s;
continue;
}
vcf = handle_update_instance(1, dmctx, &vcf_last, update_instance_alias_icwmpd, 3, s, "vcf_instance", "vcf_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, vcf) == DM_STOP)
break;
}
if(del_sec)
DMUCI_DELETE_BY_SECTION(icwmpd, del_sec, NULL, NULL);
return 0;
}
//Browse VendorLogFile instances
int browseVlfInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
struct uci_section *sys_log_sec, *s, *dm_sec, *del_sec=NULL;
char *instance, *last_instance, *log_file,*log_size, *add_value, *lfile;
int i=1, n=0;
uci_foreach_sections("system", "system", sys_log_sec) {
if(!sys_log_sec)
break;
dmuci_get_value_by_section_string(sys_log_sec, "log_file", &log_file);
dmuci_get_value_by_section_string(sys_log_sec, "log_size", &log_size);
uci_path_foreach_sections(icwmpd, "dmmap", "vlf", dm_sec) {
if(dm_sec)
break;
}
if(!dm_sec){
update_section_list(DMMAP,"vlf", NULL, i++, NULL, "log_file", log_file, "log_size", log_size);
}
else{
DMUCI_SET_VALUE_BY_SECTION(icwmpd, dm_sec, "log_file", log_file);
DMUCI_SET_VALUE_BY_SECTION(icwmpd, dm_sec, "log_size", log_size);
}
}
uci_path_foreach_sections(icwmpd, "dmmap", "vlf", dm_sec) {
instance = handle_update_instance(1, dmctx, &last_instance, update_instance_alias_icwmpd, 3, dm_sec, "vlf_instance", "vlf_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)dm_sec, instance) == DM_STOP){
break;
}
}
return 0;
}

View file

@ -1,94 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2012-2014 PIVA SOFTWARE (www.pivasoftware.com)
* Author: Imen Bhiri <imen.bhiri@pivasoftware.com>
* Author: Feten Besbes <feten.besbes@pivasoftware.com>
* Author: Anis Ellouze <anis.ellouze@pivasoftware.com>
*/
#ifndef __DEVICE_INFO_H
#define __DEVICE_INFO_H
#include "dmcwmp.h"
#define UPTIME "/proc/uptime"
#define DEFAULT_CONFIG_DIR "/etc/config/"
extern DMLEAF tDeviceInfoParams[];
extern DMLEAF tCatTvParams[];
extern DMLEAF tVcfParams[];
extern DMLEAF tVlfParams[];
extern DMLEAF tMemoryStatusParams[];
extern DMLEAF tProcessStatusParams[];
extern DMOBJ tDeviceInfoObj[];
extern DMOBJ tProcessEntriesObj[];
extern DMLEAF tProcessEntrieParams[];
struct process_args{
char *pid;
char *command;
char* size;
char* priority;
char *cputime;
char *state;
};
char *get_deviceid_manufacturer();
char *get_deviceid_manufactureroui();
char *get_deviceid_productclass();
char *get_deviceid_serialnumber();
char *get_softwareversion();
int lookup_vcf_name(char *instance, char **value);
int browseVcfInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseVlfInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browsePocessEntriesInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int get_device_manufacturer(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_device_manufactureroui(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_device_routermodel(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_device_productclass(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_device_serialnumber(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_device_hardwareversion(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_device_softwareversion(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_device_info_uptime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_device_devicelog(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_device_specversion(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_device_provisioningcode(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_base_mac_addr(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_catv_enabled(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_device_memory_bank(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_catv_enabled(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_catv_optical_input_level(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_catv_rf_output_level(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_catv_temperature(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_catv_voltage(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_vcf_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_vcf_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_vcf_version(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_vcf_date(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_vcf_desc(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_vcf_backup_restore(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_vlf_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_vlf_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_vlf_max_size(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_vlf_persistent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_memory_status_total(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_memory_status_free(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_process_cpu_usage(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_process_number_of_entries(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_process_pid(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_process_command(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_process_size(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_process_priority(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_process_cpu_time(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_process_state(char* refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_device_provisioningcode(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_device_catvenabled(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_device_memory_bank(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_device_catvenabled(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_vcf_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_vlf_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
#endif

View file

@ -1,728 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2012-2014 PIVA SOFTWARE (www.pivasoftware.com)
* Author: Imen Bhiri <imen.bhiri@pivasoftware.com>
* Author: Feten Besbes <feten.besbes@pivasoftware.com>
*/
#include <ctype.h>
#include <uci.h>
#include <stdio.h>
#include <time.h>
#include "cwmp.h"
#include "dmmem.h"
#include "dmcwmp.h"
#include "dmuci.h"
#include "dmubus.h"
#include "dmcommon.h"
#include "managementserver.h"
#include "dmjson.h"
/*** ManagementServer. ***/
DMLEAF tManagementServerParams[] = {
/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification, linker*/
{"URL", &DMWRITE, DMT_STRING, get_management_server_url, set_management_server_url, NULL, NULL},
{"Username", &DMWRITE, DMT_STRING, get_management_server_username, set_management_server_username, NULL, NULL},
{"Password", &DMWRITE, DMT_STRING, get_empty, set_management_server_passwd, NULL, NULL},
{"ParameterKey", &DMREAD, DMT_STRING, get_management_server_key, NULL, &DMFINFRM, &DMNONE},
{"PeriodicInformEnable", &DMWRITE, DMT_BOOL, get_management_server_periodic_inform_enable, set_management_server_periodic_inform_enable, NULL, NULL},
{"PeriodicInformInterval", &DMWRITE, DMT_UNINT, get_management_server_periodic_inform_interval, set_management_server_periodic_inform_interval, NULL, NULL},
{"PeriodicInformTime", &DMWRITE, DMT_TIME, get_management_server_periodic_inform_time, set_management_server_periodic_inform_time, NULL, NULL},
{"ConnectionRequestURL", &DMREAD, DMT_STRING, get_management_server_connection_request_url, NULL, &DMFINFRM, &DMACTIVE},
{"ConnectionRequestUsername", &DMWRITE, DMT_STRING, get_management_server_connection_request_username, set_management_server_connection_request_username, NULL, NULL},
{"ConnectionRequestPassword", &DMWRITE, DMT_STRING, get_empty, set_management_server_connection_request_passwd, NULL, NULL},
{"HTTPCompressionSupported", &DMREAD, DMT_STRING, get_management_server_http_compression_supportted, NULL, NULL, NULL},
{"HTTPCompression", &DMWRITE, DMT_STRING, get_management_server_http_compression, set_management_server_http_compression, NULL, NULL},
{"LightweightNotificationProtocolsSupported", &DMREAD, DMT_STRING, get_lwn_protocol_supported, NULL, NULL, NULL},
{"LightweightNotificationProtocolsUsed", &DMWRITE, DMT_STRING, get_lwn_protocol_used, set_lwn_protocol_used, NULL, NULL},
{"UDPLightweightNotificationHost", &DMWRITE, DMT_STRING, get_lwn_host, set_lwn_host, NULL, NULL},
{"UDPLightweightNotificationPort", &DMWRITE, DMT_UNINT, get_lwn_port, set_lwn_port, NULL, NULL},
{"CWMPRetryMinimumWaitInterval", &DMWRITE, DMT_UNINT, get_management_server_retry_min_wait_interval, set_management_server_retry_min_wait_interval, NULL, NULL},
{"CWMPRetryIntervalMultiplier", &DMWRITE, DMT_UNINT, get_management_server_retry_interval_multiplier, set_management_server_retry_interval_multiplier, NULL, NULL},
{"AliasBasedAddressing", &DMREAD, DMT_BOOL, get_alias_based_addressing, NULL, &DMFINFRM, NULL},
{"InstanceMode", &DMWRITE, DMT_STRING, get_instance_mode, set_instance_mode, NULL, NULL},
#ifdef XMPP_ENABLE
{"ConnReqAllowedJabberIDs", &DMWRITE, DMT_STRING, get_management_server_conn_rep_allowed_jabber_id, set_management_server_conn_rep_allowed_jabber_id, NULL, NULL},
{"ConnReqJabberID", &DMREAD, DMT_STRING, get_management_server_conn_req_jabber_id, NULL, &DMFINFRM, &DMACTIVE},
{"ConnReqXMPPConnection", &DMWRITE, DMT_STRING, get_management_server_conn_req_xmpp_connection, set_management_server_conn_req_xmpp_connection, &DMFINFRM, NULL},
#endif
{"SupportedConnReqMethods", &DMREAD, DMT_STRING, get_management_server_supported_conn_req_methods, NULL, NULL, NULL},
{"UDPConnectionRequestAddress", &DMREAD, DMT_STRING, get_upd_cr_address, NULL, NULL, &DMACTIVE},
{"STUNEnable", &DMWRITE, DMT_BOOL, get_stun_enable, set_stun_enable, NULL, NULL},
{"STUNServerAddress", &DMWRITE, DMT_STRING, get_stun_server_address, set_stun_server_address, NULL, NULL},
{"STUNServerPort", &DMWRITE, DMT_UNINT, get_stun_server_port, set_stun_server_port, NULL, NULL},
{"STUNUsername", &DMWRITE, DMT_STRING, get_stun_username, set_stun_username, NULL, NULL},
{"STUNPassword", &DMWRITE, DMT_STRING, get_stun_password, set_stun_password, NULL, NULL},
{"STUNMaximumKeepAlivePeriod", &DMWRITE, DMT_INT, get_stun_maximum_keepalive_period, set_stun_maximum_keepalive_period, NULL, NULL},
{"STUNMinimumKeepAlivePeriod", &DMWRITE, DMT_UNINT, get_stun_minimum_keepalive_period, set_stun_minimum_keepalive_period, NULL, NULL},
{"NATDetected", &DMREAD, DMT_BOOL, get_nat_detected, NULL, NULL, NULL},
{0}
};
/*#Device.ManagementServer.URL!UCI:cwmp/cwmp,acs/url*/
int get_management_server_url(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
int i = 1;
char *dhcp = NULL, *pch = NULL, *spch = NULL;
char *url = NULL;
char *provisioning_value = NULL;
char package[64] = "", section[64] = "", option[64] = "";
dmuci_get_option_value_string("cwmp", "acs", "dhcp_discovery", &dhcp);
dmuci_get_option_value_string("cwmp", "acs", "url", &url);
dmuci_get_varstate_string("cwmp", "acs", "dhcp_url", &provisioning_value);
if ( ((dhcp && strcmp(dhcp, "enable") == 0 ) || ((url == NULL) || (url[0] == '\0'))) && ((provisioning_value != NULL) && (provisioning_value[0] != '\0')) )
{
*value = provisioning_value;
}
else if ((url != NULL) && (url[0] != '\0'))
*value = url;
else
*value = dmstrdup(DEFAULT_ACSURL);
return 0;
}
int set_management_server_url(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value("cwmp", "acs", "dhcp_discovery", "disable");
dmuci_set_value("cwmp", "acs", "url", value);
cwmp_set_end_session(END_SESSION_RELOAD);
return 0;
}
return 0;
}
/*#Device.ManagementServer.Username!UCI:cwmp/cwmp,acs/userid*/
int get_management_server_username(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string("cwmp", "acs", "userid", value);
return 0;
}
int set_management_server_username(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value("cwmp", "acs", "userid", value);
cwmp_set_end_session(END_SESSION_RELOAD);
return 0;
}
return 0;
}
/*#Device.ManagementServer.Password!UCI:cwmp/cwmp,acs/passwd*/
int set_management_server_passwd(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value("cwmp", "acs", "passwd", value);
cwmp_set_end_session(END_SESSION_RELOAD);
return 0;
}
return 0;
}
/*#Device.ManagementServer.ParameterKey!UCI:cwmp/cwmp,acs/ParameterKey*/
int get_management_server_key(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string("cwmp", "acs", "ParameterKey", value);
return 0;
}
/*#Device.ManagementServer.PeriodicInformEnable!UCI:cwmp/cwmp,acs/periodic_inform_enable*/
int get_management_server_periodic_inform_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string("cwmp", "acs", "periodic_inform_enable", value);
return 0;
}
int set_management_server_periodic_inform_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
bool b;
switch (action) {
case VALUECHECK:
if (string_to_bool(value, &b))
return FAULT_9007;
return 0;
case VALUESET:
string_to_bool(value, &b);
if (b)
dmuci_set_value("cwmp", "acs", "periodic_inform_enable", "1");
else
dmuci_set_value("cwmp", "acs", "periodic_inform_enable", "0");
cwmp_set_end_session(END_SESSION_RELOAD);
return 0;
}
return 0;
}
/*#Device.ManagementServer.PeriodicInformInterval!UCI:cwmp/cwmp,acs/periodic_inform_interval*/
int get_management_server_periodic_inform_interval(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string("cwmp", "acs", "periodic_inform_interval", value);
return 0;
}
int set_management_server_periodic_inform_interval(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value("cwmp", "acs", "periodic_inform_interval", value);
cwmp_set_end_session(END_SESSION_RELOAD);
return 0;
}
return 0;
}
/*#Device.ManagementServer.PeriodicInformTime!UCI:cwmp/cwmp,acs/periodic_inform_time*/
int get_management_server_periodic_inform_time(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
time_t time_value;
dmuci_get_option_value_string("cwmp", "acs", "periodic_inform_time", value);
if ((*value)[0] != '0' && (*value)[0] != '\0') {
time_value = atoi(*value);
char s_now[sizeof "AAAA-MM-JJTHH:MM:SS.000Z"];
strftime(s_now, sizeof s_now, "%Y-%m-%dT%H:%M:%S.000Z", localtime(&time_value));
*value = dmstrdup(s_now); // MEM WILL BE FREED IN DMMEMCLEAN
}
else {
*value = "0001-01-01T00:00:00Z";
}
return 0;
}
int set_management_server_periodic_inform_time(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct tm tm;
char *p, buf[16];
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
if (!(strptime(value, "%Y-%m-%dT%H:%M:%S", &tm))) {
return 0;
}
sprintf(buf, "%ld", mktime(&tm));
dmuci_set_value("cwmp", "acs", "periodic_inform_time", buf);
cwmp_set_end_session(END_SESSION_RELOAD);
return 0;
}
return 0;
}
/*#Device.ManagementServer.ConnectionRequestURL!UCI:cwmp/cwmp,cpe/port*/
int get_management_server_connection_request_url(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char *ip, *port, *iface;
*value = "";
dmuci_get_option_value_string("cwmp", "cpe", "default_wan_interface", &iface);
network_get_ipaddr(&ip, iface);
dmuci_get_option_value_string("cwmp", "cpe", "port", &port);
if (ip[0] != '\0' && port[0] != '\0') {
char buf[64];
sprintf(buf,"http://%s:%s/", ip, port);
*value = dmstrdup(buf); // MEM WILL BE FREED IN DMMEMCLEAN
}
return 0;
}
/*#Device.ManagementServer.ConnectionRequestUsername!UCI:cwmp/cwmp,cpe/userid*/
int get_management_server_connection_request_username(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string("cwmp", "cpe", "userid", value);
return 0;
}
int set_management_server_connection_request_username(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value("cwmp", "cpe", "userid", value);
cwmp_set_end_session(END_SESSION_RELOAD);
return 0;
}
return 0;
}
/*#Device.ManagementServer.ConnectionRequestPassword!UCI:cwmp/cwmp,cpe/passwd*/
int set_management_server_connection_request_passwd(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value("cwmp", "cpe", "passwd", value);
cwmp_set_end_session(END_SESSION_RELOAD);
return 0;
}
return 0;
}
int get_lwn_protocol_supported(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = "UDP";
return 0;
}
/*#Device.ManagementServer.LightweightNotificationProtocolsUsed!UCI:cwmp/cwmp,lwn/enable*/
int get_lwn_protocol_used(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
bool b;
char *tmp;
dmuci_get_option_value_string("cwmp", "lwn", "enable", &tmp);
string_to_bool(tmp, &b);
if (b)
*value = "UDP";
else
*value = "";
return 0;
}
int set_lwn_protocol_used(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
if (strcmp(value,"UDP") ==0) {
dmuci_set_value("cwmp", "lwn", "enable", "1");
cwmp_set_end_session(END_SESSION_RELOAD);
}
else {
dmuci_set_value("cwmp", "lwn", "enable", "0");
cwmp_set_end_session(END_SESSION_RELOAD);
}
return 0;
}
return 0;
}
/*#Device.ManagementServer.UDPLightweightNotificationHost!UCI:cwmp/cwmp,lwn/hostname*/
int get_lwn_host(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string("cwmp", "lwn", "hostname", value);
return 0;
}
int set_lwn_host(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value("cwmp", "lwn", "hostname", value);
cwmp_set_end_session(END_SESSION_RELOAD);
return 0;
}
return 0;
}
/*#Device.ManagementServer.UDPLightweightNotificationPort!UCI:cwmp/cwmp,lwn/port*/
int get_lwn_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string("cwmp", "lwn", "port", value);
return 0;
}
int set_lwn_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value("cwmp", "lwn", "port", value);
cwmp_set_end_session(END_SESSION_RELOAD);
return 0;
}
return 0;
}
int get_management_server_http_compression_supportted(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = "GZIP,Deflate";
return 0;
}
/*#Device.ManagementServer.HTTPCompression!UCI:cwmp/cwmp,acs/compression*/
int get_management_server_http_compression(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string("cwmp", "acs", "compression", value);
return 0;
}
int set_management_server_http_compression(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
if (0 == strcasecmp(value, "gzip") || 0 == strcasecmp(value, "deflate") || 0 == strncasecmp(value, "disable", 7)) {
return 0;
}
return FAULT_9007;
case VALUESET:
dmuci_set_value("cwmp", "acs", "compression", value);
cwmp_set_end_session(END_SESSION_RELOAD);
return 0;
}
return 0;
}
/*#Device.ManagementServer.CWMPRetryMinimumWaitInterval!UCI:cwmp/cwmp,acs/retry_min_wait_interval*/
int get_management_server_retry_min_wait_interval(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string("cwmp", "acs", "retry_min_wait_interval", value);
return 0;
}
int set_management_server_retry_min_wait_interval(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
int a;
switch (action) {
case VALUECHECK:
a = atoi(value);
if (a <= 65535 && a >= 1) {
return 0;
}
return FAULT_9007;
case VALUESET:
dmuci_set_value("cwmp", "acs", "retry_min_wait_interval", value);
cwmp_set_end_session(END_SESSION_RELOAD);
return 0;
}
return 0;
}
/*#Device.ManagementServer.CWMPRetryIntervalMultiplier!UCI:cwmp/cwmp,acs/retry_interval_multiplier*/
int get_management_server_retry_interval_multiplier(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string("cwmp", "acs", "retry_interval_multiplier", value);
return 0;
}
int set_management_server_retry_interval_multiplier(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
int a;
switch (action) {
case VALUECHECK:
a = atoi(value);
if (a <= 65535 && a >= 1000) {
return 0;
}
return FAULT_9007;
case VALUESET:
dmuci_set_value("cwmp", "acs", "retry_interval_multiplier", value);
cwmp_set_end_session(END_SESSION_RELOAD);
return 0;
}
return 0;
}
/*#Device.ManagementServer.AliasBasedAddressing!UCI:cwmp/cwmp,cpe/amd_version*/
int get_alias_based_addressing(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string("cwmp", "cpe", "amd_version", value);
if((*value)[0] == '\0'|| atoi(*value) <= AMD_4) {
*value = "false";
}
else {
*value = "true";
}
return 0;
}
/*#Device.ManagementServer.InstanceMode!UCI:cwmp/cwmp,cpe/instance_mode*/
int get_instance_mode(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string("cwmp", "cpe", "instance_mode", value);
return 0;
}
int set_instance_mode(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
if (0 == strcmp(value, "InstanceNumber") || 0 == strcmp(value, "InstanceAlias") ) {
return 0;
}
return FAULT_9007;
case VALUESET:
dmuci_set_value("cwmp", "cpe", "instance_mode", value);
cwmp_set_end_session(END_SESSION_RELOAD);
return 0;
}
return 0;
}
/*
* STUN parameters
*/
/*#Device.ManagementServer.UDPConnectionRequestAddress!UCI:cwmp_stun/stun,stun/crudp_address*/
int get_upd_cr_address(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value){
dmuci_get_varstate_string("cwmp_stun", "stun", "crudp_address", value);
return 0;
}
int get_stun_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value){
char *path = "/etc/rc.d/*icwmp_stund";
if (check_file(path))
*value = "1";
else
*value = "0";
return 0;
}
int set_stun_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action){
bool b;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
string_to_bool(value, &b);
if(b) {
DMCMD("/etc/rc.common", 2, "/etc/init.d/icwmp_stund", "enable");
DMCMD("/etc/rc.common", 2, "/etc/init.d/icwmp_stund", "start");
}
else {
DMCMD("/etc/rc.common", 2, "/etc/init.d/icwmp_stund", "disable");
DMCMD("/etc/rc.common", 2, "/etc/init.d/icwmp_stund", "stop");
}
return 0;
}
return 0;
}
/*#Device.ManagementServer.STUNServerAddress!UCI:cwmp_stun/stun,stun/server_address*/
int get_stun_server_address(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value){
dmuci_get_option_value_string("cwmp_stun", "stun", "server_address", value);
return 0;
}
int set_stun_server_address(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action){
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value("cwmp_stun", "stun", "server_address", value);
return 0;
}
return 0;
}
/*#Device.ManagementServer.STUNServerPort!UCI:cwmp_stun/stun,stun/server_port*/
int get_stun_server_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value){
dmuci_get_option_value_string("cwmp_stun", "stun", "server_port", value);
return 0;
}
int set_stun_server_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action){
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value("cwmp_stun", "stun", "server_port", value);
return 0;
}
return 0;
}
/*#Device.ManagementServer.STUNUsername!UCI:cwmp_stun/stun,stun/username*/
int get_stun_username(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value){
dmuci_get_option_value_string("cwmp_stun", "stun", "username", value);
return 0;
}
int set_stun_username(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action){
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value("cwmp_stun", "stun", "username", value);
return 0;
}
return 0;
}
/*#Device.ManagementServer.STUNPassword!UCI:cwmp_stun/stun,stun/password*/
int get_stun_password(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value){
dmuci_get_option_value_string("cwmp_stun", "stun", "password", value);
return 0;
}
int set_stun_password(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action){
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value("cwmp_stun", "stun", "password", value);
return 0;
}
return 0;
}
/*#Device.ManagementServer.STUNMaximumKeepAlivePeriod!UCI:cwmp_stun/stun,stun/max_keepalive*/
int get_stun_maximum_keepalive_period(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value){
dmuci_get_option_value_string("cwmp_stun", "stun", "max_keepalive", value);
return 0;
}
int set_stun_maximum_keepalive_period(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action){
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value("cwmp_stun", "stun", "max_keepalive", value);
return 0;
}
return 0;
}
/*#Device.ManagementServer.STUNMinimumKeepAlivePeriod!UCI:cwmp_stun/stun,stun/min_keepalive*/
int get_stun_minimum_keepalive_period(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value){
dmuci_get_option_value_string("cwmp_stun", "stun", "min_keepalive", value);
return 0;
}
int set_stun_minimum_keepalive_period(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action){
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value("cwmp_stun", "stun", "min_keepalive", value);
return 0;
}
return 0;
}
/*#Device.ManagementServer.NATDetected!UCI:cwmp_stun/stun,stun/nat_detected*/
int get_nat_detected(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value){
char *path = "/etc/rc.d/*icwmp_stund";
char *v;
if (check_file(path)) { //stun is enabled
dmuci_get_varstate_string("cwmp_stun", "stun", "nat_detected", &v);
*value = (*v == '1') ? "true" : "false";
}
else {
*value = "false";
}
return 0;
}
/*
* XMPP parameters
*/
/*#Device.ManagementServer.ConnReqAllowedJabberIDs!UCI:cwmp_xmpp/cwmp,xmpp/allowed_jid*/
int get_management_server_conn_rep_allowed_jabber_id(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string("cwmp_xmpp", "xmpp", "allowed_jid", value);
return 0;
}
int set_management_server_conn_rep_allowed_jabber_id(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value("cwmp_xmpp", "xmpp", "allowed_jid", value);
return 0;
}
return 0;
}
int get_management_server_conn_req_jabber_id(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *s;
char *username, *domain, *resource, *tmpPtr, *strResponse = "";
*value = "";
uci_foreach_sections("cwmp_xmpp", "xmpp_connection", s) {
dmuci_get_value_by_section_string(s, "username", &username);
dmuci_get_value_by_section_string(s, "domain", &domain);
dmuci_get_value_by_section_string(s, "resource", &resource);
if(*username != '\0' || *domain != '\0' || *resource != '\0') {
if(*strResponse == '\0')
dmasprintf(&strResponse, "%s@%s/%s", username, domain, resource);
else {
tmpPtr = dmstrdup(strResponse);
dmasprintf(&strResponse, "%s, %s@%s/%s", tmpPtr, username, domain, resource);
}
}
}
*value = dmstrdup(strResponse);
return 0;
}
int get_management_server_conn_req_xmpp_connection(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char *id, *datamodel;
dmuci_get_option_value_string("cwmp_xmpp", "xmpp", "id", &id);
dmuci_get_option_value_string("cwmp", "cpe", "datamodel", &datamodel);
if(strcmp(datamodel, "tr181") == 0)
dmasprintf(value, "Device.XMPP.Connection.%s", id);
else
dmasprintf(value, "InternetGatewayDevice.XMPP.Connection.%s", id);
return 0;
}
int set_management_server_conn_req_xmpp_connection(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
char *datamodel, *str, *connection_instance;
struct uci_section *s = NULL;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_get_option_value_string("cwmp", "cpe", "datamodel", &datamodel);
if(strcmp(datamodel, "tr181") == 0) {
if (str = strstr(value, "Device.XMPP.Connection.")) {
value = dmstrdup(str + sizeof("Device.XMPP.Connection.") - 1); //MEM WILL BE FREED IN DMMEMCLEAN
}
}
else {
if (str = strstr(value, "InternetGatewayDevice.XMPP.Connection.")) {
value = dmstrdup(str + sizeof("InternetGatewayDevice.XMPP.Connection.") - 1); //MEM WILL BE FREED IN DMMEMCLEAN
}
}
uci_foreach_sections("cwmp_xmpp", "xmpp_connection", s) {
dmuci_get_value_by_section_string(s, "connection_instance", &connection_instance);
if(strcmp(value, connection_instance) == 0) {
dmuci_set_value("cwmp_xmpp", "xmpp", "id", value);
break;
}
}
cwmp_set_end_session(END_SESSION_RELOAD);
return 0;
}
return 0;
}
int get_management_server_supported_conn_req_methods(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = "HTTP,XMPP,STUN";
return 0;
}

View file

@ -1,78 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2012-2014 PIVA SOFTWARE (www.pivasoftware.com)
* Author: Imen Bhiri <imen.bhiri@pivasoftware.com>
* Author: Feten Besbes <feten.besbes@pivasoftware.com>
*/
#ifndef __MANAGEMENT_SERVER_H
#define __MANAGEMENT_SERVER_H
#include "dmcwmp.h"
extern DMLEAF tManagementServerParams[];
int get_management_server_url(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_management_server_username(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_empty(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_management_server_key(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_management_server_periodic_inform_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_management_server_periodic_inform_interval(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_management_server_periodic_inform_time(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_management_server_connection_request_url(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_management_server_connection_request_username(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_management_server_http_compression_supportted(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_management_server_http_compression(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_lwn_protocol_supported(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_lwn_protocol_used(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_lwn_host(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_lwn_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_management_server_retry_min_wait_interval(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_management_server_retry_interval_multiplier(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_alias_based_addressing(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_instance_mode(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_management_server_conn_rep_allowed_jabber_id(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_management_server_conn_req_jabber_id(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_management_server_conn_req_xmpp_connection(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_management_server_supported_conn_req_methods(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_upd_cr_address(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_upd_cr_address_notification_limit(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_stun_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_stun_server_address(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_stun_server_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_stun_username(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_stun_password(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_stun_maximum_keepalive_period(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_stun_minimum_keepalive_period(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_nat_detected(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_management_server_url(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_management_server_username(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_management_server_passwd(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_management_server_periodic_inform_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_management_server_periodic_inform_interval(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_management_server_periodic_inform_time(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_management_server_connection_request_username(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_management_server_connection_request_passwd(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_management_server_http_compression(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_lwn_protocol_used(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_lwn_protocol_used(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_lwn_host(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_lwn_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_management_server_retry_min_wait_interval(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_management_server_retry_interval_multiplier(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_instance_mode(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_management_server_conn_rep_allowed_jabber_id(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_management_server_conn_req_xmpp_connection(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_upd_cr_address_notification_limit(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_stun_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_stun_server_address(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_stun_server_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_stun_username(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_stun_password(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_stun_maximum_keepalive_period(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_stun_minimum_keepalive_period(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
#endif

View file

@ -1,359 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2012-2016 PIVA SOFTWARE (www.pivasoftware.com)
* Author: Imen Bhiri <imen.bhiri@pivasoftware.com>
* Author: Anis Ellouze <anis.ellouze@pivasoftware.com>
*/
#include "dmuci.h"
#include "dmcwmp.h"
#include "root.h"
#include "deviceinfo.h"
#include "managementserver.h"
#include "times.h"
#include "upnp.h"
#include "voice_services.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"
#include "xmpp.h"
#include "x_iopsys_eu_owsd.h"
#include "x_iopsys_eu_dropbear.h"
#include "x_iopsys_eu_buttons.h"
#include "x_iopsys_eu_wifilife.h"
#include "ip.h"
#include "ethernet.h"
#include "bridging.h"
#include "wifi.h"
#include "wan.h"
#include "dhcp.h"
#include "hosts.h"
#include "nat.h"
#include "ppp.h"
#include "routing.h"
#include "userinterface.h"
#include "landevice.h"
#include "wandevice.h"
#include "ippingdiagnostics.h"
#include "lan_interfaces.h"
#include "layer_3_forwarding.h"
#include "x_iopsys_eu_wifi.h"
#include "layer_2_bridging.h"
#include "downloaddiagnostic.h"
#include "uploaddiagnostic.h"
#include "deviceconfig.h"
#include "firewall.h"
#include "dns.h"
#include "users.h"
#include "dsl.h"
#include "dhcpv6.h"
#include "interfacestack.h"
#include "qos.h"
#include "usb.h"
#ifdef UPNP_TR064
#include "upnp_deviceinfo.h"
#include "upnp_configuration.h"
#include "upnp_monitoring.h"
#endif
/* *** CWMP *** */
DMOBJ tEntry098Obj[] = {
/* OBJ, permission, addobj, delobj, browseinstobj, finform, NOTIFICATION, nextobj, leaf, linker*/
{(char *)&dmroot, &DMREAD, NULL, NULL, NULL, NULL, &DMFINFRM, &DMNONE, tRoot_098_Obj, NULL, NULL},
{0}
};
DMOBJ tEntry181Obj[] = {
/*OBJ, permission, addobj, delobj, browseinstobj, finform, NOTIFICATION, nextobj, leaf, linker*/
{(char *)&dmroot, &DMREAD, NULL, NULL, NULL, NULL, &DMFINFRM, &DMNONE, tRoot_181_Obj, tRoot_181_Params, NULL},
{0}
};
DMOBJ tRoot_098_Obj[] = {
/* OBJ permission, addobj, delobj, browseinstobj, finform, nextobj, leaf, notification, linker*/
{"DeviceInfo", &DMREAD, NULL, NULL, NULL, NULL, &DMFINFRM, &DMNONE,tDeviceInfoObj, tDeviceInfoParams, NULL},
{"ManagementServer", &DMREAD, NULL, NULL, NULL, NULL, &DMFINFRM, &DMNONE,NULL, tManagementServerParams, NULL},
{"Time", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE,NULL, tTimeParams, NULL},
{"UPnP", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE,tUPnPObj, NULL, NULL},
{"Services", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE,tServiceObj, NULL, NULL},
{CUSTOM_PREFIX"ICE", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE,NULL, tSe_IceParam, NULL},
{CUSTOM_PREFIX"IGMP", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE,NULL, tSe_IgmpParam, NULL},
{CUSTOM_PREFIX"IpAccCfg", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE,tSe_IpAccObj, NULL, NULL},
{CUSTOM_PREFIX"LoginCfg", &DMREAD, NULL, NULL, NULL, NULL,NULL, &DMNONE,NULL, tSe_LoginCfgParam, NULL},
{CUSTOM_PREFIX"PowerManagement", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE,NULL, tSe_PowerManagementParam, NULL},
{CUSTOM_PREFIX"SyslogCfg", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE,NULL, tSe_SyslogCfgParam, NULL},
{"SoftwareModules", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE,tSoftwareModulesObj, NULL, NULL},
{CUSTOM_PREFIX"Owsd", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE,XIopsysEuOwsdObj, XIopsysEuOwsdParams, NULL},
{CUSTOM_PREFIX"Dropbear", &DMWRITE, add_dropbear_instance, delete_dropbear_instance, NULL, browseXIopsysEuDropbear, NULL, &DMNONE, NULL, X_IOPSYS_EU_DropbearParams, NULL},
{CUSTOM_PREFIX"Buttons", &DMREAD, NULL, NULL, NULL, browseXIopsysEuButton, NULL, &DMNONE, NULL, X_IOPSYS_EU_ButtonParams, NULL},
{CUSTOM_PREFIX"WiFiLife", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE, X_IOPSYS_EU_WiFiLifeObj, X_IOPSYS_EU_WiFiLifeParams, NULL},
{"LANDevice", &DMWRITE, add_landevice, delete_landevice, NULL, browselandeviceInst, &DMFINFRM, &DMNONE,tLANDeviceObj, tLANDeviceParam, NULL},
{"WANDevice", &DMREAD, NULL, NULL, NULL, browsewandeviceInst, &DMFINFRM, &DMWANConnectionDevicenotif,tWANDeviceObj, tWANDeviceParam, NULL},
{"LANInterfaces", &DMREAD, NULL, NULL, check_laninterfaces, NULL, &DMFINFRM, &DMNONE,tLANInterfacesObj, tLANInterfacesParam, NULL},
{"IPPingDiagnostics", &DMREAD, NULL, NULL, NULL, NULL, &DMFINFRM, &DMNONE,NULL, tIPPingDiagnosticsParam, NULL},
{"Layer3Forwarding", &DMREAD, NULL, NULL, NULL, NULL, &DMFINFRM, &DMNONE,tLayer3ForwardingObj, tLayer3ForwardingParam, NULL},
{"Layer2Bridging", &DMREAD, NULL, NULL, NULL, NULL, &DMFINFRM, &DMNONE,tLayer2BridgingObj, NULL, NULL},
{CUSTOM_PREFIX"Wifi", &DMREAD, NULL, NULL, NULL, NULL, &DMFINFRM, &DMNONE,tsewifiObj, tsewifiParam, NULL},
{"DownloadDiagnostics", &DMREAD, NULL, NULL, NULL, NULL, &DMFINFRM, &DMNONE,NULL, tDownloadDiagnosticsParam, NULL},
{"UploadDiagnostics", &DMREAD, NULL, NULL, NULL, NULL, &DMFINFRM, &DMNONE,NULL, tUploadDiagnosticsParam, NULL},
{"DeviceConfig", &DMREAD, NULL, NULL, NULL, NULL, &DMFINFRM, &DMNONE,NULL, tDeviceConfigParam, NULL},
#ifdef XMPP_ENABLE
{"XMPP", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL,tXMPPObj, tXMPPParams, NULL},
#endif
{0}
};
DMLEAF tRoot_181_Params[] = {
/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification*/
{"InterfaceStackNumberOfEntries", &DMREAD, DMT_UNINT, get_Device_InterfaceStackNumberOfEntries, NULL, NULL, NULL},
{0}
};
DMOBJ tRoot_181_Obj[] = {
/* OBJ permission, addobj, delobj, browseinstobj, finform, nextobj, leaf, notification, linker*/
{"DeviceInfo", &DMREAD, NULL, NULL, NULL, NULL, &DMFINFRM, &DMNONE,tDeviceInfoObj, tDeviceInfoParams, NULL},
{"ManagementServer", &DMREAD, NULL, NULL, NULL, NULL, &DMFINFRM, &DMNONE,NULL, tManagementServerParams, NULL},
{"Time", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE,NULL, tTimeParams, NULL},
{"UPnP", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE,tUPnPObj, NULL, NULL},
{"Services", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE,tServiceObj, NULL, NULL},
{CUSTOM_PREFIX"ICE", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE,NULL, tSe_IceParam, NULL},
{CUSTOM_PREFIX"IGMP", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE,NULL, tSe_IgmpParam, NULL},
{CUSTOM_PREFIX"IpAccCfg", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE,tSe_IpAccObj, NULL, NULL},
{CUSTOM_PREFIX"LoginCfg", &DMREAD, NULL, NULL, NULL, NULL,NULL, &DMNONE,NULL, tSe_LoginCfgParam, NULL},
{CUSTOM_PREFIX"PowerManagement", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE,NULL, tSe_PowerManagementParam, NULL},
{CUSTOM_PREFIX"SyslogCfg", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE,NULL, tSe_SyslogCfgParam, NULL},
{"SoftwareModules", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE,tSoftwareModulesObj, NULL, NULL},
{CUSTOM_PREFIX"Owsd", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE,XIopsysEuOwsdObj, XIopsysEuOwsdParams, NULL},
{CUSTOM_PREFIX"Dropbear", &DMWRITE, add_dropbear_instance, delete_dropbear_instance, NULL, browseXIopsysEuDropbear, NULL, &DMNONE, NULL, X_IOPSYS_EU_DropbearParams, NULL},
{CUSTOM_PREFIX"Buttons", &DMREAD, NULL, NULL, NULL, browseXIopsysEuButton, NULL, &DMNONE, NULL, X_IOPSYS_EU_ButtonParams, NULL},
{CUSTOM_PREFIX"WiFiLife", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE, X_IOPSYS_EU_WiFiLifeObj, X_IOPSYS_EU_WiFiLifeParams, NULL},
{"Bridging",&DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tBridgingObj, tBridgingParams, NULL},
{"WiFi",&DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tWifiObj, tWifiParams, NULL},
{"IP",&DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tIPObj, tIPParams, NULL},
{"Ethernet", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tEthernetObj, tEthernetParams, NULL},
{"DSL",&DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tDSLObj, tDSLParams, NULL},
{"ATM",&DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tAtmObj, NULL, NULL},
{"PTM", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tPtmObj, NULL, NULL},
{"DHCPv4", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tDhcpv4Obj, tDHCPv4Params, NULL},
{"DHCPv6", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tDHCPv6Obj, tDHCPv6Params, NULL},
{"Hosts", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, thostsObj, thostsParam, NULL},
{"NAT", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tnatObj, tnatParam, NULL},
{"PPP", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tpppObj, tPPPParams, NULL},
{"Routing", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tRoutingObj, tRoutingParam, NULL},
{"UserInterface", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tUserInterfaceObj, NULL, NULL},
{"Firewall", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tFirewallObj, tFirewallParams, NULL},
{"DNS", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tDNSObj, tDNSParams, NULL},
{"Users", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tUsersObj, tUsersParams, NULL},
{"InterfaceStack", &DMREAD, NULL, NULL, NULL, browseInterfaceStackInst, NULL, NULL, NULL, tInterfaceStackParams, NULL},
{"USB", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tUSBObj, tUSBParams, NULL},
//{"QoS", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tQoSObj, tQoSParams, NULL},
#ifdef XMPP_ENABLE
{"XMPP", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL,tXMPPObj, tXMPPParams, NULL},
#endif
{0}
};
/*** UPNP ***/
#ifdef UPNP_TR064
DMOBJ tEntry098ObjUPNP[] = {
/* OBJ, permission, addobj, delobj, browseinstobj, finform, NOTIFICATION, nextobj, leaf, linker*/
{(char *)&dmroot, &DMREAD, NULL, NULL, NULL, NULL, &DMFINFRM, &DMNONE, tRoot098ObjUPNP, NULL, NULL},
{0}
};
DMOBJ tRoot098ObjUPNP[] = {
/* OBJ, permission, addobj, delobj, browseinstobj, finform, NOTIFICATION, nextobj, leaf, linker*/
{"BBF", &DMREAD, NULL, NULL, NULL, NULL, &DMFINFRM, &DMNONE, tRoot098ObjUPNPBBF, NULL, NULL},
{"UPnP", &DMREAD, NULL, NULL, NULL, NULL, &DMFINFRM, &DMNONE, tRoot098ObjUPNPDMROOT, NULL, NULL},
{0}
};
DMOBJ tRoot098ObjUPNPDMROOT[] = {
{"DM", &DMREAD, NULL, NULL, NULL, NULL, &DMFINFRM, &DMNONE, tRoot098ObjUPNPDM, NULL, NULL},
{0}
};
DMOBJ tRoot098ObjUPNPDM[] = {
{"DeviceInfo", &DMREAD, NULL, NULL, NULL, NULL, &DMFINFRM, &DMNONE,upnpDeviceInfoObj, upnpDeviceInfoParams, NULL},
{"Configuration", &DMREAD, NULL, NULL, NULL, NULL, &DMFINFRM, &DMNONE,upnpConfigurationObj, NULL, NULL},
{"Monitoring", &DMREAD, NULL, NULL, NULL, NULL, &DMFINFRM, &DMNONE,upnpMonitoringObj, upnpMonitoringParams, NULL},
{0}
};
DMOBJ tRoot098ObjUPNPBBF[] = {
/* OBJ permission, addobj, delobj, browseinstobj, finform, nextobj, leaf, notification, linker*/
{"DeviceInfo", &DMREAD, NULL, NULL, NULL, NULL, &DMFINFRM, &DMNONE,tDeviceInfoObj, tDeviceInfoParams, NULL},
{"ManagementServer", &DMREAD, NULL, NULL, NULL, NULL, &DMFINFRM, &DMNONE,NULL, tManagementServerParams, NULL},
{"Time", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE,NULL, tTimeParams, NULL},
{"UPnP", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE,tUPnPObj, NULL, NULL},
{"VoiceService", &DMREAD, NULL, NULL, NULL, browseVoiceServiceInst, NULL, NULL, tVoiceServiceObj, tVoiceServiceParam, NULL},
{CUSTOM_PREFIX"ICE", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE,NULL, tSe_IceParam, NULL},
{CUSTOM_PREFIX"IGMP", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE,NULL, tSe_IgmpParam, NULL},
{CUSTOM_PREFIX"IpAccCfg", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE,tSe_IpAccObj, NULL, NULL},
{CUSTOM_PREFIX"LoginCfg", &DMREAD, NULL, NULL, NULL, NULL,NULL, &DMNONE,NULL, tSe_LoginCfgParam, NULL},
{CUSTOM_PREFIX"PowerManagement", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE,NULL, tSe_PowerManagementParam, NULL},
{CUSTOM_PREFIX"SyslogCfg", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE,NULL, tSe_SyslogCfgParam, NULL},
{"SoftwareModules", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE,tSoftwareModulesObj, NULL, NULL},
{CUSTOM_PREFIX"Owsd", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE,XIopsysEuOwsdObj, XIopsysEuOwsdParams, NULL},
{CUSTOM_PREFIX"Dropbear", &DMWRITE, add_dropbear_instance, delete_dropbear_instance, NULL, browseXIopsysEuDropbear, NULL, &DMNONE, NULL, X_IOPSYS_EU_DropbearParams, NULL},
{CUSTOM_PREFIX"Buttons", &DMREAD, NULL, NULL, NULL, browseXIopsysEuButton, NULL, &DMNONE, NULL, X_IOPSYS_EU_ButtonParams, NULL},
{"LANDevice", &DMREAD, NULL, NULL, NULL, browselandeviceInst, &DMFINFRM, &DMNONE,tLANDeviceObj, tLANDeviceParam, NULL},
{"WANDevice", &DMREAD, NULL, NULL, NULL, browsewandeviceInst, &DMFINFRM, &DMWANConnectionDevicenotif,tWANDeviceObj, tWANDeviceParam, NULL},
{"LANInterfaces", &DMREAD, NULL, NULL, check_laninterfaces, NULL, &DMFINFRM, &DMNONE,tLANInterfacesObj, tLANInterfacesParam, NULL},
{"IPPingDiagnostics", &DMREAD, NULL, NULL, NULL, NULL, &DMFINFRM, &DMNONE,NULL, tIPPingDiagnosticsParam, NULL},
{"Layer3Forwarding", &DMREAD, NULL, NULL, NULL, NULL, &DMFINFRM, &DMNONE,tLayer3ForwardingObj, tLayer3ForwardingParam, NULL},
{"Layer2Bridging", &DMREAD, NULL, NULL, NULL, NULL, &DMFINFRM, &DMNONE,tLayer2BridgingObj, NULL, NULL},
{CUSTOM_PREFIX"Wifi", &DMREAD, NULL, NULL, NULL, NULL, &DMFINFRM, &DMNONE,tsewifiObj, NULL, NULL},
{"DownloadDiagnostics", &DMREAD, NULL, NULL, NULL, NULL, &DMFINFRM, &DMNONE,NULL, tDownloadDiagnosticsParam, NULL},
{"UploadDiagnostics", &DMREAD, NULL, NULL, NULL, NULL, &DMFINFRM, &DMNONE,NULL, tUploadDiagnosticsParam, NULL},
#ifdef XMPP_ENABLE
{"XMPP", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL,tXMPPObj, tXMPPParams, NULL},
#endif
{0}
};
DMOBJ tEntry181ObjUPNP[] = {
/* OBJ, permission, addobj, delobj, browseinstobj, finform, NOTIFICATION, nextobj, leaf, linker*/
{(char *)&dmroot, &DMREAD, NULL, NULL, NULL, NULL, &DMFINFRM, &DMNONE, tRoot181ObjUPNP, NULL, NULL},
{0}
};
DMOBJ tRoot181ObjUPNP[] = {
/* OBJ, permission, addobj, delobj, browseinstobj, finform, NOTIFICATION, nextobj, leaf, linker*/
{"BBF", &DMREAD, NULL, NULL, NULL, NULL, &DMFINFRM, &DMNONE, tRoot181ObjUPNPBBF, NULL, NULL},
{"UPnP", &DMREAD, NULL, NULL, NULL, NULL, &DMFINFRM, &DMNONE, tRoot181ObjUPNPDMROOT, NULL, NULL},
{0}
};
DMOBJ tRoot181ObjUPNPDMROOT[] = {
{"DM", &DMREAD, NULL, NULL, NULL, NULL, &DMFINFRM, &DMNONE, tRoot181ObjUPNPDM, NULL, NULL},
{0}
};
DMOBJ tRoot181ObjUPNPDM[] = {
{"DeviceInfo", &DMREAD, NULL, NULL, NULL, NULL, &DMFINFRM, &DMNONE,upnpDeviceInfoObj, upnpDeviceInfoParams, NULL},
{"Configuration", &DMREAD, NULL, NULL, NULL, NULL, &DMFINFRM, &DMNONE,upnpConfigurationObj, NULL, NULL},
{"Monitoring", &DMREAD, NULL, NULL, NULL, NULL, &DMFINFRM, &DMNONE,upnpMonitoringObj, upnpMonitoringParams, NULL},
{0}
};
DMOBJ tRoot181ObjUPNPBBF[] = {
/* OBJ permission, addobj, delobj, browseinstobj, finform, nextobj, leaf, notification, linker*/
{"DeviceInfo", &DMREAD, NULL, NULL, NULL, NULL, &DMFINFRM, &DMNONE,tDeviceInfoObj, tDeviceInfoParams, NULL},
{"ManagementServer", &DMREAD, NULL, NULL, NULL, NULL, &DMFINFRM, &DMNONE,NULL, tManagementServerParams, NULL},
{"Time", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE,NULL, tTimeParams, NULL},
{"UPnP", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE,tUPnPObj, NULL, NULL},
{"VoiceService", &DMREAD, NULL, NULL, NULL, browseVoiceServiceInst, NULL, NULL, tVoiceServiceObj, tVoiceServiceParam, NULL},
{CUSTOM_PREFIX"ICE", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE,NULL, tSe_IceParam, NULL},
{CUSTOM_PREFIX"IGMP", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE,NULL, tSe_IgmpParam, NULL},
{CUSTOM_PREFIX"IpAccCfg", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE,tSe_IpAccObj, NULL, NULL},
{CUSTOM_PREFIX"LoginCfg", &DMREAD, NULL, NULL, NULL, NULL,NULL, &DMNONE,NULL, tSe_LoginCfgParam, NULL},
{CUSTOM_PREFIX"PowerManagement", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE,NULL, tSe_PowerManagementParam, NULL},
{CUSTOM_PREFIX"SyslogCfg", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE,NULL, tSe_SyslogCfgParam, NULL},
{"SoftwareModules", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE,tSoftwareModulesObj, NULL, NULL},
{CUSTOM_PREFIX"Owsd", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE,XIopsysEuOwsdObj, XIopsysEuOwsdParams, NULL},
{CUSTOM_PREFIX"Dropbear", &DMWRITE, add_dropbear_instance, delete_dropbear_instance, NULL, browseXIopsysEuDropbear, NULL, &DMNONE, NULL, X_IOPSYS_EU_DropbearParams, NULL},
{CUSTOM_PREFIX"Buttons", &DMREAD, NULL, NULL, NULL, browseXIopsysEuButton, NULL, &DMNONE, NULL, X_IOPSYS_EU_ButtonParams, NULL},
{"Bridging",&DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tBridgingObj, NULL, NULL},
{"WiFi",&DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tWifiObj, NULL, NULL},
{"IP",&DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tIPObj, NULL, NULL},
{"Ethernet", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tEthernetObj, NULL, NULL},
{"DSL",&DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tDslObj, NULL, NULL},
{"ATM",&DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tAtmObj, NULL, NULL},
{"PTM", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tPtmObj, NULL, NULL},
{"DHCPv4", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tDhcpv4Obj, NULL, NULL},
{"Hosts", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, thostsObj, thostsParam, NULL},
{"NAT", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tnatObj, NULL, NULL},
{"PPP", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tpppObj, NULL, NULL},
{"Routing", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tRoutingObj, tRoutingParam, NULL},
#ifdef XMPP_ENABLE
{"XMPP", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL,tXMPPObj, tXMPPParams, NULL},
#endif
{0}
};
UPNP_SUPPORTED_DM tUPNPSupportedDM[];
UPNP_SUPPORTED_DM tUPNPSupportedDM_098[] = {
{"/UPnP/DM/DeviceInfo/", "urn:UPnP:Parent Device:1:ConfigurationManagement:2", DMROOT_URL_098, "UPnP DeviceInfo from "DMROOT_DESC_098, ""},
{"/UPnP/DM/Configuration/", "urn:UPnP:Parent Device:1:ConfigurationManagement:2", DMROOT_URL_098, "Configuration from "DMROOT_DESC_098, ""},
{"/UPnP/DM/Monitoring/", "urn:UPnP:Parent Device:1:ConfigurationManagement:2", DMROOT_URL_098, "Monitoring from "DMROOT_DESC_098, ""},
{"/BBF/DeviceInfo/", DMROOT_URI_098, DMROOT_URL_098, "DeviceInfo from "DMROOT_DESC_098, ""},
{"/BBF/ManagementServer/", DMROOT_URI_098, DMROOT_URL_098, "ManagementServer from "DMROOT_DESC_098, ""},
{"/BBF/Time/", DMROOT_URI_098, DMROOT_URL_098, "Time from "DMROOT_DESC_098, ""},
{"/BBF/UPnP/", DMROOT_URI_098, DMROOT_URL_098, "UPnP from "DMROOT_DESC_098, ""},
{"/BBF/VoiceService/", "urn:broadband-forum-org:wt-104-2-0-0", "https://www.broadband-forum.org/cwmp/tr-104-2-0-0.html", "TR-104 Voice:2 Service Object definition", ""},
{"/BBF/"CUSTOM_PREFIX"ICE/", "urn:intenogroup-com:na", "https://www.intenogroup.com/", "Inteno extension for ICE", ""},
{"/BBF/"CUSTOM_PREFIX"IGMP/", "urn:intenogroup-com:na", "https://www.intenogroup.com/", "Inteno extension for ICE", ""},
{"/BBF/"CUSTOM_PREFIX"IpAccCfg/", "urn:intenogroup-com:na", "https://www.intenogroup.com/", "Inteno extension for IGMP", ""},
{"/BBF/"CUSTOM_PREFIX"LoginCfg/", "urn:intenogroup-com:na", "https://www.intenogroup.com/", "Inteno extension for LoginCfg", ""},
{"/BBF/"CUSTOM_PREFIX"PowerManagement/", "urn:intenogroup-com:na", "https://www.intenogroup.com/", "Inteno extension for PowerManagement", ""},
{"/BBF/"CUSTOM_PREFIX"SyslogCfg/", "urn:intenogroup-com:na", "https://www.intenogroup.com/", "Inteno extension for SyslogCfg", ""},
{"/BBF/SoftwareModules/", DMROOT_URI_098, DMROOT_URL_098, "SoftwareModules from "DMROOT_DESC_098, ""},
{"/BBF/"CUSTOM_PREFIX"Owsd/", "urn:intenogroup-com:na", "https://www.intenogroup.com/", "Inteno extension for Owsd", ""},
{"/BBF/"CUSTOM_PREFIX"Dropbear/", "urn:intenogroup-com:na", "https://www.intenogroup.com/", "Inteno extension for Dropbear", ""},
{"/BBF/"CUSTOM_PREFIX"Buttons/", "urn:intenogroup-com:na", "https://www.intenogroup.com/", "Inteno extension for Buttons", ""},
{"/BBF/LANDevice/", DMROOT_URI_098, DMROOT_URL_098, "LANDevice from "DMROOT_DESC_098, ""},
{"/BBF/WANDevice/", DMROOT_URI_098, DMROOT_URL_098, "WANDevice from "DMROOT_DESC_098, ""},
{"/BBF/LANInterfaces/", DMROOT_URI_098, DMROOT_URL_098, "LANInterfaces from "DMROOT_DESC_098, ""},
{"/BBF/IPPingDiagnostics/", DMROOT_URI_098, DMROOT_URL_098, "IPPingDiagnostics from "DMROOT_DESC_098, ""},
{"/BBF/Layer3Forwarding/", DMROOT_URI_098, DMROOT_URL_098, "Layer3Forwarding from "DMROOT_DESC_098, ""},
{"/BBF/Layer2Bridging/", DMROOT_URI_098, DMROOT_URL_098, "Layer2Bridging from "DMROOT_DESC_098, ""},
{"/BBF/"CUSTOM_PREFIX"Wifi/", "urn:intenogroup-com:na", "https://www.intenogroup.com/", "Inteno extension for WiFi", ""},
{"/BBF/DownloadDiagnostics/", DMROOT_URI_098, DMROOT_URL_098, "DownloadDiagnostics from "DMROOT_DESC_098, ""},
{"/BBF/UploadDiagnostics/", DMROOT_URI_098, DMROOT_URL_098, "UploadDiagnostics from "DMROOT_DESC_098, ""},
#ifdef XMPP_ENABLE
{"/BBF/XMPP/", DMROOT_URI_098, DMROOT_URL_098, "XMPP from "DMROOT_DESC_098, ""},
#endif
{0}
};
UPNP_SUPPORTED_DM tUPNPSupportedDM_181[] = {
{"/UPnP/DM/DeviceInfo/", "urn:UPnP:Parent Device:1:ConfigurationManagement:2", DMROOT_URL_181, "UPnP DeviceInfo from "DMROOT_DESC_181, ""},
{"/UPnP/DM/Configuration/", "urn:UPnP:Parent Device:1:ConfigurationManagement:2", DMROOT_URL_181, "Configuration from "DMROOT_DESC_181, ""},
{"/UPnP/DM/Monitoring/", "urn:UPnP:Parent Device:1:ConfigurationManagement:2", DMROOT_URL_181, "Monitoring from "DMROOT_DESC_181, ""},
{"/BBF/DeviceInfo/", DMROOT_URI_181, DMROOT_URL_181, "DeviceInfo from "DMROOT_DESC_181, ""},
{"/BBF/ManagementServer/", DMROOT_URI_181, DMROOT_URL_181, "ManagementServer from "DMROOT_DESC_181, ""},
{"/BBF/Time/", DMROOT_URI_181, DMROOT_URL_181, "Time from "DMROOT_DESC_181, ""},
{"/BBF/UPnP/", DMROOT_URI_181, DMROOT_URL_181, "UPnP from "DMROOT_DESC_181, ""},
{"/BBF/VoiceService/", "urn:broadband-forum-org:wt-104-2-0-0", "https://www.broadband-forum.org/cwmp/tr-104-2-0-0.html", "TR-104 Voice:2 Service Object definition", ""},
{"/BBF/"CUSTOM_PREFIX"ICE/", "urn:intenogroup-com:na", "https://www.intenogroup.com/", "Inteno extension for ICE", ""},
{"/BBF/"CUSTOM_PREFIX"IGMP/", "urn:intenogroup-com:na", "https://www.intenogroup.com/", "Inteno extension for ICE", ""},
{"/BBF/"CUSTOM_PREFIX"IpAccCfg/", "urn:intenogroup-com:na", "https://www.intenogroup.com/", "Inteno extension for IGMP", ""},
{"/BBF/"CUSTOM_PREFIX"LoginCfg/", "urn:intenogroup-com:na", "https://www.intenogroup.com/", "Inteno extension for LoginCfg", ""},
{"/BBF/"CUSTOM_PREFIX"PowerManagement/", "urn:intenogroup-com:na", "https://www.intenogroup.com/", "Inteno extension for PowerManagement", ""},
{"/BBF/"CUSTOM_PREFIX"SyslogCfg/", "urn:intenogroup-com:na", "https://www.intenogroup.com/", "Inteno extension for SyslogCfg", ""},
{"/BBF/SoftwareModules/", DMROOT_URI_181, DMROOT_URL_181, "SoftwareModules from "DMROOT_DESC_181, ""},
{"/BBF/"CUSTOM_PREFIX"Owsd/", "urn:intenogroup-com:na", "https://www.intenogroup.com/", "Inteno extension for Owsd", ""},
{"/BBF/"CUSTOM_PREFIX"Dropbear/", "urn:intenogroup-com:na", "https://www.intenogroup.com/", "Inteno extension for Dropbear", ""},
{"/BBF/"CUSTOM_PREFIX"Buttons/", "urn:intenogroup-com:na", "https://www.intenogroup.com/", "Inteno extension for Buttons", ""},
{"/BBF/Bridging/", DMROOT_URI_181, DMROOT_URL_181, "Bridging from "DMROOT_DESC_181, ""},
{"/BBF/WiFi/", DMROOT_URI_181, DMROOT_URL_181, "WiFi from "DMROOT_DESC_181, ""},
{"/BBF/IP/", DMROOT_URI_181, DMROOT_URL_181, "IP from "DMROOT_DESC_181, ""},
{"/BBF/Ethernet/", DMROOT_URI_181, DMROOT_URL_181, "Ethernet from "DMROOT_DESC_181, ""},
{"/BBF/DSL/", DMROOT_URI_181, DMROOT_URL_181, "DSL from "DMROOT_DESC_181, ""},
{"/BBF/ATM/", DMROOT_URI_181, DMROOT_URL_181, "ATM from "DMROOT_DESC_181, ""},
{"/BBF/PTM/", DMROOT_URI_181, DMROOT_URL_181, "PTM from "DMROOT_DESC_181, ""},
{"/BBF/DHCPv4/", DMROOT_URI_181, DMROOT_URL_181, "DHCPv4 from "DMROOT_DESC_181, ""},
{"/BBF/Hosts/", DMROOT_URI_181, DMROOT_URL_181, "Hosts from "DMROOT_DESC_181, ""},
{"/BBF/NAT/", DMROOT_URI_181, DMROOT_URL_181, "NAT from "DMROOT_DESC_181, ""},
{"/BBF/PPP/", DMROOT_URI_181, DMROOT_URL_181, "PPP from "DMROOT_DESC_181, ""},
{"/BBF/Routing/", DMROOT_URI_181, DMROOT_URL_181, "Routing from "DMROOT_DESC_181, ""},
#ifdef XMPP_ENABLE
{"/BBF/XMPP/", DMROOT_URI_181, DMROOT_URL_181, "XMPP from "DMROOT_DESC_181, ""},
#endif
{0}
};
size_t tr98_size = sizeof(tUPNPSupportedDM_098);
size_t tr181_size = sizeof(tUPNPSupportedDM_181);
#endif

View file

@ -1,53 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2015 Inteno Broadband Technology AB
* Author MOHAMED Kallel <mohamed.kallel@pivasoftware.com>
* Author Imen Bhiri <imen.bhiri@pivasoftware.com>
* Author Feten Besbes <feten.besbes@pivasoftware.com>
*
*/
#ifndef __ROOT_H
#define __ROOT_H
#include "dmcwmp.h"
extern DMOBJ tEntry098Obj[];
extern DMOBJ tEntry181Obj[];
extern DMOBJ tRoot_098_Obj[];
extern DMOBJ tRoot_181_Obj[];
extern DMLEAF tRoot_181_Params[];
#ifdef UPNP_TR064
extern DMOBJ tEntry098ObjUPNP[];
extern DMOBJ tRoot098ObjUPNP[];
extern DMOBJ tRoot098ObjUPNPDMROOT[];
extern DMOBJ tRoot098ObjUPNPDM[];
extern DMOBJ tRoot098ObjUPNPBBF[];
extern DMOBJ tEntry181ObjUPNP[];
extern DMOBJ tRoot181ObjUPNP[];
extern DMOBJ tRoot181ObjUPNPDMROOT[];
extern DMOBJ tRoot181ObjUPNPDM[];
extern DMOBJ tRoot181ObjUPNPBBF[];
extern UPNP_SUPPORTED_DM tUPNPSupportedDM[];
extern UPNP_SUPPORTED_DM tUPNPSupportedDM_098[];
extern UPNP_SUPPORTED_DM tUPNPSupportedDM_181[];
extern size_t tr98_size;
extern size_t tr181_size;
#define UPNP_SUPPORTED_PARAMETERS_VERSION 1 //Should be incremented each time the Parameters are updated
#define UPNP_SUPPORTED_DATAMODEL_VERSION 1 //Should be incremented each time the tUPNPSupportedDM array is updated
#endif
#define DMROOT_URI_098 "urn:broadband-forum-org:tr-098-1-8-0"
#define DMROOT_URL_098 "https://www.broadband-forum.org/cwmp/tr-098-1-8-0.html"
#define DMROOT_DESC_098 "TR-098 InternetGatewayDevice:1 Root Object definition"
#define DMROOT_URI_181 "urn:broadband-forum-org:tr-181-2-11-0"
#define DMROOT_URL_181 "https://www.broadband-forum.org/cwmp/tr-181-2-11-0.html"
#define DMROOT_DESC_181 "TR-181 Device:2 Root Object definition"
#endif

View file

@ -1,249 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2012-2014 PIVA SOFTWARE (www.pivasoftware.com)
* Author: Imen Bhiri <imen.bhiri@pivasoftware.com>
* Author: Feten Besbes <feten.besbes@pivasoftware.com>
*/
#include <ctype.h>
#include <uci.h>
#include <stdio.h>
#include "dmcwmp.h"
#include "dmuci.h"
#include "dmubus.h"
#include "dmcommon.h"
#include "softwaremodules.h"
/*** SoftwareModules. ***/
DMOBJ tSoftwareModulesObj[] = {
/* OBJ, permission, addobj, delobj, browseinstobj, finform, notification, nextobj, leaf*/
{"DeploymentUnit", &DMREAD, NULL, NULL, NULL, browsesoftwaremodules_deploymentunitInst, NULL, NULL, NULL, tDeploymentUnitParams, NULL},
{0}
};
DMLEAF tDeploymentUnitParams[] = {
/* PARAM, permission, type, getvlue, setvalue, forced_inform, notification*/
{"UUID", &DMREAD, DMT_STRING, get_deploymentunit_uuid, NULL, NULL, NULL},
{"Name", &DMREAD, DMT_STRING, get_deploymentunit_name, NULL, NULL, NULL},
{"Resolved", &DMREAD, DMT_BOOL, get_deploymentunit_resolved, NULL, NULL, NULL},
{"URL", &DMREAD, DMT_STRING, get_deploymentunit_url, NULL, NULL, NULL},
{"Vendor", &DMREAD, DMT_STRING, get_deploymentunit_vendor, NULL, NULL, NULL},
{"Version", &DMREAD, DMT_STRING, get_deploymentunit_version, NULL, NULL, NULL},
{"ExecutionEnvRef", &DMREAD, DMT_STRING, get_deploymentunit_execution_env_ref, NULL, NULL, NULL},
{0}
};
int get_deploymentunit_uuid(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *softsection = (struct uci_section *)data;
dmuci_get_value_by_section_string(softsection, "uuid", value);
return 0;
}
int get_deploymentunit_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *softsection = (struct uci_section *)data;
dmuci_get_value_by_section_string(softsection, "name", value);
return 0;
}
int get_deploymentunit_resolved(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *softsection = (struct uci_section *)data;
dmuci_get_value_by_section_string(softsection, "resolved", value);
return 0;
}
int get_deploymentunit_url(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *softsection = (struct uci_section *)data;
dmuci_get_value_by_section_string(softsection, "url", value);
return 0;
}
int get_deploymentunit_vendor(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *softsection = (struct uci_section *)data;
dmuci_get_value_by_section_string(softsection, "vendor", value);
return 0;
}
int get_deploymentunit_version(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *softsection = (struct uci_section *)data;
dmuci_get_value_by_section_string(softsection, "version", value);
return 0;
}
int get_deploymentunit_execution_env_ref(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *softsection = (struct uci_section *)data;
dmuci_get_value_by_section_string(softsection, "execution_env_ref", value);
return 0;
}
char *add_softwaremodules_deploymentunit(char *uuid, char*url, char *username, char *password, char *name, char *version)
{
char *value;
char *instance;
struct uci_section *deploymentsection = NULL;
char duname[16];
uci_path_foreach_option_eq(icwmpd, "dmmap", "deploymentunit", "UUID", uuid, deploymentsection) {
DMUCI_SET_VALUE_BY_SECTION(icwmpd, deploymentsection, "URL", url);
DMUCI_SET_VALUE_BY_SECTION(icwmpd,deploymentsection, "URL", url);
DMUCI_SET_VALUE_BY_SECTION(icwmpd,deploymentsection, "Name", name);
DMUCI_SET_VALUE_BY_SECTION(icwmpd,deploymentsection, "Version", version);
DMUCI_SET_VALUE_BY_SECTION(icwmpd,deploymentsection, "username", username);
DMUCI_SET_VALUE_BY_SECTION(icwmpd,deploymentsection, "password", password);
DMUCI_SET_VALUE_BY_SECTION(icwmpd,deploymentsection, "Resolved", "1");
dmuci_get_value_by_section_string(deploymentsection, "duinstance", &instance);
goto end;
}
instance = get_last_instance(DMMAP, "deploymentunit", "duinstance");
if (!instance)
sprintf(duname, "du%d", 0);
else
sprintf(duname, "du%s", instance);
DMUCI_SET_VALUE(icwmpd, "dmmap", duname, NULL, "deploymentunit");
DMUCI_SET_VALUE(icwmpd, "dmmap", duname, "UUID", uuid);
DMUCI_SET_VALUE(icwmpd, "dmmap", duname, "URL", url);
DMUCI_SET_VALUE(icwmpd, "dmmap", duname, "Name", name);
DMUCI_SET_VALUE(icwmpd, "dmmap", duname, "Version", version);
DMUCI_SET_VALUE(icwmpd, "dmmap", duname, "username", username);
DMUCI_SET_VALUE(icwmpd, "dmmap", duname, "password", password);
DMUCI_SET_VALUE(icwmpd, "dmmap", duname, "Resolved", "1");
instance = get_last_instance(DMMAP, "deploymentunit", "duinstance");
return instance;
end:
return instance;
}
int update_softwaremodules_url(char *uuid, char *url)
{
struct uci_section *s = NULL;
uci_path_foreach_option_eq(icwmpd, "dmmap", "deploymentunit", "UUID", uuid, s) {
DMUCI_SET_VALUE_BY_SECTION(icwmpd, s, "URL", url);
return 1;
}
return 0;
}
char *get_softwaremodules_uuid(char *url)
{
char *uuid;
struct uci_section *s = NULL;
uci_path_foreach_option_eq(icwmpd, "dmmap", "deploymentunit", "url", url, s) {
dmuci_get_value_by_section_string(s, "UUID", &uuid);
return uuid;
}
return "";
}
char *get_softwaremodules_url(char *uuid)
{
char *url;
struct uci_section *s = NULL;
uci_path_foreach_option_eq(icwmpd, "dmmap", "deploymentunit", "uuid", uuid, s) {
dmuci_get_value_by_section_string(s, "URL", &url);
return url;
}
return "";
}
char *get_softwaremodules_username(char *uuid)
{
char *url;
struct uci_section *s = NULL;
uci_path_foreach_option_eq(icwmpd, "dmmap", "deploymentunit", "uuid", uuid, s) {
dmuci_get_value_by_section_string(s, "username", &url);
return url;
}
return "";
}
char *get_softwaremodules_pass(char *uuid)
{
char *url;
struct uci_section *s = NULL;
uci_path_foreach_option_eq(icwmpd, "dmmap", "deploymentunit", "uuid", uuid, s) {
dmuci_get_value_by_section_string(s, "password", &url);
return url;
}
return "";
}
char *get_softwaremodules_instance(char *uuid)
{
char *url;
struct uci_section *s = NULL;
uci_path_foreach_option_eq(icwmpd, "dmmap", "deploymentunit", "uuid", uuid, s) {
dmuci_get_value_by_section_string(s, "duinstance", &url);
return url;
}
return "";
}
char *get_softwaremodules_name(char *uuid)
{
char *name;
struct uci_section *s = NULL;
uci_path_foreach_option_eq(icwmpd, "dmmap", "deploymentunit", "uuid", uuid, s) {
dmuci_get_value_by_section_string(s, "Name", &name);
return name;
}
return "";
}
char *get_softwaremodules_version(char *uuid)
{
char *version;
struct uci_section *s = NULL;
uci_path_foreach_option_eq(icwmpd, "dmmap", "deploymentunit", "uuid", uuid, s) {
dmuci_get_value_by_section_string(s, "Version", &version);
return version;
}
return "";
}
int browsesoftwaremodules_deploymentunitInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *idu = NULL, *idu_last = NULL;
char *permission = "1";
struct uci_section *s = NULL;
uci_path_foreach_sections(icwmpd, "dmmap", "deploymentunit", s) {
idu = handle_update_instance(1, dmctx, &idu_last, update_instance_alias_icwmpd, 3, s, "duinstance", "duinstance_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, idu) == DM_STOP)
break;
}
return 0;
}

View file

@ -1,34 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2012-2014 PIVA SOFTWARE (www.pivasoftware.com)
* Author: Imen Bhiri <imen.bhiri@pivasoftware.com>
*/
#ifndef __SOFTWARE_MODULE_H
#define __SOFTWARE_MODULE_H
int update_softwaremodules_url(char *uuid, char *url);
char *get_softwaremodules_uuid(char *url);
char *get_softwaremodules_username(char *uuid);
char *get_softwaremodules_pass(char *uuid);
char *get_softwaremodules_instance(char *uuid);
char *get_softwaremodules_version(char *uuid);
char *add_softwaremodules_deploymentunit(char *uuid, char*url, char *username, char *password, char *name, char *version);
char *get_softwaremodules_name(char *uuid);
char *get_softwaremodules_url(char *uuid);
extern DMLEAF tDeploymentUnitParams[];
extern DMOBJ tSoftwareModulesObj[];
int browsesoftwaremodules_deploymentunitInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int get_deploymentunit_uuid(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_deploymentunit_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_deploymentunit_resolved(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_deploymentunit_url(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_deploymentunit_vendor(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_deploymentunit_version(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_deploymentunit_execution_env_ref(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
#endif

View file

@ -1,294 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2015 Inteno Broadband Technology AB
* Author Imen Bhiri <imen.bhiri@pivasoftware.com>
*
*/
#include <uci.h>
#include <ctype.h>
#include "dmuci.h"
#include "dmcwmp.h"
#include "dmubus.h"
#include "times.h"
#include "dmcommon.h"
#include "dmentry.h"
/*** Time. ***/
DMLEAF tTimeParams[] = {
/* PARAM, permission, type, getvlue, setvalue, forced_inform, notification, linker*/
{"Enable", &DMWRITE, DMT_BOOL, get_time_enable, set_time_enable, NULL, NULL},
{"Status", &DMREAD, DMT_STRING, get_time_status, NULL, NULL, NULL},
{"NTPServer1", &DMWRITE, DMT_STRING, get_time_ntpserver1, set_time_ntpserver1, NULL, NULL},
{"NTPServer2", &DMWRITE, DMT_STRING, get_time_ntpserver2, set_time_ntpserver2, NULL, NULL},
{"NTPServer3", &DMWRITE, DMT_STRING, get_time_ntpserver3, set_time_ntpserver3, NULL, NULL},
{"NTPServer4", &DMWRITE, DMT_STRING, get_time_ntpserver4, set_time_ntpserver4, NULL, NULL},
{"NTPServer5", &DMWRITE, DMT_STRING, get_time_ntpserver5, set_time_ntpserver5, NULL, NULL},
{"CurrentLocalTime", &DMREAD, DMT_TIME, get_time_CurrentLocalTime, NULL, NULL, NULL},
{"LocalTimeZone", &DMWRITE, DMT_STRING, get_time_LocalTimeZone, set_time_LocalTimeZone, NULL, NULL},
{CUSTOM_PREFIX"LocalTimeZoneOlson", &DMREAD, DMT_STRING, get_local_time_zone_olson, NULL, NULL, NULL},
{CUSTOM_PREFIX"SourceInterface", &DMWRITE, DMT_STRING, get_time_source_interface, set_time_source_interface, NULL, NULL},
{0}
};
int get_time_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char *path = "/etc/rc.d/*ntpd";
if (check_file(path))
*value = "1";
else
*value = "0";
return 0;
}
int set_time_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
bool b;
int check;
pid_t pid;
switch (action) {
case VALUECHECK:
if (string_to_bool(value, &b))
return FAULT_9007;
return 0;
case VALUESET:
string_to_bool(value, &b);
if(b) {
DMCMD("/etc/rc.common", 2, "/etc/init.d/ntpd", "enable"); //TODO wait ubus command
pid = get_pid("ntpd");
if (pid < 0) {
DMCMD("/etc/rc.common", 2, "/etc/init.d/ntpd", "start"); //TODO wait ubus command
}
}
else {
DMCMD("/etc/rc.common", 2, "/etc/init.d/ntpd", "disable"); //TODO wait ubus command
pid = get_pid("ntpd");
if (pid > 0) {
DMCMD("/etc/rc.common", 2, "/etc/init.d/ntpd", "stop"); //TODO may be should be updated with ubus call uci
}
}
return 0;
}
return 0;
}
int get_time_status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value){
char *path = "/etc/rc.d/*ntpd";
if (check_file(path))
*value = "Synchronized";
else
*value = "Disabled";
return 0;
}
int get_time_CurrentLocalTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char time_buf[26] = {0};
struct tm *t_tm;
*value = "0001-01-01T00:00:00Z";
time_t t_time = time(NULL);
t_tm = localtime(&t_time);
if (t_tm == NULL)
return 0;
if(strftime(time_buf, sizeof(time_buf), "%FT%T%z", t_tm) == 0)
return 0;
time_buf[25] = time_buf[24];
time_buf[24] = time_buf[23];
time_buf[22] = ':';
time_buf[26] = '\0';
*value = dmstrdup(time_buf);
return 0;
}
/*#Device.Time.LocalTimeZone!UCI:system/system,@system[0]/timezone*/
int get_time_LocalTimeZone(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string("system", "@system[0]", "timezone", value);
return 0;
}
int set_time_LocalTimeZone(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
break;
case VALUESET:
dmuci_set_value("system", "@system[0]", "timezone", value);
break;
}
return 0;
}
int get_local_time_zone_olson(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value){
dmuci_get_option_value_string("system", "@system[0]", "zonename", value);
}
//WE CAN WORK WITHOUT FOUND VALUE TO UPDATE
int get_time_ntpserver(char *refparam, struct dmctx *ctx, char **value, int index)
{
char *pch;
bool found = 0;
int element = 0;
struct uci_list *v;
struct uci_element *e;
dmuci_get_option_value_list("system","ntp","server", &v);
if (v) {
uci_foreach_element(v, e) {
element++;
if (element == index) {
*value = dmstrdup(e->name); // MEM WILL BE FREED IN DMMEMCLEAN
found = 1;
break;
}
}
}
if (!found) {
*value = "";
return 0;
}
if (strcmp(*value, "none") == 0) {
*value = "";
}
return 0;
}
int get_time_source_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value){
char *iface= NULL, *interface= NULL;
*value= "";
dmuci_get_option_value_string("system", "ntp", "interface", &iface);
if (*iface == '\0' || strlen(iface)== 0)
return 0;
adm_entry_get_linker_param(ctx, dm_print_path("%s%cIP%cInterface%c", dmroot, dm_delim, dm_delim, dm_delim), iface, &interface);
if (*interface == '\0')
return 0;
*value= dmstrdup(interface);
return 0;
}
int get_time_ntpserver1(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return get_time_ntpserver(refparam, ctx, value, 1);
}
int get_time_ntpserver2(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return get_time_ntpserver(refparam, ctx, value, 2);
}
int get_time_ntpserver3(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return get_time_ntpserver(refparam, ctx, value, 3);
}
int get_time_ntpserver4(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return get_time_ntpserver(refparam, ctx, value, 4);
}
int get_time_ntpserver5(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return get_time_ntpserver(refparam, ctx, value, 5);
}
int set_time_source_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
char *iface= NULL;
switch (action) {
case VALUECHECK:
adm_entry_get_linker_value(ctx, value, &iface);
if(iface == NULL || iface[0] == '\0')
return FAULT_9007;
break;
case VALUESET:
adm_entry_get_linker_value(ctx, value, &iface);
dmuci_set_value("system", "ntp", "interface", iface);
return 0;
}
return 0;
}
int set_time_ntpserver(char *refparam, struct dmctx *ctx, int action, char *value, int index)
{
char *pch, *path;
int check;
struct uci_list *v;
struct uci_element *e;
int count = 0;
int i = 0;
char *ntp[5] = {0};
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_get_option_value_list("system", "ntp", "server", &v);
if (v) {
uci_foreach_element(v, e) {
if ((count+1) == index) {
ntp[count] = dmstrdup(value);
}
else {
ntp[count] = dmstrdup(e->name);
}
count++;
if (count > 4)
break;
}
}
if (index > count) {
ntp[index-1] = dmstrdup(value);
count = index;
}
for (i = 0; i < 5; i++) {
if (ntp[i] && (*ntp[i]) != '\0')
count = i+1;
}
dmuci_delete("system", "ntp", "server", NULL);
for (i = 0; i < count; i++) {
dmuci_add_list_value("system", "ntp", "server", ntp[i] ? ntp[i] : "");
dmfree(ntp[i]);
}
return 0;
}
return 0;
}
int set_time_ntpserver1(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
return set_time_ntpserver(refparam, ctx, action, value, 1);
}
int set_time_ntpserver2(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
return set_time_ntpserver(refparam, ctx, action, value, 2);
}
int set_time_ntpserver3(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
return set_time_ntpserver(refparam, ctx, action, value, 3);
}
int set_time_ntpserver4(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
return set_time_ntpserver(refparam, ctx, action, value, 4);
}
int set_time_ntpserver5(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
return set_time_ntpserver(refparam, ctx, action, value, 5);
}

View file

@ -1,26 +0,0 @@
#ifndef __TIMES_H
#define __TIMES_H
extern DMLEAF tTimeParams[];
int get_time_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_time_ntpserver1(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_time_ntpserver2(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_time_ntpserver3(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_time_ntpserver4(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_time_ntpserver5(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_time_CurrentLocalTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_time_LocalTimeZone(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_time_status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_time_source_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_local_time_zone_olson(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_time_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_time_ntpserver1(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_time_ntpserver2(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_time_ntpserver3(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_time_ntpserver4(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_time_ntpserver5(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_time_LocalTimeZone(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_time_source_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
#endif

View file

@ -1,76 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2015 Inteno Broadband Technology AB
* Author Imen Bhiri <imen.bhiri@pivasoftware.com>
*
*/
#include <uci.h>
#include <stdio.h>
#include <ctype.h>
#include "dmuci.h"
#include "dmubus.h"
#include "dmcwmp.h"
#include "dmcommon.h"
#include "upnp.h"
/*** UPnP. ***/
DMOBJ tUPnPObj[] = {
/* OBJ, permission, addobj, delobj, browseinstobj, finform, notification, nextobj, leaf, linker*/
{"Device", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tUPnPDeviceParams, NULL},
{0}
};
DMLEAF tUPnPDeviceParams[] = {
/* PARAM, permission, type, getvlue, setvalue, forced_inform, notification*/
{"Enable", &DMWRITE, DMT_BOOL, get_upnp_enable, set_upnp_enable, NULL, NULL},
{CUSTOM_PREFIX"Status", &DMREAD, DMT_STRING, get_upnp_status, NULL, NULL, NULL},
{0}
};
/*#Device.UPnP.Device.Enable!UCI:upnpd/upnpd,config/enabled*/
int get_upnp_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string("upnpd","config","enabled", value);
if ((*value)[0] == '\0') {
*value = "1";
}
return 0;
}
int set_upnp_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
bool b;
int check;
switch (action) {
case VALUECHECK:
if (string_to_bool(value, &b))
return FAULT_9007;
return 0;
case VALUESET:
string_to_bool(value, &b);
if(b)
dmuci_set_value("upnpd", "config", "enabled", "");
else
dmuci_set_value("upnpd", "config", "enabled", "0");
return 0;
}
return 0;
}
int get_upnp_status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
pid_t pid = get_pid("miniupnpd");
if (pid < 0) {
*value = "Down";
}
else {
*value = "Up";
}
return 0;
}

View file

@ -1,12 +0,0 @@
#ifndef __UPNP_H
#define __UPNP_H
extern DMLEAF tUPnPDeviceParams[];
extern DMOBJ tUPnPObj[];
int get_upnp_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_upnp_status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_upnp_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
#endif

File diff suppressed because it is too large Load diff

View file

@ -1,262 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2012-2014 PIVA SOFTWARE (www.pivasoftware.com)
* Author: Imen Bhiri <imen.bhiri@pivasoftware.com>
* Author: Feten Besbes <feten.besbes@pivasoftware.com>
* Author: Mohamed Kallel <mohamed.kallel@pivasoftware.com>
* Author: Anis Ellouze <anis.ellouze@pivasoftware.com>
*/
#ifndef __VOICE_H
#define __VOICE_H
extern DMOBJ tServiceObj[];
extern DMOBJ tVoiceServiceObj[];
extern DMLEAF tVoiceServiceParam[];
extern DMLEAF tCapabilitiesParams[];
extern DMOBJ tCapabilitiesObj[];
extern DMLEAF tSIPParams[];
extern DMLEAF tCodecsParams[] ;
extern DMOBJ tProfileObj[] ;
extern DMLEAF tProfileSIPParams[];
extern DMLEAF tServiceProviderInfoParams[];
extern DMLEAF tProfileParam[];
extern DMOBJ tLineObj[];
extern DMOBJ tLineCodecObj[];
extern DMLEAF tLineCodecListParams[];
extern DMLEAF tLineSIPParams[];
extern DMLEAF tVoiceProcessingParams[];
extern DMLEAF tCallingFeaturesParams[];
extern DMLEAF tLineParams[];
extern DMLEAF tRTPParams[];
extern DMOBJ tRTPObj[];
extern DMLEAF tSRTPParam[];
extern DMLEAF tRTCPParams[];
extern DMLEAF tFaxT38Params[];
/*Args of get_voice_service_capabilities_codecs_generic*/
struct codec_args
{
char *cdc;
char *id;
int enumid;
struct uci_section *codec_section;
};
struct rtp_tos
{
char *key;
char *val;
};
struct cap_sip_codec
{
int enumid;
char *c1;
char *c2;
char *c3;
char *c4;
char *c5;
};
struct sip_args
{
struct uci_section *sip_section;
char *profile_num;
};
struct tel_args
{
struct uci_section *tel_section;
struct uci_section *sip_section;
char *profile_num;
};
struct allow_sip_codec
{
int enumid;
char *id;
char *allowed_cdc;
char *priority_cdc;
char *ptime_cdc;
};
struct line_codec_args
{
int enumid;
char *sip_id;
char *cdc;
char *id;
char *priority_cdc;
char *ptime_cdc;
struct uci_section *sip_section;
struct uci_section *codec_sec;
};
struct region
{
char *country;
char *id;
};
struct codec
{
char *cdc;
char *id;
char *priority;
};
enum enum_cap_sip_codecs {
SIP_CODEC_G723,
SIP_CODEC_GSM,
SIP_CODEC_ULAW,
SIP_CODEC_ALAW,
SIP_CODEC_G726AAL2,
SIP_CODEC_ADPCM,
SIP_CODEC_SLIN,
SIP_CODEC_LPC10,
SIP_CODEC_G729,
SIP_CODEC_SPEEX,
SIP_CODEC_ILBC,
SIP_CODEC_G726,
SIP_CODEC_G722,
SIP_CODEC_SIREN7,
SIP_CODEC_SIREN14,
SIP_CODEC_SLIN16,
SIP_CODEC_G719,
SIP_CODEC_SPEEX16,
SIP_CODEC_TESTLAW
};
bool dm_service_enable_set(void);
int browseVoiceServiceInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseCodecsInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseProfileInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseLineInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseLineCodecListInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int add_profile_object(char *refparam, struct dmctx *ctx, void *data, char **instancepara);
int delete_profile_object(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
int add_line_object(char *refparam, struct dmctx *ctx, void *data, char **instancepara);
int delete_line_object(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
int get_service_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_max_profile_count(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_max_line_count(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_true_value(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_max_session_count(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_signal_protocols(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_regions(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_false_value(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_sip_role(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_sip_extension(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_sip_transport(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_sip_tls_auth_protocols(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_sip_tls_enc_protocols(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_sip_tls_key_protocols(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_cap_codec_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_entry_id(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_capabilities_sip_codec(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_capabilities_sip_bitrate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_capabilities_sip_pperiod(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_voice_profile_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_voice_profile_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_voice_profile_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_voice_profile_signalprotocol(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_voice_profile_max_sessions(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_voice_profile_number_of_lines(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_voice_profile_sip_dtmfmethod(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_sip_profile_region(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_voice_profile_sip_proxyserver(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_sip_proxy_server_transport(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_voice_profile_sip_registerserver(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_voice_profile_sip_registerserverport(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_sip_registrar_server_transport(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_sip_user_agent_domain(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_sip_user_agent_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_sip_user_agent_transport(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_sip_outbound_proxy(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_sip_outbound_proxy_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_sip_registration_period(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_sip_re_invite_expires(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_sip_call_lines(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_voice_service_serviceproviderinfo_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_sip_fax_t38_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_voice_service_vp_rtp_portmin(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_voice_service_vp_rtp_portmax(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_voice_service_vp_rtp_dscp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_voice_service_vp_rtp_rtcp_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_voice_service_vp_rtp_rtcp_txrepeatinterval(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_voice_service_vp_rtp_srtp_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_line_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_voice_profile_line_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_voice_profile_line_status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_voice_profile_line_callstate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_line_line_profile(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_line_tel_line(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_line_confort_noise_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_line_voice_processing_cancellation_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_line_calling_features_caller_id_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_line_calling_features_callwaiting(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_line_sip_auth_username(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_line_sip_uri(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_line_codec_list_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_codec_entry_id(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int capabilities_sip_codecs_get_codec(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int capabilities_sip_codecs_get_bitrate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_capabilities_sip_codecs_pperiod(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_line_codec_list_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_line_codec_list_priority(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_line_directory_number(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_service_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_cap_codec_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_voice_profile_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_voice_profile_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_voice_profile_reset(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_voice_profile_signaling_protocol(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_voice_profile_sip_dtmfmethod(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_voice_profile_sip_proxyserver(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_sip_proxy_server_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_sip_proxy_server_transport(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_voice_profile_sip_registerserver(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_voice_profile_sip_registerserverport(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_sip_registrar_server_transport(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_sip_user_agent_domain(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_sip_user_agent_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_sip_user_agent_transport(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_sip_outbound_proxy(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_sip_outbound_proxy_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_sip_registration_period(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_sip_re_invite_expires(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_sip_call_lines(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_voice_service_serviceproviderinfo_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_sip_fax_t38_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_voice_service_vp_rtp_portmin(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_voice_profile_rtp_localportmax(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_voice_service_vp_rtp_dscp(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_voice_service_vp_rtp_rtcp_txrepeatinterval(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_voice_service_vp_rtp_srtp_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_line_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_voice_profile_line_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_line_directory_number(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_line_line_profile(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_line_tel_line(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_line_confort_noise_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_line_calling_features_caller_id_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_line_voice_processing_cancellation_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_line_calling_features_callwaiting(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_line_sip_auth_username(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_line_sip_auth_password(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_line_sip_uri(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_line_codec_list_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_line_codec_list_packetization(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_line_codec_list_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_line_codec_list_priority(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_sip_profile_region(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_voice_service_max_line();
#endif

View file

@ -1,173 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2015 Inteno Broadband Technology AB
* Author Imen Bhiri <imen.bhiri@pivasoftware.com>
* Author Omar Kallel <omar.kallel@pivasoftware.com>
*
*/
#include <uci.h>
#include <ctype.h>
#include "dmcwmp.h"
#include "dmuci.h"
#include "dmubus.h"
#include "dmcommon.h"
#include "x_iopsys_eu_buttons.h"
/*** DMROOT.X_IOPSYS_EU_Buttons.{i}. ****/
DMLEAF X_IOPSYS_EU_ButtonParams[] = {
/* PARAM, permission, type, getvlue, setvalue, forced_inform, NOTIFICATION, linker*/
{"Alias", &DMWRITE, DMT_STRING, get_x_iopsys_eu_button_alias, set_x_iopsys_eu_button_alias, NULL, NULL},
{"button", &DMREAD, DMT_STRING, get_x_iopsys_eu_button_name, NULL, NULL, NULL},
{"hotplug", &DMREAD, DMT_STRING, get_x_iopsys_eu_button_hotplug, NULL, NULL, NULL},
{"hotplug_long", &DMREAD, DMT_STRING, get_x_iopsys_eu_button_hotplug_long, NULL, NULL, NULL},
{"minpress", &DMWRITE, DMT_UNINT, get_x_iopsys_eu_button_minpress, set_x_iopsys_eu_button_minpress, NULL, NULL},
{"longpress", &DMWRITE, DMT_UNINT, get_x_iopsys_eu_button_longpress, set_x_iopsys_eu_button_longpress, NULL, NULL},
{"enable", &DMWRITE, DMT_BOOL, get_x_iopsys_eu_button_enable, set_x_iopsys_eu_button_enable, NULL, NULL},
{0}
};
int browseXIopsysEuButton(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *ibutton = NULL, *ibutton_last = NULL;
struct uci_section *s = NULL;
struct dmmap_dup *p;
LIST_HEAD(dup_list);
synchronize_specific_config_sections_with_dmmap("buttons", "button", "dmmap_buttons", &dup_list);
list_for_each_entry(p, &dup_list, list) {
ibutton = handle_update_instance(1, dmctx, &ibutton_last, update_instance_alias, 3, p->dmmap_section, "buttoninstance", "buttonalias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, ibutton) == DM_STOP)
break;
}
free_dmmap_config_dup_list(&dup_list);
return 0;
}
/*************************************************************************************
**** function related to button ****
**************************************************************************************/
int get_x_iopsys_eu_button_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_list *val;
dmuci_get_value_by_section_list((struct uci_section *)data, "button", &val);
if (val)
*value = dmuci_list_to_string(val, " ");
else
*value = "";
return 0;
}
int get_x_iopsys_eu_button_hotplug(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_value_by_section_string((struct uci_section *)data, "hotplug", value);
return 0;
}
int get_x_iopsys_eu_button_hotplug_long(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_value_by_section_string((struct uci_section *)data, "hotplug_long", value);
return 0;
}
int get_x_iopsys_eu_button_minpress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_value_by_section_string((struct uci_section *)data, "minpress", value);
return 0;
}
int set_x_iopsys_eu_button_minpress(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section((struct uci_section *)data, "minpress", value);
return 0;
}
return 0;
}
int get_x_iopsys_eu_button_longpress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_value_by_section_string((struct uci_section *)data, "longpress", value);
return 0;
}
int set_x_iopsys_eu_button_longpress(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section((struct uci_section *)data, "longpress", value);
return 0;
}
return 0;
}
int get_x_iopsys_eu_button_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_value_by_section_string((struct uci_section *)data, "enable", value);
if ((*value)[0] == '\0') {
*value = "1";
}
return 0;
}
int set_x_iopsys_eu_button_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
bool b;
switch (action) {
case VALUECHECK:
if (string_to_bool(value, &b))
return FAULT_9007;
return 0;
case VALUESET:
string_to_bool(value, &b);
if(b)
dmuci_set_value_by_section((struct uci_section *)data, "enable", "");
else
dmuci_set_value_by_section((struct uci_section *)data, "enable", "0");
return 0;
}
return 0;
}
////////////////////////SET AND GET ALIAS/////////////////////////////////
int get_x_iopsys_eu_button_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *dmmap_section;
get_dmmap_section_of_config_section("dmmap_buttons", "button", section_name((struct uci_section *)data), &dmmap_section);
dmuci_get_value_by_section_string(dmmap_section, "buttonalias", value);
return 0;
}
int set_x_iopsys_eu_button_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct uci_section *dmmap_section;
get_dmmap_section_of_config_section("dmmap_buttons", "button", section_name((struct uci_section *)data), &dmmap_section);
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section(dmmap_section, "buttonalias", value);
return 0;
}
return 0;
}

View file

@ -1,18 +0,0 @@
#ifndef __SE_BUTTONS_H
#define __SE_BUTTONS_H
extern DMLEAF X_IOPSYS_EU_ButtonParams[];
int browseXIopsysEuButton(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int get_x_iopsys_eu_button_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_x_iopsys_eu_button_hotplug(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_x_iopsys_eu_button_hotplug_long(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_x_iopsys_eu_button_minpress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_x_iopsys_eu_button_minpress(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_x_iopsys_eu_button_longpress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_x_iopsys_eu_button_longpress(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_x_iopsys_eu_button_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_x_iopsys_eu_button_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_x_iopsys_eu_button_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_x_iopsys_eu_button_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
#endif

View file

@ -1,459 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2015 Inteno Broadband Technology AB
* Author Imen Bhiri <imen.bhiri@pivasoftware.com>
*
*/
#include <uci.h>
#include <ctype.h>
#include "dmcwmp.h"
#include "dmuci.h"
#include "dmubus.h"
#include "dmcommon.h"
#include "x_iopsys_eu_dropbear.h"
/*** DMROOT.X_IOPSYS_EU_Dropbear.{i}. ****/
DMLEAF X_IOPSYS_EU_DropbearParams[] = {
/* PARAM, permission, type, getvlue, setvalue, forced_inform, NOTIFICATION, linker*/
{"Alias", &DMWRITE, DMT_STRING, get_x_iopsys_eu_dropbear_alias, set_x_iopsys_eu_dropbear_alias, NULL, NULL},
{"PasswordAuth", &DMWRITE, DMT_BOOL, get_x_iopsys_eu_dropbear_password_auth, set_x_iopsys_eu_dropbear_password_auth, NULL, NULL},
{"RootPasswordAuth", &DMWRITE, DMT_BOOL, get_x_iopsys_eu_dropbear_root_password_auth, set_x_iopsys_eu_dropbear_root_password_auth, NULL, NULL},
{"Port", &DMWRITE, DMT_UNINT, get_x_iopsys_eu_dropbear_port, set_x_iopsys_eu_dropbear_port, NULL, NULL},
{"RootLogin", &DMWRITE, DMT_BOOL, get_x_iopsys_eu_dropbear_root_login, set_x_iopsys_eu_dropbear_root_login, NULL, NULL},
{"GatewayPorts", &DMWRITE, DMT_BOOL, get_x_iopsys_eu_dropbear_gateway_ports, set_x_iopsys_eu_dropbear_gateway_ports, NULL, NULL},
{"Interface", &DMWRITE, DMT_STRING, get_x_iopsys_eu_dropbear_interface, set_x_iopsys_eu_dropbear_interface, NULL, NULL},
{"rsakeyfile", &DMWRITE, DMT_STRING, get_x_iopsys_eu_dropbear_rsakeyfile, set_x_iopsys_eu_dropbear_rsakeyfile, NULL, NULL},
{"dsskeyfile", &DMWRITE, DMT_STRING, get_x_iopsys_eu_dropbear_dsskeyfile, set_x_iopsys_eu_dropbear_dsskeyfile, NULL, NULL},
{"SSHKeepAlive", &DMWRITE, DMT_UNINT, get_x_iopsys_eu_dropbear_ssh_keepalive, set_x_iopsys_eu_dropbear_ssh_keepalive, NULL, NULL},
{"IdleTimeout", &DMWRITE, DMT_UNINT, get_x_iopsys_eu_dropbear_idle_timeout, set_x_iopsys_eu_dropbear_idle_timeout, NULL, NULL},
{"verbose", &DMWRITE, DMT_BOOL, get_x_iopsys_eu_dropbear_verbose, set_x_iopsys_eu_dropbear_verbose, NULL, NULL},
{"BannerFile", &DMWRITE, DMT_STRING, get_x_iopsys_eu_dropbear_banner_file, set_x_iopsys_eu_dropbear_banner_file, NULL, NULL},
{0}
};
int browseXIopsysEuDropbear(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *idropbear = NULL, *idropbear_last = NULL;
struct uci_section *s = NULL;
struct dmmap_dup *p;
LIST_HEAD(dup_list);
synchronize_specific_config_sections_with_dmmap("dropbear", "dropbear", "dmmap_dropbear", &dup_list);
list_for_each_entry(p, &dup_list, list) {
idropbear = handle_update_instance(1, dmctx, &idropbear_last, update_instance_alias_icwmpd, 3, p->dmmap_section, "dropbearinstance", "dropbearalias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, idropbear) == DM_STOP)
break;
}
return 0;
}
/*************************************************************************************
**** function ****
**************************************************************************************/
int get_x_iopsys_eu_dropbear_password_auth(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_value_by_section_string((struct uci_section *)data, "PasswordAuth", value);
if ((*value)[0] == '\0' || ((*value)[0] == 'o' && (*value)[1] == 'n') || (*value)[0] == '1') {
*value = "1";
}
else
*value = "0";
return 0;
}
int set_x_iopsys_eu_dropbear_password_auth(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
bool b;
switch (action) {
case VALUECHECK:
if (string_to_bool(value, &b))
return FAULT_9007;
return 0;
case VALUESET:
string_to_bool(value, &b);
if(b)
dmuci_set_value_by_section((struct uci_section *)data, "PasswordAuth", "1");
else
dmuci_set_value_by_section((struct uci_section *)data, "PasswordAuth", "0");
return 0;
}
return 0;
}
int get_x_iopsys_eu_dropbear_root_password_auth(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_value_by_section_string((struct uci_section *)data, "RootPasswordAuth", value);
if ((*value)[0] == '\0' || ((*value)[0] == 'o' && (*value)[1] == 'n') || (*value)[0] == '1') {
*value = "1";
}
else
*value = "0";
return 0;
}
int set_x_iopsys_eu_dropbear_root_password_auth(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
bool b;
switch (action) {
case VALUECHECK:
if (string_to_bool(value, &b))
return FAULT_9007;
return 0;
case VALUESET:
string_to_bool(value, &b);
if(b)
dmuci_set_value_by_section((struct uci_section *)data, "RootPasswordAuth", "1");
else
dmuci_set_value_by_section((struct uci_section *)data, "RootPasswordAuth", "0");
return 0;
}
return 0;
}
int get_x_iopsys_eu_dropbear_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_value_by_section_string((struct uci_section *)data, "Port", value);
if ((*value)[0] == '\0') {
*value = "22";
}
return 0;
}
int set_x_iopsys_eu_dropbear_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
if (value[0] == '\0')
dmuci_set_value_by_section((struct uci_section *)data, "Port", "22");
else
dmuci_set_value_by_section((struct uci_section *)data, "Port", value);
return 0;
}
return 0;
}
int get_x_iopsys_eu_dropbear_root_login(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_value_by_section_string((struct uci_section *)data, "RootLogin", value);
if ((*value)[0] == '\0' || ((*value)[0] == 'o' && (*value)[1] == 'n') || (*value)[0] == '1' ) {
*value = "1";
}
else
*value = "0";
return 0;
}
int set_x_iopsys_eu_dropbear_root_login(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
bool b;
switch (action) {
case VALUECHECK:
if (string_to_bool(value, &b))
return FAULT_9007;
return 0;
case VALUESET:
string_to_bool(value, &b);
if(b)
dmuci_set_value_by_section((struct uci_section *)data, "RootLogin", "1");
else
dmuci_set_value_by_section((struct uci_section *)data, "RootLogin", "0");
return 0;
}
return 0;
}
int get_x_iopsys_eu_dropbear_verbose(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_value_by_section_string((struct uci_section *)data, "verbose", value);
if ((*value)[0] == '\0' || (*value)[0] == '0' ) {
*value = "0";
}
else
*value = "1";
return 0;
}
int set_x_iopsys_eu_dropbear_verbose(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
bool b;
switch (action) {
case VALUECHECK:
if (string_to_bool(value, &b))
return FAULT_9007;
return 0;
case VALUESET:
string_to_bool(value, &b);
if(b)
dmuci_set_value_by_section((struct uci_section *)data, "verbose", "1");
else
dmuci_set_value_by_section((struct uci_section *)data, "verbose", "0");
return 0;
}
return 0;
}
int get_x_iopsys_eu_dropbear_gateway_ports(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_value_by_section_string((struct uci_section *)data, "GatewayPorts", value);
if ((*value)[0] == '\0' || (*value)[0] == '0' ) {
*value = "0";
}
else
*value = "1";
return 0;
}
int set_x_iopsys_eu_dropbear_gateway_ports(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
bool b;
switch (action) {
case VALUECHECK:
if (string_to_bool(value, &b))
return FAULT_9007;
return 0;
case VALUESET:
string_to_bool(value, &b);
if(b)
dmuci_set_value_by_section((struct uci_section *)data, "GatewayPorts", "1");
else
dmuci_set_value_by_section((struct uci_section *)data, "GatewayPorts", "");
return 0;
}
return 0;
}
int get_x_iopsys_eu_dropbear_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_value_by_section_string((struct uci_section *)data, "Interface", value);
return 0;
}
int set_x_iopsys_eu_dropbear_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section((struct uci_section *)data, "Interface", value);
return 0;
}
return 0;
}
int get_x_iopsys_eu_dropbear_rsakeyfile(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_value_by_section_string((struct uci_section *)data, "rsakeyfile", value);
return 0;
}
int set_x_iopsys_eu_dropbear_rsakeyfile(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section((struct uci_section *)data, "rsakeyfile", value);
return 0;
}
return 0;
}
int get_x_iopsys_eu_dropbear_dsskeyfile(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_value_by_section_string((struct uci_section *)data, "dsskeyfile", value);
return 0;
}
int set_x_iopsys_eu_dropbear_dsskeyfile(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section((struct uci_section *)data, "dsskeyfile", value);
return 0;
}
return 0;
}
int get_x_iopsys_eu_dropbear_ssh_keepalive(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_value_by_section_string((struct uci_section *)data, "SSHKeepAlive", value);
if ((*value)[0] == '\0') {
*value = "300";
}
return 0;
}
int set_x_iopsys_eu_dropbear_ssh_keepalive(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
if (strcmp(value, "300") == 0)
dmuci_set_value_by_section((struct uci_section *)data, "SSHKeepAlive", "");
else
dmuci_set_value_by_section((struct uci_section *)data, "SSHKeepAlive", value);
return 0;
}
return 0;
}
int get_x_iopsys_eu_dropbear_idle_timeout(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_value_by_section_string((struct uci_section *)data, "IdleTimeout", value);
if ((*value)[0] == '\0') {
*value = "300";
}
return 0;
}
int set_x_iopsys_eu_dropbear_idle_timeout(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
if (value[0] == '0')
dmuci_set_value_by_section((struct uci_section *)data, "IdleTimeout", "");
else
dmuci_set_value_by_section((struct uci_section *)data, "IdleTimeout", value);
return 0;
}
return 0;
}
int get_x_iopsys_eu_dropbear_banner_file(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_value_by_section_string((struct uci_section *)data, "BannerFile", value);
return 0;
}
int set_x_iopsys_eu_dropbear_banner_file(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section((struct uci_section *)data, "BannerFile", value);
return 0;
}
return 0;
}
////////////////////////SET AND GET ALIAS/////////////////////////////////
int get_x_iopsys_eu_dropbear_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *dmmap_section;
get_dmmap_section_of_config_section("dmmap_dropbear", "dropbear", section_name((struct uci_section *)data), &dmmap_section);
dmuci_get_value_by_section_string(dmmap_section, "dropbearalias", value);
return 0;
}
int set_x_iopsys_eu_dropbear_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct uci_section *dmmap_section;
get_dmmap_section_of_config_section("dmmap_dropbear", "dropbear", section_name((struct uci_section *)data), &dmmap_section);
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section(dmmap_section, "dropbearalias", value);
return 0;
}
return 0;
}
/***** ADD DEL OBJ *******/
int add_dropbear_instance(char *refparam, struct dmctx *ctx, void *data, char **instancepara)
{
char *value, *v;
char *instance;
struct uci_section *dropbear_sec = NULL, *dmmap_sec= NULL;
check_create_dmmap_package("dmmap_dropbear");
instance = get_last_instance_icwmpd("dmmap_dropbear", "dropbear", "dropbearinstance");
dmuci_add_section("dropbear", "dropbear", &dropbear_sec, &value);
dmuci_set_value_by_section(dropbear_sec, "verbose", "0");
dmuci_set_value_by_section(dropbear_sec, "Port", "22");
dmuci_set_value_by_section(dropbear_sec, "RootLogin", "1");
dmuci_set_value_by_section(dropbear_sec, "GatewayPorts", "0");
dmuci_set_value_by_section(dropbear_sec, "SSHKeepAlive", "300");
dmuci_set_value_by_section(dropbear_sec, "IdleTimeout", "0");
dmuci_add_section_icwmpd("dmmap_dropbear", "dropbear", &dmmap_sec, &v);
dmuci_set_value_by_section(dmmap_sec, "section_name", section_name(dropbear_sec));
*instancepara = update_instance_icwmpd(dmmap_sec, instance, "dropbearinstance");
return 0;
}
int delete_dropbear_instance(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action)
{
struct uci_section *s = NULL;
struct uci_section *ss = NULL;
struct uci_section *dmmap_section;
int found = 0;
switch (del_action) {
case DEL_INST:
if(is_section_unnamed(section_name((struct uci_section *)data))){
LIST_HEAD(dup_list);
delete_sections_save_next_sections("dmmap_dropbear", "dropbear", "dropbearinstance", section_name((struct uci_section *)data), atoi(instance), &dup_list);
update_dmmap_sections(&dup_list, "dropbearinstance", "dmmap_dropbear", "dropbear");
dmuci_delete_by_section_unnamed((struct uci_section *)data, NULL, NULL);
} else {
get_dmmap_section_of_config_section("dmmap_dropbear", "dropbear", section_name((struct uci_section *)data), &dmmap_section);
dmuci_delete_by_section_unnamed_icwmpd(dmmap_section, NULL, NULL);
dmuci_delete_by_section((struct uci_section *)data, NULL, NULL);
}
break;
case DEL_ALL:
uci_foreach_sections("dropbear", "dropbear", s) {
if (found != 0){
get_dmmap_section_of_config_section("dmmap_dropbear", "dropbear", section_name(ss), &dmmap_section);
if(dmmap_section != NULL)
dmuci_delete_by_section(dmmap_section, NULL, NULL);
dmuci_delete_by_section(ss, NULL, NULL);
}
ss = s;
found++;
}
if (ss != NULL){
get_dmmap_section_of_config_section("dmmap_dropbear", "dropbear", section_name(ss), &dmmap_section);
if(dmmap_section != NULL)
dmuci_delete_by_section(dmmap_section, NULL, NULL);
dmuci_delete_by_section(ss, NULL, NULL);
}
return 0;
}
return 0;
}

View file

@ -1,35 +0,0 @@
#ifndef __SE_DROPBEAR_H
#define __SE_DROPBEAR_H
extern DMLEAF X_IOPSYS_EU_DropbearParams[];
int browseXIopsysEuDropbear(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int get_x_iopsys_eu_dropbear_password_auth(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_x_iopsys_eu_dropbear_password_auth(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_x_iopsys_eu_dropbear_root_password_auth(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_x_iopsys_eu_dropbear_root_password_auth(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_x_iopsys_eu_dropbear_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_x_iopsys_eu_dropbear_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_x_iopsys_eu_dropbear_root_login(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_x_iopsys_eu_dropbear_root_login(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_x_iopsys_eu_dropbear_verbose(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_x_iopsys_eu_dropbear_verbose(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_x_iopsys_eu_dropbear_gateway_ports(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_x_iopsys_eu_dropbear_gateway_ports(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_x_iopsys_eu_dropbear_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_x_iopsys_eu_dropbear_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_x_iopsys_eu_dropbear_rsakeyfile(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_x_iopsys_eu_dropbear_rsakeyfile(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_x_iopsys_eu_dropbear_dsskeyfile(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_x_iopsys_eu_dropbear_dsskeyfile(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_x_iopsys_eu_dropbear_ssh_keepalive(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_x_iopsys_eu_dropbear_ssh_keepalive(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_x_iopsys_eu_dropbear_idle_timeout(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_x_iopsys_eu_dropbear_idle_timeout(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_x_iopsys_eu_dropbear_banner_file(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_x_iopsys_eu_dropbear_banner_file(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_x_iopsys_eu_dropbear_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_x_iopsys_eu_dropbear_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int add_dropbear_instance(char *refparam, struct dmctx *ctx, void *data, char **instancepara);
int delete_dropbear_instance(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
#endif

View file

@ -1,78 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2015 Inteno Broadband Technology AB
* Author Imen Bhiri <imen.bhiri@pivasoftware.com>
*
*/
#include <uci.h>
#include <stdio.h>
#include <ctype.h>
#include "dmuci.h"
#include "dmubus.h"
#include "dmcwmp.h"
#include "dmcommon.h"
#include "x_iopsys_eu_ice.h"
/*** DMROOT.X_IOPSYS_EU_ICE. ***/
DMLEAF tSe_IceParam[] = {
{"Enable", &DMWRITE, DMT_BOOL, get_ice_cloud_enable, set_ice_cloud_enable, NULL, NULL},
{"Server", &DMWRITE, DMT_STRING, get_ice_cloud_server, set_ice_cloud_server, NULL, NULL},
{0}
};
int get_ice_cloud_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
bool b;
dmuci_get_option_value_string("ice", "cloud", "enabled", value);
string_to_bool(*value, &b);
if (b)
*value = "1";
else
*value = "0";
return 0;
}
int set_ice_cloud_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
bool b;
switch (action) {
case VALUECHECK:
if (string_to_bool(value, &b))
return FAULT_9007;
return 0;
case VALUESET:
string_to_bool(value, &b);
if (b)
dmuci_set_value("ice", "cloud", "enabled", "1");
else
dmuci_set_value("ice", "cloud", "enabled", "0");
return 0;
}
}
int get_ice_cloud_server(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string("ice", "cloud", "server", value);
return 0;
}
int set_ice_cloud_server(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
if (value[0] == '\0')
return 0;
dmuci_set_value("ice", "cloud", "server", value);
return 0;
}
return 0;
}

View file

@ -1,12 +0,0 @@
#ifndef __SE_ICE_H
#define __SE_ICE_H
extern DMLEAF tSe_IceParam[];
int get_ice_cloud_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_ice_cloud_server(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_ice_cloud_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_ice_cloud_server(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
#endif

View file

@ -1,410 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2015 Inteno Broadband Technology AB
* Author Imen Bhiri <imen.bhiri@pivasoftware.com>
*
*/
#include <uci.h>
#include <stdio.h>
#include <ctype.h>
#include "dmuci.h"
#include "dmubus.h"
#include "dmcwmp.h"
#include "dmcommon.h"
#include "x_iopsys_eu_igmp.h"
int get_igmp_dscp_mark(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string("mcpd", "mcpd", "igmp_dscp_mark", value);
return 0;
}
int set_igmp_dscp_mark(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value("mcpd", "mcpd", "igmp_dscp_mark", value);
return 0;
}
return 0;
}
int get_igmp_proxy_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char *p;
dmuci_get_option_value_string("mcpd", "mcpd", "igmp_proxy_interfaces", value);
*value = dmstrdup(*value); // MEM WILL BE FREED IN DMMEMCLEAN
p = *value;
while (*p++) {
if (*p == ' ') *p = ',';
}
return 0;
}
int set_igmp_proxy_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
int i;
char *p;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
if (value[0] == '\0')
return 0;
value = dmstrdup(value);
p = value;
while (*p++) {
if (*p == ',') *p = ' ';
}
compress_spaces(value);
dmuci_set_value("mcpd", "mcpd", "igmp_proxy_interfaces", value);
dmfree(value);
return 0;
}
return 0;
}
int get_igmp_default_version(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string("mcpd", "mcpd", "igmp_default_version", value);
return 0;
}
int set_igmp_default_version(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value("mcpd", "mcpd", "igmp_default_version", value);
return 0;
}
return 0;
}
int get_igmp_query_interval(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string("mcpd", "mcpd", "igmp_query_interval", value);
return 0;
}
int set_igmp_query_interval(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value("mcpd", "mcpd", "igmp_query_interval", value);
return 0;
}
return 0;
}
int get_igmp_query_response_interval(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string("mcpd", "mcpd", "igmp_query_response_interval", value);
return 0;
}
int set_igmp_query_response_interval(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value("mcpd", "mcpd", "igmp_query_response_interval", value);
return 0;
}
return 0;
}
int get_igmp_last_member_queryinterval(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string("mcpd", "mcpd", "igmp_last_member_query_interval", value);
return 0;
}
int set_igmp_last_member_queryinterval(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value("mcpd", "mcpd", "igmp_last_member_query_interval", value);
return 0;
}
return 0;
}
int get_igmp_robustness_value(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string("mcpd", "mcpd", "igmp_robustness_value", value);
return 0;
}
int set_igmp_robustness_value(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value("mcpd", "mcpd", "igmp_robustness_value", value);
return 0;
}
return 0;
}
int get_igmp_multicast_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string("mcpd", "mcpd", "igmp_lan_to_lan_multicast", value);
if ((*value)[0] == '\0') {
*value = "0";
}
return 0;
}
int set_igmp_multicast_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
bool b;
switch (action) {
case VALUECHECK:
if (string_to_bool(value, &b))
return FAULT_9007;
return 0;
case VALUESET:
string_to_bool(value, &b);
if (b)
dmuci_set_value("mcpd", "mcpd", "igmp_lan_to_lan_multicast", "1");
else
dmuci_set_value("mcpd", "mcpd", "igmp_lan_to_lan_multicast", "");
return 0;
}
return 0;
}
int get_igmp_fastleave_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string("mcpd", "mcpd", "igmp_fast_leave", value);
if ((*value)[0] == '\0') {
*value = "0";
}
return 0;
}
int set_igmp_fastleave_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
bool b;
switch (action) {
case VALUECHECK:
if (string_to_bool(value, &b))
return FAULT_9007;
return 0;
case VALUESET:
string_to_bool(value, &b);
if (b)
dmuci_set_value("mcpd", "mcpd", "igmp_fast_leave", "1");
else
dmuci_set_value("mcpd", "mcpd", "igmp_fast_leave", "");
return 0;
}
return 0;
}
int get_igmp_joinimmediate_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string("mcpd", "mcpd", "igmp_join_immediate", value);
if ((*value)[0] == '\0') {
*value = "0";
}
return 0;
}
int set_igmp_joinimmediate_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
bool b;
switch (action) {
case VALUECHECK:
if (string_to_bool(value, &b))
return FAULT_9007;
return 0;
case VALUESET:
string_to_bool(value, &b);
if (b)
dmuci_set_value("mcpd", "mcpd", "igmp_join_immediate", "1");
else
dmuci_set_value("mcpd", "mcpd", "igmp_join_immediate", "");
return 0;
}
return 0;
}
int get_igmp_proxy_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string("mcpd", "mcpd", "igmp_proxy_enable", value);
if ((*value)[0] == '\0') {
*value = "0";
}
return 0;
}
int set_igmp_proxy_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
bool b;
switch (action) {
case VALUECHECK:
if (string_to_bool(value, &b))
return FAULT_9007;
return 0;
case VALUESET:
string_to_bool(value, &b);
if (b)
dmuci_set_value("mcpd", "mcpd", "igmp_proxy_enable", "1");
else
dmuci_set_value("mcpd", "mcpd", "igmp_proxy_enable", "");
return 0;
}
return 0;
}
int get_igmp_maxgroup(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string("mcpd", "mcpd", "igmp_max_groups", value);
return 0;
}
int set_igmp_maxgroup(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value("mcpd", "mcpd", "igmp_max_groups", value);
return 0;
}
return 0;
}
int get_igmp_maxsources(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string("mcpd", "mcpd", "igmp_max_sources", value);
return 0;
}
int set_igmp_maxsources(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value("mcpd", "mcpd", "igmp_max_sources", value);
return 0;
}
return 0;
}
int get_igmp_maxmembers(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string("mcpd", "mcpd", "igmp_max_members", value);
return 0;
}
int set_igmp_maxmembers(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value("mcpd", "mcpd", "igmp_max_members", value);
return 0;
}
return 0;
}
int get_igmp_snooping_mode(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string("mcpd", "mcpd", "igmp_snooping_enable", value);
return 0;
}
int set_igmp_snooping_mode(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value("mcpd", "mcpd", "igmp_snooping_enable", value);
return 0;
}
return 0;
}
int get_igmp_snooping_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char *p;
dmuci_get_option_value_string("mcpd", "mcpd", "igmp_snooping_interfaces", value);
*value = dmstrdup(*value); // MEM WILL BE FREED IN DMMEMCLEAN
p = *value;
while (*p++) {
if (*p == ' ') *p = ',';
}
return 0;
}
int set_igmp_snooping_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
int i;
char *p;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
if (value[0] == '\0')
return 0;
value = dmstrdup(value);
p = value;
while (*p++) {
if (*p == ',') *p = ' ';
}
compress_spaces(value);
dmuci_set_value("mcpd", "mcpd", "igmp_snooping_interfaces", value);
dmfree(value);
return 0;
}
return 0;
}
DMLEAF tSe_IgmpParam[] = {
{"DifferentiateService", &DMWRITE, DMT_STRING, get_igmp_dscp_mark, set_igmp_dscp_mark, NULL, NULL},
{"ProxyInterface", &DMWRITE, DMT_STRING, get_igmp_proxy_interface, set_igmp_proxy_interface, NULL, NULL},
{"DefaultVersion", &DMWRITE, DMT_STRING, get_igmp_default_version, set_igmp_default_version, NULL, NULL},
{"QueryInterval", &DMWRITE, DMT_UNINT, get_igmp_query_interval, set_igmp_query_interval, NULL, NULL},
{"QueryResponseInterval", &DMWRITE, DMT_UNINT, get_igmp_query_response_interval, set_igmp_query_response_interval, NULL, NULL},
{"LastMemberQueryInterval", &DMWRITE, DMT_UNINT, get_igmp_last_member_queryinterval, set_igmp_last_member_queryinterval, NULL, NULL},
{"RobustnessValue", &DMWRITE, DMT_INT, get_igmp_robustness_value, set_igmp_robustness_value, NULL, NULL},
{"LanToLanMulticastEnable", &DMWRITE, DMT_BOOL, get_igmp_multicast_enable, set_igmp_multicast_enable, NULL, NULL},
{"MaxGroup", &DMWRITE, DMT_UNINT, get_igmp_maxgroup, set_igmp_maxgroup, NULL, NULL},
{"MaxSources", &DMWRITE, DMT_UNINT, get_igmp_maxsources, set_igmp_maxsources, NULL, NULL},
{"MaxMembers", &DMWRITE, DMT_UNINT, get_igmp_maxmembers, set_igmp_maxmembers, NULL, NULL},
{"FastLeaveEnable", &DMWRITE, DMT_BOOL, get_igmp_fastleave_enable, set_igmp_fastleave_enable, NULL, NULL},
{"JoinImmediateEnable", &DMWRITE, DMT_BOOL, get_igmp_joinimmediate_enable, set_igmp_joinimmediate_enable, NULL, NULL},
{"ProxyEnable", &DMWRITE, DMT_BOOL, get_igmp_proxy_enable, set_igmp_proxy_enable, NULL, NULL},
{"SnoopingMode", &DMWRITE, DMT_STRING, get_igmp_snooping_mode, set_igmp_snooping_mode, NULL, NULL},
{"SnoopingInterfaces", &DMWRITE, DMT_STRING, get_igmp_snooping_interface, set_igmp_snooping_interface, NULL, NULL},
{0}
};

View file

@ -1,6 +0,0 @@
#ifndef __SE_IGMP_H
#define __SE_IGMP_H
extern DMLEAF tSe_IgmpParam[];
#endif

View file

@ -1,830 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2015 Inteno Broadband Technology AB
* Author Imen Bhiri <imen.bhiri@pivasoftware.com>
* Author Omar Kallel <omar.kallel@pivasoftware.com>
*
*/
#include <uci.h>
#include <ctype.h>
#include "dmcwmp.h"
#include "dmuci.h"
#include "dmubus.h"
#include "dmcommon.h"
#include "x_iopsys_eu_ipacccfg.h"
/*** DMROOT.X_IOPSYS_EU_IpAccCfg. ***/
DMOBJ tSe_IpAccObj[] = {
/* OBJ, permission, addobj, delobj, browseinstobj, finform, notification, nextobj, leaf*/
{CUSTOM_PREFIX"IpAccListCfgObj", &DMWRITE, add_ipacccfg_rule, delete_ipacccfg_rule, NULL, browseAccListInst, NULL, NULL, NULL, tSe_IpAccCfgParam, NULL},
{CUSTOM_PREFIX"PortForwarding", &DMWRITE, add_ipacccfg_port_forwarding, delete_ipacccfg_port_forwarding, NULL, browseport_forwardingInst, NULL, NULL, NULL, tSe_PortForwardingParam, NULL},
{0}
};
DMLEAF tSe_PortForwardingParam[] = {
{"Alias", &DMWRITE, DMT_STRING, get_port_forwarding_alias, set_port_forwarding_alias, NULL, NULL},
{"Name", &DMWRITE, DMT_STRING, get_port_forwarding_name, set_port_forwarding_name, NULL, NULL},
{"Enable", &DMWRITE, DMT_BOOL, get_port_forwarding_enable, set_port_forwarding_enable, NULL, NULL},
{"EnalbeNatLoopback", &DMWRITE, DMT_BOOL, get_port_forwarding_loopback, set_port_forwarding_loopback, NULL, NULL},
{"Protocol", &DMWRITE, DMT_STRING, get_port_forwarding_protocol, set_port_forwarding_protocol, NULL, NULL},
{"ExternalZone", &DMWRITE, DMT_STRING, get_port_forwarding_external_zone, set_port_forwarding_external_zone, NULL, NULL},
{"InternalZone", &DMWRITE, DMT_STRING, get_port_forwarding_internal_zone, set_port_forwarding_internal_zone, NULL, NULL},
{"ExternalPort", &DMWRITE, DMT_STRING, get_port_forwarding_external_port, set_port_forwarding_external_port, NULL, NULL},
{"InternalPort", &DMWRITE, DMT_STRING, get_port_forwarding_internal_port, set_port_forwarding_internal_port, NULL, NULL},
{"SourcePort", &DMWRITE, DMT_STRING, get_port_forwarding_source_port, set_port_forwarding_source_port, NULL, NULL},
{"InternalIpAddress", &DMWRITE, DMT_STRING, get_port_forwarding_internal_ipaddress, set_port_forwarding_internal_ipaddress, NULL, NULL},
{"ExternalIpAddress", &DMWRITE, DMT_STRING, get_port_forwarding_external_ipaddress, set_port_forwarding_external_ipaddress, NULL, NULL},
{"SourceIpAddress", &DMWRITE, DMT_STRING, get_port_forwarding_source_ipaddress, set_port_forwarding_source_ipaddress, NULL, NULL},
{"SourceMacAddress", &DMWRITE, DMT_STRING, get_port_forwarding_src_mac, set_port_forwarding_src_mac, NULL, NULL},
{0}
};
DMLEAF tSe_IpAccCfgParam[] = {
{"Alias", &DMWRITE, DMT_STRING, get_x_iopsys_eu_cfgobj_address_alias, set_x_iopsys_eu_cfgobj_address_alias, NULL, NULL},
{"Enable", &DMWRITE, DMT_BOOL, get_x_bcm_com_ip_acc_list_cfgobj_enable, set_x_bcm_com_ip_acc_list_cfgobj_enable, NULL, NULL},
{"IPVersion", &DMWRITE, DMT_STRING, get_x_bcm_com_ip_acc_list_cfgobj_ipversion, set_x_bcm_com_ip_acc_list_cfgobj_ipversion, NULL, NULL},
{"Protocol", &DMWRITE, DMT_STRING, get_x_bcm_com_ip_acc_list_cfgobj_protocol, set_x_bcm_com_ip_acc_list_cfgobj_protocol, NULL, NULL},
{"FilterName", &DMWRITE, DMT_STRING, get_x_bcm_com_ip_acc_list_cfgobj_name, set_x_bcm_com_ip_acc_list_cfgobj_name, NULL, NULL},
{"AccAddressAndNetMask", &DMWRITE, DMT_STRING, get_x_iopsys_eu_cfgobj_address_netmask, set_x_iopsys_eu_cfgobj_address_netmask, NULL, NULL},
{"AccPort", &DMWRITE, DMT_STRING, get_x_bcm_com_ip_acc_list_cfgobj_acc_port, set_x_bcm_com_ip_acc_list_cfgobj_acc_port, NULL, NULL},
{"Target", &DMWRITE, DMT_STRING, get_x_bcm_com_ip_acc_list_cfgobj_target, set_x_bcm_com_ip_acc_list_cfgobj_target, NULL, NULL},
{0}
};
/*************************************************************************************
**** function related to get_object_ip_acc_list_cfgobj ****
**************************************************************************************/
int get_x_bcm_com_ip_acc_list_cfgobj_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *ipaccsection = (struct uci_section *)data;
dmuci_get_value_by_section_string(ipaccsection, "enabled", value);
if ((*value)[0] == '\0') {
*value = "1";
}
return 0;
}
int set_x_bcm_com_ip_acc_list_cfgobj_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
bool b;
int check;
struct uci_section *ipaccsection = (struct uci_section *)data;
switch (action) {
case VALUECHECK:
if (string_to_bool(value, &b))
return FAULT_9007;
return 0;
case VALUESET:
string_to_bool(value, &b);
if(b) {
value = "";
}
else {
value = "0";
}
dmuci_set_value_by_section(ipaccsection, "enabled", value);
return 0;
}
return 0;
}
int get_x_bcm_com_ip_acc_list_cfgobj_ipversion(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *ipaccsection = (struct uci_section *)data;
dmuci_get_value_by_section_string(ipaccsection, "family", value);
return 0;
}
int set_x_bcm_com_ip_acc_list_cfgobj_ipversion(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct uci_section *ipaccsection = (struct uci_section *)data;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section(ipaccsection, "family", value);
return 0;
}
return 0;
}
int get_x_bcm_com_ip_acc_list_cfgobj_protocol(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *ipaccsection = (struct uci_section *)data;
dmuci_get_value_by_section_string(ipaccsection, "proto", value);
return 0;
}
int set_x_bcm_com_ip_acc_list_cfgobj_protocol(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct uci_section *ipaccsection = (struct uci_section *)data;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section(ipaccsection, "proto", value);
return 0;
}
return 0;
}
int get_x_bcm_com_ip_acc_list_cfgobj_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *ipaccsection = (struct uci_section *)data;
dmuci_get_value_by_section_string(ipaccsection, "name", value);
return 0;
}
int set_x_bcm_com_ip_acc_list_cfgobj_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct uci_section *ipaccsection = (struct uci_section *)data;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section(ipaccsection, "name", value);
return 0;
}
return 0;
}
int get_x_iopsys_eu_cfgobj_address_netmask(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_list *val;
struct uci_element *e = NULL;
struct uci_section *ipaccsection = (struct uci_section *)data;
struct uci_list *list = NULL;
dmuci_get_value_by_section_list(ipaccsection, "src_ip", &val);
if (val) {
*value = dmuci_list_to_string(val, ",");
}
else
*value = "";
if ((*value)[0] == '\0') {
*value = "0.0.0.0/0";
return 0;
}
return 0;
}
int set_x_iopsys_eu_cfgobj_address_netmask(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
char *pch, *spch, *val;
struct uci_section *ipaccsection = (struct uci_section *)data;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_delete_by_section(ipaccsection, "src_ip", "");
val = dmstrdup(value);
pch = strtok_r(val, " ,", &spch);
while (pch != NULL) {
dmuci_add_list_value_by_section(ipaccsection, "src_ip", pch);
pch = strtok_r(NULL, " ,", &spch);
}
dmfree(val);
return 0;
}
return 0;
}
int get_x_bcm_com_ip_acc_list_cfgobj_acc_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *ipaccsection = (struct uci_section *)data;
dmuci_get_value_by_section_string(ipaccsection, "dest_port", value);
return 0;
}
int set_x_bcm_com_ip_acc_list_cfgobj_acc_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct uci_section *ipaccsection = (struct uci_section *)data;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section(ipaccsection, "dest_port", value);
return 0;
}
return 0;
}
int get_x_bcm_com_ip_acc_list_cfgobj_target(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *ipaccsection = (struct uci_section *)data;
dmuci_get_value_by_section_string(ipaccsection, "target", value);
return 0;
}
int set_x_bcm_com_ip_acc_list_cfgobj_target(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct uci_section *ipaccsection = (struct uci_section *)data;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section(ipaccsection, "target", value);
return 0;
}
return 0;
}
/*************************************************************************************
**** function related to get_cache_object_port_forwarding ****
**************************************************************************************/
int get_port_forwarding_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *forwardsection = (struct uci_section *)data;
dmuci_get_value_by_section_string(forwardsection, "name", value);
return 0;
}
int set_port_forwarding_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct uci_section *forwardsection = (struct uci_section *)data;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section(forwardsection, "name", value);
return 0;
}
return 0;
}
int get_port_forwarding_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *forwardsection = (struct uci_section *)data;
dmuci_get_value_by_section_string(forwardsection, "enabled", value);
return 0;
}
int set_port_forwarding_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
bool b;
int check;
struct uci_section *forwardsection = (struct uci_section *)data;
switch (action) {
case VALUECHECK:
if (string_to_bool(value, &b))
return FAULT_9007;
return 0;
case VALUESET:
string_to_bool(value, &b);
if(b)
dmuci_set_value_by_section(forwardsection, "enabled", "1");
else
dmuci_set_value_by_section(forwardsection, "enabled", "0");
return 0;
}
return 0;
}
int get_port_forwarding_loopback(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *forwardsection = (struct uci_section *)data;
dmuci_get_value_by_section_string(forwardsection, "reflection", value);
if((*value)[0] == '\0') {
*value = "1";
}
return 0;
}
int set_port_forwarding_loopback(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
bool b;
struct uci_section *forwardsection = (struct uci_section *)data;
switch (action) {
case VALUECHECK:
if (string_to_bool(value, &b))
return FAULT_9007;
return 0;
case VALUESET:
string_to_bool(value, &b);
if(b)
dmuci_set_value_by_section(forwardsection, "reflection", "1");
else
dmuci_set_value_by_section(forwardsection, "reflection", "0");
return 0;
}
return 0;
}
int get_port_forwarding_protocol(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *forwardsection = (struct uci_section *)data;
dmuci_get_value_by_section_string(forwardsection, "proto", value);
return 0;
}
int set_port_forwarding_protocol(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
char *pch;
struct uci_section *forwardsection = (struct uci_section *)data;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section(forwardsection, "proto", value);
return 0;
}
return 0;
}
int get_port_forwarding_external_zone(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *forwardsection = (struct uci_section *)data;
dmuci_get_value_by_section_string(forwardsection, "src", value);
return 0;
}
int set_port_forwarding_external_zone(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
char *pch;
struct uci_section *forwardsection = (struct uci_section *)data;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section(forwardsection, "src", value);
return 0;
}
return 0;
}
int get_port_forwarding_internal_zone(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *forwardsection = (struct uci_section *)data;
dmuci_get_value_by_section_string(forwardsection, "dest", value);
return 0;
}
int set_port_forwarding_internal_zone(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
char *pch;
struct uci_section *forwardsection = (struct uci_section *)data;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section(forwardsection, "dest", value);
return 0;
}
return 0;
}
int get_port_forwarding_external_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *forwardsection = (struct uci_section *)data;
dmuci_get_value_by_section_string(forwardsection, "src_dport", value);
return 0;
}
int set_port_forwarding_external_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
char *pch;
struct uci_section *forwardsection = (struct uci_section *)data;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section(forwardsection, "src_dport", value);
return 0;
}
return 0;
}
int get_port_forwarding_internal_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *forwardsection = (struct uci_section *)data;
dmuci_get_value_by_section_string(forwardsection, "dest_port", value);
if ((*value)[0] == '\0') {
*value = "any";
}
return 0;
}
int set_port_forwarding_internal_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
char *pch;
struct uci_section *forwardsection = (struct uci_section *)data;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
if (strcasecmp(value, "any") == 0) {
value = "";
}
dmuci_set_value_by_section(forwardsection, "dest_port", value);
return 0;
}
return 0;
}
int get_port_forwarding_source_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *forwardsection = (struct uci_section *)data;
dmuci_get_value_by_section_string(forwardsection, "src_port", value);
if ((*value)[0] == '\0') {
*value = "any";
}
return 0;
}
int set_port_forwarding_source_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
char *pch;
struct uci_section *forwardsection = (struct uci_section *)data;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
if (strcasecmp(value, "any") == 0) {
value = "";
}
dmuci_set_value_by_section(forwardsection, "src_port", value);
return 0;
}
return 0;
}
int get_port_forwarding_internal_ipaddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *forwardsection = (struct uci_section *)data;
dmuci_get_value_by_section_string(forwardsection, "dest_ip", value);
return 0;
}
int set_port_forwarding_internal_ipaddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
char *pch;
struct uci_section *forwardsection = (struct uci_section *)data;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section(forwardsection, "dest_ip", value);
return 0;
}
return 0;
}
int get_port_forwarding_external_ipaddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *forwardsection = (struct uci_section *)data;
dmuci_get_value_by_section_string(forwardsection, "src_dip", value);
if ((*value)[0] == '\0') {
*value = "any";
}
return 0;
}
int set_port_forwarding_external_ipaddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
char *pch;
struct uci_section *forwardsection = (struct uci_section *)data;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
if (strcasecmp(value, "any") == 0) {
value = "";
}
dmuci_set_value_by_section(forwardsection, "src_dip", value);
return 0;
}
return 0;
}
int get_port_forwarding_source_ipaddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_list *val;
struct uci_element *e = NULL;
struct uci_section *forwardsection = (struct uci_section *)data;
dmuci_get_value_by_section_list(forwardsection, "src_ip", &val);
if (val) {
*value = dmuci_list_to_string(val, ",");
}
else {
*value = "";
}
if ((*value)[0] == '\0') {
*value = "any";
}
return 0;
}
int set_port_forwarding_source_ipaddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
char *pch, *val, *spch;
struct uci_section *forwardsection = (struct uci_section *)data;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
if (strcasecmp(value, "any") == 0) {
dmuci_delete_by_section(forwardsection, "src_ip", "");
}
else {
dmuci_delete_by_section(forwardsection, "src_ip", "");
val = dmstrdup(value);
pch = strtok_r(val, " ,", &spch);
while (pch != NULL) {
dmuci_add_list_value_by_section(forwardsection, "src_ip", pch);
pch = strtok_r(NULL, " ,", &spch);
}
dmfree(val);
}
return 0;
}
return 0;
}
int get_port_forwarding_src_mac(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_list *list = NULL;
struct uci_section *forwardsection = (struct uci_section *)data;
dmuci_get_value_by_section_list(forwardsection, "src_mac", &list);
*value = dmuci_list_to_string(list, " ");
return 0;
}
int set_port_forwarding_src_mac(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
char *pch, *spch;
struct uci_section *forwardsection = (struct uci_section *)data;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_delete_by_section(forwardsection, "src_mac", NULL);
value = dmstrdup(value);
pch = strtok_r(value, " ", &spch);
while (pch != NULL) {
dmuci_add_list_value_by_section(forwardsection, "src_mac", pch);
pch = strtok_r(NULL, " ", &spch);
}
dmfree(value);
return 0;
}
return 0;
}
/***** ADD DEL OBJ *******/
int add_ipacccfg_rule(char *refparam, struct dmctx *ctx, void *data, char **instancepara)
{
char *value, *v;
char *instance;
struct uci_section *rule = NULL, *dmmap_rule= NULL;
check_create_dmmap_package("dmmap_firewall");
instance = get_last_instance_icwmpd("dmmap_firewall", "rule", "fruleinstance");
dmuci_add_section_and_rename("firewall", "rule", &rule, &value);
dmuci_set_value_by_section(rule, "type", "generic");
dmuci_set_value_by_section(rule, "name", "new_rule");
dmuci_set_value_by_section(rule, "proto", "all");
dmuci_set_value_by_section(rule, "target", "ACCPET");
dmuci_set_value_by_section(rule, "family", "ipv4");
dmuci_set_value_by_section(rule, "enabled", "1");
dmuci_set_value_by_section(rule, "hidden", "1");
dmuci_set_value_by_section(rule, "parental", "0");
dmuci_add_section_icwmpd("dmmap_firewall", "rule", &dmmap_rule, &v);
dmuci_set_value_by_section(dmmap_rule, "section_name", section_name(rule));
*instancepara = update_instance_icwmpd(dmmap_rule, instance, "fruleinstance");
return 0;
}
int delete_ipacccfg_rule(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action)
{
struct uci_section *s = NULL;
struct uci_section *ss = NULL;
int found = 0;
struct uci_section *ipaccsection = (struct uci_section *)data;
struct uci_section *dmmap_section;
switch (del_action) {
case DEL_INST:
get_dmmap_section_of_config_section("dmmap_firewall", "rule", section_name(ipaccsection), &dmmap_section);
dmuci_delete_by_section(dmmap_section, NULL, NULL);
dmuci_delete_by_section(ipaccsection, NULL, NULL);
break;
case DEL_ALL:
uci_foreach_sections("firewall", "rule", s) {
if (found != 0){
get_dmmap_section_of_config_section("dmmap_firewall", "rule", section_name(s), &dmmap_section);
if(dmmap_section != NULL)
dmuci_delete_by_section(dmmap_section, NULL, NULL);
dmuci_delete_by_section(ss, NULL, NULL);
}
ss = s;
found++;
}
if (ss != NULL){
get_dmmap_section_of_config_section("dmmap_firewall", "rule", section_name(ss), &dmmap_section);
if(dmmap_section != NULL)
dmuci_delete_by_section(dmmap_section, NULL, NULL);
dmuci_delete_by_section(ss, NULL, NULL);
}
break;
}
return 0;
}
int add_ipacccfg_port_forwarding(char *refparam, struct dmctx *ctx, void *data, char **instancepara)
{
char *value, *v;
char *instance;
struct uci_section *redirect = NULL, *dmmap_redirect= NULL;
check_create_dmmap_package("dmmap_firewall");
instance = get_last_instance_icwmpd("dmmap_firewall", "redirect", "forwardinstance");
dmuci_add_section_and_rename("firewall", "redirect", &redirect, &value);
dmuci_set_value_by_section(redirect, "enabled", "0");
dmuci_set_value_by_section(redirect, "target", "DNAT");
dmuci_set_value_by_section(redirect, "proto", "tcp udp");
dmuci_add_section_icwmpd("dmmap_firewall", "redirect", &dmmap_redirect, &v);
dmuci_set_value_by_section(dmmap_redirect, "section_name", section_name(redirect));
*instancepara = update_instance_icwmpd(dmmap_redirect, instance, "forwardinstance");
return 0;
}
int delete_ipacccfg_port_forwarding(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action)
{
int found = 0;
struct pforwardrgs *forwardargs;
struct uci_section *s = NULL;
struct uci_section *ss = NULL;
struct uci_section *forwardsection = (struct uci_section *)data;
struct uci_section *dmmap_section;
switch (del_action) {
case DEL_INST:
get_dmmap_section_of_config_section("dmmap_firewall", "redirect", section_name(forwardsection), &dmmap_section);
dmuci_delete_by_section(dmmap_section, NULL, NULL);
dmuci_delete_by_section(forwardsection, NULL, NULL);
break;
case DEL_ALL:
uci_foreach_option_eq("firewall", "redirect", "target", "DNAT", s) {
if (found != 0){
get_dmmap_section_of_config_section("dmmap_firewall", "redirect", section_name(s), &dmmap_section);
if(dmmap_section != NULL)
dmuci_delete_by_section(dmmap_section, NULL, NULL);
dmuci_delete_by_section(ss, NULL, NULL);
}
ss = s;
found++;
}
if (ss != NULL){
get_dmmap_section_of_config_section("dmmap_firewall", "redirect", section_name(ss), &dmmap_section);
if(dmmap_section != NULL)
dmuci_delete_by_section(dmmap_section, NULL, NULL);
dmuci_delete_by_section(ss, NULL, NULL);
}
break;
}
return 0;
}
////////////////////////SET AND GET ALIAS/////////////////////////////////
int get_x_iopsys_eu_cfgobj_address_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *ipaccsection = (struct uci_section *)data;
struct uci_section *dmmap_section;
get_dmmap_section_of_config_section("dmmap_firewall", "rule", section_name(ipaccsection), &dmmap_section);
dmuci_get_value_by_section_string(dmmap_section, "frulealias", value);
return 0;
}
int set_x_iopsys_eu_cfgobj_address_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct uci_section *ipaccsection = (struct uci_section *)data;
struct uci_section *dmmap_section;
get_dmmap_section_of_config_section("dmmap_firewall", "rule", section_name(ipaccsection), &dmmap_section);
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section(dmmap_section, "frulealias", value);
return 0;
}
return 0;
}
int get_port_forwarding_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *forwardsection = (struct uci_section *)data;
struct uci_section *dmmap_section;
get_dmmap_section_of_config_section("dmmap_firewall", "redirect", section_name(forwardsection), &dmmap_section);
dmuci_get_value_by_section_string(dmmap_section, "forwardalias", value);
return 0;
}
int set_port_forwarding_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct uci_section *forwardsection = (struct uci_section *)data;
struct uci_section *dmmap_section;
get_dmmap_section_of_config_section("dmmap_firewall", "redirect", section_name(forwardsection), &dmmap_section);
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section(dmmap_section, "forwardalias", value);
return 0;
}
return 0;
}
int browseAccListInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *irule = NULL, *irule_last = NULL;
struct uci_section *s = NULL;
struct dmmap_dup *p;
LIST_HEAD(dup_list);
synchronize_specific_config_sections_with_dmmap("firewall", "rule", "dmmap_firewall", &dup_list);
list_for_each_entry(p, &dup_list, list) {
irule = handle_update_instance(1, dmctx, &irule_last, update_instance_alias_icwmpd, 3, p->dmmap_section, "fruleinstance", "frulealias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, irule) == DM_STOP)
return 0;
}
free_dmmap_config_dup_list(&dup_list);
return 0;
}
int browseport_forwardingInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *iforward = NULL, *iforward_last = NULL;
struct uci_section *s = NULL;
struct dmmap_dup *p;
LIST_HEAD(dup_list);
synchronize_specific_config_sections_with_dmmap_eq("firewall", "redirect", "dmmap_firewall", "target", "DNAT", &dup_list);
list_for_each_entry(p, &dup_list, list) {
iforward = handle_update_instance(1, dmctx, &iforward_last, update_instance_alias, 3, p->dmmap_section, "forwardinstance", "forwardalias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, iforward) == DM_STOP)
break;
}
free_dmmap_config_dup_list(&dup_list);
return 0;
}

View file

@ -1,64 +0,0 @@
#ifndef __SE_IPACCCFG_H
#define __SE_IPACCCFG_H
extern DMOBJ tSe_IpAccObj[];
extern DMLEAF tSe_IpAccCfgParam[];
extern DMLEAF tSe_PortForwardingParam[];
int browseport_forwardingInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseAccListInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int add_ipacccfg_port_forwarding(char *refparam, struct dmctx *ctx, void *data, char **instancepara);
int delete_ipacccfg_port_forwarding(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
int add_ipacccfg_rule(char *refparam, struct dmctx *ctx, void *data, char **instancepara);
int delete_ipacccfg_rule(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
int get_port_forwarding_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_port_forwarding_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_port_forwarding_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_port_forwarding_loopback(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_port_forwarding_protocol(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_port_forwarding_external_zone(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_port_forwarding_internal_zone(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_port_forwarding_external_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_port_forwarding_internal_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_port_forwarding_source_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_port_forwarding_internal_ipaddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_port_forwarding_external_ipaddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_port_forwarding_source_ipaddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_port_forwarding_src_mac(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_x_iopsys_eu_cfgobj_address_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_x_bcm_com_ip_acc_list_cfgobj_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_x_bcm_com_ip_acc_list_cfgobj_ipversion(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_x_bcm_com_ip_acc_list_cfgobj_protocol(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_x_bcm_com_ip_acc_list_cfgobj_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_x_iopsys_eu_cfgobj_address_netmask(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_x_bcm_com_ip_acc_list_cfgobj_acc_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_x_bcm_com_ip_acc_list_cfgobj_target(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_port_forwarding_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_port_forwarding_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_port_forwarding_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_port_forwarding_loopback(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_port_forwarding_protocol(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_port_forwarding_external_zone(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_port_forwarding_internal_zone(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_port_forwarding_external_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_port_forwarding_internal_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_port_forwarding_source_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_port_forwarding_internal_ipaddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_port_forwarding_external_ipaddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_port_forwarding_source_ipaddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_port_forwarding_src_mac(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_x_iopsys_eu_cfgobj_address_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_x_bcm_com_ip_acc_list_cfgobj_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_x_bcm_com_ip_acc_list_cfgobj_ipversion(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_x_bcm_com_ip_acc_list_cfgobj_protocol(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_x_bcm_com_ip_acc_list_cfgobj_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_x_iopsys_eu_cfgobj_address_netmask(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_x_bcm_com_ip_acc_list_cfgobj_acc_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_x_bcm_com_ip_acc_list_cfgobj_target(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
#endif

View file

@ -1,62 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2015 Inteno Broadband Technology AB
* Author Imen Bhiri <imen.bhiri@pivasoftware.com>
*
*/
#include <uci.h>
#include "dmcwmp.h"
#include "dmuci.h"
#include "dmubus.h"
#include "dmcommon.h"
#include "x_iopsys_eu_logincfg.h"
/*** DMROOT.X_IOPSYS_EU_LoginCfg. ***/
DMLEAF tSe_LoginCfgParam[] = {
{"AdminPassword", &DMWRITE, DMT_STRING, get_empty, set_x_bcm_admin_password, NULL, NULL},
{"SupportPassword", &DMWRITE, DMT_STRING, get_empty, set_x_bcm_support_password, NULL, NULL},
{"UserPassword", &DMWRITE, DMT_STRING, get_empty, set_x_bcm_user_password, NULL, NULL},
{"RootPassword", &DMWRITE, DMT_STRING, get_empty, set_x_bcm_root_password, NULL, NULL},
{0}
};
int set_x_bcm_password(char *refparam, struct dmctx *ctx, int action, char *value, char *user_type)
{
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value("passwords", user_type, "password", value);
return 0;
}
return 0;
}
int set_x_bcm_admin_password(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
set_x_bcm_password(refparam, ctx, action, value, "admin");
return 0;
}
int set_x_bcm_support_password(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
set_x_bcm_password(refparam, ctx, action, value, "support");
return 0;
}
int set_x_bcm_user_password(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
set_x_bcm_password(refparam, ctx, action, value, "user");
return 0;
}
int set_x_bcm_root_password(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
set_x_bcm_password(refparam, ctx, action, value, "root");
return 0;
}

View file

@ -1,11 +0,0 @@
#ifndef __SE_LOGINCFG_H
#define __SE_LOGINCFG_H
extern DMLEAF tSe_LoginCfgParam[];
int set_x_bcm_admin_password(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_x_bcm_support_password(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_x_bcm_user_password(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_x_bcm_root_password(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
#endif

View file

@ -1,591 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2015 Inteno Broadband Technology AB
* Author Imen Bhiri <imen.bhiri@pivasoftware.com>
* Author Omar Kallel <omar.kallel@pivasoftware.com>
*
*/
#include <uci.h>
#include <ctype.h>
#include "dmcwmp.h"
#include "dmuci.h"
#include "dmubus.h"
#include "dmcommon.h"
#include "dmentry.h"
#include "x_iopsys_eu_owsd.h"
/*** DMROOT.X_IOPSYS_EU_Owsd. ***/
DMLEAF XIopsysEuOwsdParams[] = {
/* PARAM, permission, type, getvlue, setvalue, forced_inform, NOTIFICATION, linker*/
{"Socket", &DMWRITE, DMT_STRING, get_x_iopsys_eu_owsd_global_sock, set_x_iopsys_eu_owsd_global_sock, NULL, NULL},
{"Redirect", &DMWRITE, DMT_STRING, get_x_iopsys_eu_owsd_global_redirect, set_x_iopsys_eu_owsd_global_redirect, NULL, NULL},
{0}
};
DMOBJ XIopsysEuOwsdObj[] = {
/* OBJ, permission, addobj, delobj, browseinstobj, finform, nextobj, leaf*/
{CUSTOM_PREFIX"UbusProxy", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, UbusProxyParams, NULL},
{CUSTOM_PREFIX"ListenObj", &DMWRITE, add_owsd_listen, delete_owsd_listen_instance, NULL, browseXIopsysEuOwsdListenObj, NULL, NULL, NULL, X_IOPSYS_EU_ListenObjParams, NULL},
{0}
};
DMLEAF UbusProxyParams[] = {
/* PARAM, permission, type, getvlue, setvalue, forced_inform, NOTIFICATION, linker*/
{"Enable", &DMWRITE, DMT_BOOL, get_x_iopsys_eu_owsd_ubus_proxy_enable, set_x_iopsys_eu_owsd_ubus_proxy_enable, NULL, NULL},
{"UbusProxyCert", &DMWRITE, DMT_STRING, get_x_iopsys_eu_owsd_ubus_proxy_cert, set_x_iopsys_eu_owsd_ubus_proxy_cert, NULL, NULL},
{"UbusProxyKey", &DMWRITE, DMT_STRING, get_x_iopsys_eu_owsd_ubus_proxy_key, set_x_iopsys_eu_owsd_ubus_proxy_key, NULL, NULL},
{"UbusProxyCa", &DMWRITE, DMT_STRING, get_x_iopsys_eu_owsd_ubus_proxy_ca, set_x_iopsys_eu_owsd_ubus_proxy_ca, NULL, NULL},
{0}
};
DMLEAF X_IOPSYS_EU_ListenObjParams[] = {
/* PARAM, permission, type, getvlue, setvalue, forced_inform, NOTIFICATION, linker*/
{"Alias", &DMWRITE, DMT_STRING, get_x_iopsys_eu_owsd_listenobj_alias, set_x_iopsys_eu_owsd_listenobj_alias, NULL, NULL},
{"Port", &DMWRITE, DMT_UNINT, get_x_iopsys_eu_owsd_listenobj_port, set_x_iopsys_eu_owsd_listenobj_port, NULL, NULL},
{"Interface", &DMWRITE, DMT_STRING, get_x_iopsys_eu_owsd_listenobj_interface, set_x_iopsys_eu_owsd_listenobj_interface, NULL, NULL},
{"Ipv6", &DMWRITE, DMT_BOOL, get_x_iopsys_eu_owsd_listenobj_ipv6_enable, set_x_iopsys_eu_owsd_listenobj_ipv6_enable, NULL, NULL},
{"Whitelist_interface", &DMWRITE, DMT_BOOL, get_x_iopsys_eu_owsd_listenobj_whitelist_interface, set_x_iopsys_eu_owsd_listenobj_whitelist_interface, NULL, NULL},
{"Whitelist_dhcp", &DMWRITE, DMT_BOOL, get_x_iopsys_eu_owsd_listenobj_whitelist_dhcp, set_x_iopsys_eu_owsd_listenobj_whitelist_dhcp, NULL, NULL},
{"Origin", &DMWRITE, DMT_STRING, get_x_iopsys_eu_owsd_listenobj_origin, set_x_iopsys_eu_owsd_listenobj_origin, NULL, NULL},
{"UbusCert", &DMWRITE, DMT_STRING, get_x_iopsys_eu_owsd_ubus_cert, set_x_iopsys_eu_owsd_ubus_cert, NULL, NULL},
{"UbusKey", &DMWRITE, DMT_STRING, get_x_iopsys_eu_owsd_ubus_key, set_x_iopsys_eu_owsd_ubus_key, NULL, NULL},
{"UbusCa", &DMWRITE, DMT_STRING, get_x_iopsys_eu_owsd_ubus_ca, set_x_iopsys_eu_owsd_ubus_ca, NULL, NULL},
{0}
};
int browseXIopsysEuOwsdListenObj(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *iowsd_listen = NULL, *iowsd_listen_last = NULL;
struct uci_section *s = NULL;
struct dmmap_dup *p;
LIST_HEAD(dup_list);
synchronize_specific_config_sections_with_dmmap("owsd", "owsd-listen", "dmmap_owsd", &dup_list);
list_for_each_entry(p, &dup_list, list) {
iowsd_listen = handle_update_instance(1, dmctx, &iowsd_listen_last, update_instance_alias_icwmpd, 3, p->dmmap_section, "olisteninstance", "olistenalias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, iowsd_listen) == DM_STOP)
break;
}
free_dmmap_config_dup_list(&dup_list);
return 0;
}
/*************************************************************************************
**** function related to owsd_origin ****
**************************************************************************************/
int get_x_iopsys_eu_owsd_global_sock(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string("owsd", "global", "sock", value);
return 0;
}
int set_x_iopsys_eu_owsd_global_sock(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value("owsd", "global", "sock", value);
return 0;
}
return 0;
}
int get_x_iopsys_eu_owsd_global_redirect(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string("owsd", "global", "redirect", value);
return 0;
}
int set_x_iopsys_eu_owsd_global_redirect(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value("owsd", "global", "redirect", value);
return 0;
}
return 0;
}
/*************************************************************************************
**** function related to owsd_listenobj ****
**************************************************************************************/
int get_x_iopsys_eu_owsd_listenobj_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *owsd_listensection = (struct uci_section *)data;
dmuci_get_value_by_section_string(owsd_listensection, "port", value);
if ((*value)[0] == '\0') {
*value = "";
}
return 0;
}
int set_x_iopsys_eu_owsd_listenobj_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct uci_section *owsd_listensection = (struct uci_section *)data;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section(owsd_listensection, "port", value);
return 0;
}
return 0;
}
int get_x_iopsys_eu_owsd_listenobj_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char *iface, *linker;
char *uci_datamodel = NULL;
struct uci_section *owsd_listensection = (struct uci_section *)data;
dmuci_get_value_by_section_string(owsd_listensection, "interface", &iface);
dmuci_get_option_value_string("cwmp", "cpe", "datamodel", &uci_datamodel);
if( (strcasecmp(uci_datamodel, "tr181") == 0) || (strcasecmp(uci_datamodel, "tr-181") == 0))
{
if (iface[0] != '\0') {
adm_entry_get_linker_param(ctx, dm_print_path("%s%cIP%cInterface%c", dmroot, dm_delim, dm_delim, dm_delim), iface, value); // MEM WILL BE FREED IN DMMEMCLEAN
if (*value == NULL)
*value = "";
}
}
else
{
if (iface[0] != '\0') {
dmastrcat(&linker, "linker_interface:", iface);
adm_entry_get_linker_param(ctx, dm_print_path("%s%cWANDevice%c", dmroot, dm_delim, dm_delim), linker, value); // MEM WILL BE FREED IN DMMEMCLEAN
if (*value == NULL) {
adm_entry_get_linker_param(ctx, dm_print_path("%s%cLANDevice%c", dmroot, dm_delim, dm_delim), linker, value); // MEM WILL BE FREED IN DMMEMCLEAN
if (*value == NULL)
*value = "";
}
dmfree(linker);
}
}
return 0;
}
int set_x_iopsys_eu_owsd_listenobj_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
int check;
char *linker, *iface;
char *uci_datamodel = NULL;
struct uci_section *owsd_listensection = (struct uci_section *)data;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
adm_entry_get_linker_value(ctx, value, &linker);
if (linker) {
dmuci_get_option_value_string("cwmp", "cpe", "datamodel", &uci_datamodel);
if( (strcasecmp(uci_datamodel, "tr098") == 0) || (strcasecmp(uci_datamodel, "tr-098") == 0) || (strcasecmp(uci_datamodel, "tr98") == 0) || (strcasecmp(uci_datamodel, "tr-98") == 0) ) {
iface = linker + sizeof("linker_interface:") - 1;
}
else
iface = linker;
dmuci_set_value_by_section(owsd_listensection, "interface", iface);
dmfree(linker);
}
return 0;
}
return 0;
}
int get_x_iopsys_eu_owsd_listenobj_ipv6_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *owsd_listensection = (struct uci_section *)data;
dmuci_get_value_by_section_string(owsd_listensection, "ipv6", value);
if ((*value)[0] != '\0' && (*value)[0] == 'o' && (*value)[1] == 'n' ) {
*value = "1";
}
else
*value = "0";
return 0;
}
int set_x_iopsys_eu_owsd_listenobj_ipv6_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
bool b;
struct uci_section *owsd_listensection = (struct uci_section *)data;
switch (action) {
case VALUECHECK:
if (string_to_bool(value, &b))
return FAULT_9007;
return 0;
case VALUESET:
string_to_bool(value, &b);
if(b)
dmuci_set_value_by_section(owsd_listensection, "ipv6", "on");
else
dmuci_set_value_by_section(owsd_listensection, "ipv6", "off");
return 0;
}
return 0;
}
int get_x_iopsys_eu_owsd_listenobj_whitelist_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *owsd_listensection = (struct uci_section *)data;
dmuci_get_value_by_section_string(owsd_listensection, "whitelist_interface_as_origin", value);
if ((*value)[0] == '\0' ) {
*value = "0";
}
return 0;
}
int set_x_iopsys_eu_owsd_listenobj_whitelist_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
bool b;
struct uci_section *owsd_listensection = (struct uci_section *)data;
switch (action) {
case VALUECHECK:
if (string_to_bool(value, &b))
return FAULT_9007;
return 0;
case VALUESET:
string_to_bool(value, &b);
if(b)
dmuci_set_value_by_section(owsd_listensection, "whitelist_interface_as_origin", "1");
else
dmuci_set_value_by_section(owsd_listensection, "whitelist_interface_as_origin", "0");
return 0;
}
return 0;
}
int get_x_iopsys_eu_owsd_listenobj_whitelist_dhcp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *owsd_listensection = (struct uci_section *)data;
dmuci_get_value_by_section_string(owsd_listensection, "whitelist_dhcp_domains", value);
if ((*value)[0] == '\0') {
*value = "0";
}
return 0;
}
int set_x_iopsys_eu_owsd_listenobj_whitelist_dhcp(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
bool b;
struct uci_section *owsd_listensection = (struct uci_section *)data;
switch (action) {
case VALUECHECK:
if (string_to_bool(value, &b))
return FAULT_9007;
return 0;
case VALUESET:
string_to_bool(value, &b);
if(b)
dmuci_set_value_by_section(owsd_listensection, "whitelist_dhcp_domains", "1");
else
dmuci_set_value_by_section(owsd_listensection, "whitelist_dhcp_domains", "0");
return 0;
}
return 0;
}
int get_x_iopsys_eu_owsd_listenobj_origin(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_list *val;
struct uci_section *owsd_listensection = (struct uci_section *)data;
dmuci_get_value_by_section_list(owsd_listensection, "origin", &val);
if (val)
*value = dmuci_list_to_string(val, " ");
else
*value = "";
return 0;
}
int set_x_iopsys_eu_owsd_listenobj_origin(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
char *pch, *spch;
struct uci_section *owsd_listensection = (struct uci_section *)data;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_delete_by_section(owsd_listensection, "origin", NULL);
value = dmstrdup(value);
pch = strtok_r(value, " ", &spch);
while (pch != NULL) {
dmuci_add_list_value_by_section(owsd_listensection, "origin", pch);
pch = strtok_r(NULL, " ", &spch);
}
dmfree(value);
return 0;
}
return 0;
}
////////////////////////SET AND GET ALIAS/////////////////////////////////
int get_x_iopsys_eu_owsd_listenobj_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *owsd_listensection = (struct uci_section *)data;
struct uci_section *dmmap_section;
get_dmmap_section_of_config_section("dmmap_owsd", "owsd-listen", section_name(owsd_listensection), &dmmap_section);
dmuci_get_value_by_section_string(dmmap_section, "olistenalias", value);
return 0;
}
int set_x_iopsys_eu_owsd_listenobj_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct uci_section *owsd_listensection = (struct uci_section *)data;
struct uci_section *dmmap_section;
get_dmmap_section_of_config_section("dmmap_owsd", "owsd-listen", section_name(owsd_listensection), &dmmap_section);
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section(dmmap_section, "olistenalias", value);
return 0;
}
return 0;
}
int get_x_iopsys_eu_owsd_ubus_proxy_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string("owsd","ubusproxy","enable", value);
return 0;
}
int set_x_iopsys_eu_owsd_ubus_proxy_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value("owsd", "ubusproxy", "enable", value);
return 0;
}
return 0;
}
int get_x_iopsys_eu_owsd_ubus_proxy_cert(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string("owsd","ubusproxy","peer_cert", value);
return 0;
}
int set_x_iopsys_eu_owsd_ubus_proxy_cert(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value("owsd", "ubusproxy", "peer_cert", value);
return 0;
}
return 0;
}
int get_x_iopsys_eu_owsd_ubus_proxy_key(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string("owsd","ubusproxy","peer_key", value);
return 0;
}
int set_x_iopsys_eu_owsd_ubus_proxy_key(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value("owsd", "ubusproxy", "peer_key", value);
return 0;
}
return 0;
}
int get_x_iopsys_eu_owsd_ubus_proxy_ca(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string("owsd","ubusproxy","peer_ca", value);
return 0;
}
int set_x_iopsys_eu_owsd_ubus_proxy_ca(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value("owsd", "ubusproxy", "peer_ca", value);
return 0;
}
return 0;
}
int get_x_iopsys_eu_owsd_ubus_cert(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *owsd_listensection = (struct uci_section *)data;
char *net_cur_mode = NULL;
dmuci_get_option_value_string("netmode", "setup", "curmode", &net_cur_mode);
if(strstr(net_cur_mode, "repeater") || strstr(net_cur_mode, "extender")) {
dmuci_get_value_by_section_string(owsd_listensection, "cert", value);
}
return 0;
}
int set_x_iopsys_eu_owsd_ubus_cert(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct uci_section *owsd_listensection = (struct uci_section *)data;
char *net_cur_mode = NULL;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_get_option_value_string("netmode", "setup", "curmode", &net_cur_mode);
if(strstr(net_cur_mode, "repeater") || strstr(net_cur_mode, "extender")){
if(strcmp(section_name(owsd_listensection), "wan_https")== 0)
dmuci_set_value_by_section(owsd_listensection, "cert", value);
}
return 0;
}
return 0;
}
int get_x_iopsys_eu_owsd_ubus_key(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *owsd_listensection = (struct uci_section *)data;
char *net_cur_mode= NULL;
dmuci_get_option_value_string("netmode", "setup", "curmode", &net_cur_mode);
if(strstr(net_cur_mode, "repeater") || strstr(net_cur_mode, "extender")) {
dmuci_get_value_by_section_string(owsd_listensection, "key", value);
}
return 0;
}
int set_x_iopsys_eu_owsd_ubus_key(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct uci_section *owsd_listensection = (struct uci_section *)data;
char *net_cur_mode = NULL;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_get_option_value_string("netmode", "setup", "curmode", &net_cur_mode);
if(strstr(net_cur_mode, "repeater") || strstr(net_cur_mode, "extender")) {
if(strcmp(section_name(owsd_listensection), "wan_https")== 0)
dmuci_set_value_by_section(owsd_listensection, "key", value);
}
return 0;
}
return 0;
}
int get_x_iopsys_eu_owsd_ubus_ca(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *owsd_listensection = (struct uci_section *)data;
char *net_cur_mode = NULL;
dmuci_get_option_value_string("netmode", "setup", "curmode", &net_cur_mode);
if(strstr(net_cur_mode, "repeater") || strstr(net_cur_mode, "extender")){
dmuci_get_value_by_section_string(owsd_listensection, "ca", value);
}
return 0;
}
int set_x_iopsys_eu_owsd_ubus_ca(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct uci_section *owsd_listensection = (struct uci_section *)data;
char *net_cur_mode = NULL;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_get_option_value_string("netmode", "setup", "curmode", &net_cur_mode);
if(strstr(net_cur_mode, "repeater") || strstr(net_cur_mode, "extender")) {
if(strcmp(section_name(owsd_listensection), "wan_https")== 0)
dmuci_set_value_by_section(owsd_listensection, "ca", value);
}
return 0;
}
return 0;
}
/***** ADD DEL OBJ *******/
int add_owsd_listen(char *refparam, struct dmctx *ctx, void *data, char **instancepara)
{
char *value, *v;
char *instance;
struct uci_section *listen_sec = NULL, *dmmap_sec= NULL;
check_create_dmmap_package("dmmap_owsd");
instance = get_last_instance_icwmpd("dmmap_owsd", "owsd-listen", "olisteninstance");
dmuci_add_section("owsd", "owsd-listen", &listen_sec, &value);
dmuci_set_value_by_section(listen_sec, "ipv6", "on");
dmuci_set_value_by_section(listen_sec, "whitelist_interface_as_origin", "1");
dmuci_add_list_value_by_section(listen_sec, "origin", "*");
dmuci_add_section_icwmpd("dmmap_owsd", "owsd-listen", &dmmap_sec, &v);
dmuci_set_value_by_section(dmmap_sec, "section_name", section_name(listen_sec));
*instancepara = update_instance_icwmpd(dmmap_sec, instance, "olisteninstance");
return 0;
}
int delete_owsd_listen_instance(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action)
{
struct uci_section *s = NULL;
struct uci_section *ss = NULL;
struct uci_section *owsd_listensection = (struct uci_section *)data;
struct uci_section *dmmap_section;
int found = 0;
switch (del_action) {
case DEL_INST:
if(is_section_unnamed(section_name(owsd_listensection))){
LIST_HEAD(dup_list);
delete_sections_save_next_sections("dmmap_owsd", "owsd-listen", "olisteninstance", section_name(owsd_listensection), atoi(instance), &dup_list);
update_dmmap_sections(&dup_list, "olisteninstance", "dmmap_owsd", "owsd-listen");
dmuci_delete_by_section_unnamed(owsd_listensection, NULL, NULL);
} else {
get_dmmap_section_of_config_section("dmmap_owsd", "owsd-listen", section_name(owsd_listensection), &dmmap_section);
dmuci_delete_by_section_unnamed_icwmpd(dmmap_section, NULL, NULL);
dmuci_delete_by_section(owsd_listensection, NULL, NULL);
}
break;
case DEL_ALL:
uci_foreach_sections("owsd", "owsd-listen", s) {
if (found != 0){
get_dmmap_section_of_config_section("dmmap_owsd", "listen", section_name(s), &dmmap_section);
if(dmmap_section != NULL)
dmuci_delete_by_section(dmmap_section, NULL, NULL);
dmuci_delete_by_section(ss, NULL, NULL);
}
ss = s;
found++;
}
if (ss != NULL){
get_dmmap_section_of_config_section("dmmap_owsd", "listen", section_name(ss), &dmmap_section);
if(dmmap_section != NULL)
dmuci_delete_by_section(dmmap_section, NULL, NULL);
dmuci_delete_by_section(ss, NULL, NULL);
}
return 0;
}
return 0;
}

View file

@ -1,47 +0,0 @@
#ifndef __SE_OWSD_H
#define __SE_OWSD_H
int browseXIopsysEuOwsdListenObj(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int get_x_iopsys_eu_owsd_global_sock(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_x_iopsys_eu_owsd_global_sock(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_x_iopsys_eu_owsd_global_redirect(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_x_iopsys_eu_owsd_global_redirect(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_x_iopsys_eu_owsd_listenobj_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_x_iopsys_eu_owsd_listenobj_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_x_iopsys_eu_owsd_listenobj_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_x_iopsys_eu_owsd_listenobj_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_x_iopsys_eu_owsd_listenobj_ipv6_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_x_iopsys_eu_owsd_listenobj_ipv6_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_x_iopsys_eu_owsd_listenobj_whitelist_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_x_iopsys_eu_owsd_listenobj_whitelist_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_x_iopsys_eu_owsd_listenobj_whitelist_dhcp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_x_iopsys_eu_owsd_listenobj_whitelist_dhcp(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_x_iopsys_eu_owsd_listenobj_origin(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_x_iopsys_eu_owsd_listenobj_origin(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_x_iopsys_eu_owsd_listenobj_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_x_iopsys_eu_owsd_listenobj_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_x_iopsys_eu_owsd_ubus_proxy_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_x_iopsys_eu_owsd_ubus_proxy_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_x_iopsys_eu_owsd_ubus_proxy_cert(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_x_iopsys_eu_owsd_ubus_proxy_cert(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_x_iopsys_eu_owsd_ubus_proxy_key(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_x_iopsys_eu_owsd_ubus_proxy_key(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_x_iopsys_eu_owsd_ubus_proxy_ca(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_x_iopsys_eu_owsd_ubus_proxy_ca(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_x_iopsys_eu_owsd_ubus_cert(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_x_iopsys_eu_owsd_ubus_cert(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_x_iopsys_eu_owsd_ubus_key(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_x_iopsys_eu_owsd_ubus_key(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_x_iopsys_eu_owsd_ubus_ca(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_x_iopsys_eu_owsd_ubus_ca(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int add_owsd_listen(char *refparam, struct dmctx *ctx, void *data, char **instancepara);
int delete_owsd_listen_instance(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
extern DMLEAF XIopsysEuOwsdParams[];
extern DMOBJ XIopsysEuOwsdObj[];
extern DMLEAF X_IOPSYS_EU_ListenObjParams[];
extern DMLEAF UbusProxyParams[];
#endif

View file

@ -1,121 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2012-2014 PIVA SOFTWARE (www.pivasoftware.com)
* Author: Imen Bhiri <imen.bhiri@pivasoftware.com>
* Author: Feten Besbes <feten.besbes@pivasoftware.com>
* Author: Mohamed Kallel <mohamed.kallel@pivasoftware.com>
* Author: Anis Ellouze <anis.ellouze@pivasoftware.com>
*/
#include <unistd.h>
#include "dmcwmp.h"
#include "dmuci.h"
#include "dmcommon.h"
#include "x_iopsys_eu_power_mgmt.h"
/*** DMROOT.X_IOPSYS_EU_PowerManagement. ***/
DMLEAF tSe_PowerManagementParam[] = {
{"EthernetAutoPowerDownEnable", &DMWRITE, DMT_BOOL, get_pwr_mgmt_value_ethapd, set_power_mgmt_param_ethapd, NULL, NULL},
{"EnergyEfficientEthernetEnable", &DMWRITE, DMT_BOOL, get_pwr_mgmt_value_eee, set_power_mgmt_param_eee, NULL, NULL},
{"NumberOfEthernetInterfacesPoweredUp", &DMREAD, DMT_UNINT, get_pwr_nbr_interfaces_up, NULL, NULL, NULL},
{"NumberOfEthernetInterfacesPoweredDown", &DMREAD, DMT_UNINT, get_pwr_nbr_interfaces_down, NULL, NULL, NULL},
{0}
};
int get_pwr_mgmt_value_ethapd(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string("power_mgmt", "power_mgmt", "ethapd", value);
return 0;
}
int get_pwr_mgmt_value_eee(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string("power_mgmt", "power_mgmt", "eee", value);
return 0;
}
int get_pwr_nbr_interfaces_up(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char buf[256];
int pp, r;
*value = "";
pp = dmcmd("pwrctl", 1, "show"); //TODO wait ubus command
if (pp) {
r = dmcmd_read(pp, buf, 256);
close(pp);
//TODO output command is changed
return 0;
}
return 0;
}
int get_pwr_nbr_interfaces_down(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char buf[256];
int pp, r;
*value = "";
pp = dmcmd("pwrctl", 1, "show"); //TODO wait ubus command
if (pp) {
r = dmcmd_read(pp, buf, 256);
close(pp);
//TODO output command is changed
return 0;
}
return 0;
}
int set_power_mgmt_param_ethapd(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
bool b;
switch (action) {
case VALUECHECK:
if (string_to_bool(value, &b))
return FAULT_9007;
return 0;
case VALUESET:
string_to_bool(value, &b);
if(b)
dmuci_set_value("power_mgmt", "power_mgmt", "ethapd", "1");
else
dmuci_set_value("power_mgmt", "power_mgmt", "ethapd", "0");
return 0;
}
return 0;
}
int set_power_mgmt_param_eee(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
bool b;
switch (action) {
case VALUECHECK:
if (string_to_bool(value, &b))
return FAULT_9007;
return 0;
case VALUESET:
string_to_bool(value, &b);
if(b)
dmuci_set_value("power_mgmt", "power_mgmt", "eee", "1");
else
dmuci_set_value("power_mgmt", "power_mgmt", "eee", "0");
return 0;
}
return 0;
}
bool dm_powermgmt_enable_set(void)
{
if( access("/etc/init.d/power_mgmt", F_OK ) != -1 ) {
return true;
}
else {
return false;
}
}

View file

@ -1,25 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2012-2014 PIVA SOFTWARE (www.pivasoftware.com)
* Author: Imen Bhiri <imen.bhiri@pivasoftware.com>
* Author: Feten Besbes <feten.besbes@pivasoftware.com>
*/
#ifndef __POWER_MGMT_H
#define __POWER_MGMT_H
extern DMLEAF tSe_PowerManagementParam[];
bool dm_powermgmt_enable_set(void);
int get_pwr_mgmt_value_ethapd(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_pwr_mgmt_value_eee(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_pwr_nbr_interfaces_up(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_pwr_nbr_interfaces_down(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_power_mgmt_param_ethapd(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_power_mgmt_param_eee(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
#endif

View file

@ -1,91 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2015 Inteno Broadband Technology AB
* Author Imen Bhiri <imen.bhiri@pivasoftware.com>
*
*/
#include <uci.h>
#include <stdio.h>
#include <ctype.h>
#include "dmuci.h"
#include "dmubus.h"
#include "dmcwmp.h"
#include "dmcommon.h"
#include "x_iopsys_eu_syslog.h"
/*** DMROOT.X_IOPSYS_EU_SyslogCfg. ***/
DMLEAF tSe_SyslogCfgParam[] = {
{"ServerIPAddress", &DMWRITE, DMT_STRING, get_server_ip_address, set_server_ip_address, NULL, NULL},
{"ServerPortNumber", &DMWRITE, DMT_UNINT, get_server_port_number, set_server_port_number, NULL, NULL},
{"RemoteLogLevel", &DMWRITE, DMT_UNINT, get_remote_log_level, set_remote_log_level, NULL, NULL},
{0}
};
int get_server_ip_address(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string("system", "@system[0]", "log_ip", value);
return 0;
}
int set_server_ip_address(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value("system", "@system[0]", "log_ip", value);
return 0;
}
return 0;
}
int get_server_port_number(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char *tmp;
dmuci_get_option_value_string("system", "@system[0]", "log_port", &tmp);
if (tmp[0] == '\0')
*value = "514";
else
*value = tmp;
return 0;
}
int set_server_port_number(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value("system", "@system[0]", "log_port", value);
return 0;
}
return 0;
}
int get_remote_log_level(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char *tmp;
dmuci_get_option_value_string("system", "@system[0]", "conloglevel", &tmp);
if (tmp[0] == '\0')
*value = "7";
else
*value = tmp;
return 0;
}
int set_remote_log_level(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value("system", "@system[0]", "conloglevel", value);
return 0;
}
return 0;
}

View file

@ -1,14 +0,0 @@
#ifndef __SE_SYSLOG_H
#define __SE_SYSLOG_H
extern DMLEAF tSe_SyslogCfgParam[];
int get_server_ip_address(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_server_port_number(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_remote_log_level(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_server_ip_address(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_server_port_number(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_remote_log_level(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
#endif

View file

@ -1,130 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2019 iopsys Software Solutions AB
* Author: Amin Ben Ramdhane <amin.benramdhane@pivasoftware.com>
*/
#include <uci.h>
#include <ctype.h>
#include "dmcwmp.h"
#include "dmuci.h"
#include "dmubus.h"
#include "dmcommon.h"
#include "x_iopsys_eu_wifilife.h"
/*** DMROOT.X_IOPSYS_EU_WiFiLife. ****/
DMOBJ X_IOPSYS_EU_WiFiLifeObj[] = {
/* OBJ, permission, addobj, delobj, browseinstobj, finform, nextobj, leaf*/
{"Steering", &DMREAD, NULL, NULL, NULL, browseWifiLifeSteeringObj, NULL, NULL, NULL, WiFiLifeSteeringParams, NULL},
{0}
};
DMLEAF X_IOPSYS_EU_WiFiLifeParams[] = {
{"Enable", &DMWRITE, DMT_BOOL, get_x_iopsys_eu_wifilife_enable, set_x_iopsys_eu_wifilife_enable, NULL, NULL},
{0}
};
DMLEAF WiFiLifeSteeringParams[] = {
{"Enable", &DMWRITE, DMT_BOOL, get_wifilife_steering_enable, set_wifilife_steering_enable, NULL, NULL},
{"LegacyFallback", &DMWRITE, DMT_BOOL, get_wifilife_steering_legacy_fallback, set_wifilife_steering_legacy_fallback, NULL, NULL},
{0}
};
int browseWifiLifeSteeringObj(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *isteer = NULL, *isteer_last = NULL;
struct uci_section *s = NULL;
struct dmmap_dup *p;
LIST_HEAD(dup_list);
synchronize_specific_config_sections_with_dmmap("wifilife", "steer", "dmmap_wifilife", &dup_list);
list_for_each_entry(p, &dup_list, list) {
isteer = handle_update_instance(1, dmctx, &isteer_last, update_instance_alias, 3, p->dmmap_section, "steer_instance", "steer_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, isteer) == DM_STOP)
break;
}
free_dmmap_config_dup_list(&dup_list);
return 0;
}
/*************************************************************************************
**** GET / SET function ****
**************************************************************************************/
int get_x_iopsys_eu_wifilife_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string("wifilife", "@wifilife[0]", "enabled", value);
if ((*value)[0] == '\0') {
*value = "1";
}
return 0;
}
int set_x_iopsys_eu_wifilife_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
bool b;
switch (action) {
case VALUECHECK:
if (string_to_bool(value, &b))
return FAULT_9007;
return 0;
case VALUESET:
string_to_bool(value, &b);
dmuci_set_value("wifilife", "@wifilife[0]", "enabled", b?"1":"0");
return 0;
}
return 0;
}
int get_wifilife_steering_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_value_by_section_string((struct uci_section *)data, "enabled", value);
if ((*value)[0] == '\0')
*value = "0";
return 0;
}
int set_wifilife_steering_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
bool b;
switch (action) {
case VALUECHECK:
if (string_to_bool(value, &b))
return FAULT_9007;
return 0;
case VALUESET:
string_to_bool(value, &b);
dmuci_set_value_by_section((struct uci_section *)data, "enabled", b?"1":"0");
return 0;
}
return 0;
}
int get_wifilife_steering_legacy_fallback(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_value_by_section_string((struct uci_section *)data, "fallback_legacy", value);
if ((*value)[0] == '\0')
*value = "0";
return 0;
}
int set_wifilife_steering_legacy_fallback(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
bool b;
switch (action) {
case VALUECHECK:
if (string_to_bool(value, &b))
return FAULT_9007;
return 0;
case VALUESET:
string_to_bool(value, &b);
dmuci_set_value_by_section((struct uci_section *)data, "fallback_legacy", b?"1":"0");
return 0;
}
return 0;
}

View file

@ -1,27 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2019 iopsys Software Solutions AB
* Author: Amin Ben Ramdhane <amin.benramdhane@pivasoftware.com>
*/
#ifndef __WIFILIFE_H
#define __WIFILIFE_H
extern DMOBJ X_IOPSYS_EU_WiFiLifeObj[];
extern DMLEAF X_IOPSYS_EU_WiFiLifeParams[];
extern DMLEAF WiFiLifeSteeringParams[];
int browseWifiLifeSteeringObj(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int get_x_iopsys_eu_wifilife_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_x_iopsys_eu_wifilife_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_wifilife_steering_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_wifilife_steering_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_wifilife_steering_legacy_fallback(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_wifilife_steering_legacy_fallback(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
#endif // __WIFILIFE_H

View file

@ -1,653 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2018 Inteno Broadband Technology AB
* Author Imen Bhiri <imen.bhiri@pivasoftware.com>
* Author: Amin Ben Ramdhane <amin.benramdhane@pivasoftware.com>
*
*/
#include <uci.h>
#include <ctype.h>
#include "dmcwmp.h"
#include "dmuci.h"
#include "dmubus.h"
#include "dmcommon.h"
#include "xmpp.h"
/*** XMPP. ***/
DMOBJ tXMPPObj[] = {
/* OBJ, permission, addobj, delobj, browseinstobj, finform, notification, nextobj, leaf*/
{"Connection", &DMWRITE, add_xmpp_connection, delete_xmpp_connection, NULL, browsexmpp_connectionInst, NULL, NULL, tXMPPConnectionObj, tXMPPConnectionParams, get_xmpp_connection_linker},
{0}
};
DMLEAF tXMPPParams[] = {
/* PARAM, permission, type, getvlue, setvalue, forced_inform, notification*/
{"ConnectionNumberOfEntries", &DMREAD, DMT_UNINT, get_xmpp_connection_nbr_entry, NULL, NULL, NULL},
{"SupportedServerConnectAlgorithms", &DMREAD, DMT_STRING, get_xmpp_connection_supported_server_connect_algorithms, NULL, NULL, NULL},
{0}
};
/*** XMPP.Connection. ***/
DMLEAF tXMPPConnectionParams[] = {
/* PARAM, permission, type, getvlue, setvalue, forced_inform, notification*/
{"Enable", &DMWRITE, DMT_BOOL, get_connection_enable, set_connection_enable, NULL, NULL},
{"Alias", &DMWRITE, DMT_STRING, get_xmpp_connection_alias, set_xmpp_connection_alias, NULL, NULL},
{"Username", &DMWRITE, DMT_STRING, get_xmpp_connection_username, set_xmpp_connection_username, NULL, NULL},
{"Password", &DMWRITE, DMT_STRING, get_xmpp_connection_password, set_xmpp_connection_password, NULL, NULL},
{"Domain", &DMWRITE, DMT_STRING, get_xmpp_connection_domain, set_xmpp_connection_domain, NULL, NULL},
{"Resource", &DMWRITE, DMT_STRING, get_xmpp_connection_resource, set_xmpp_connection_resource, NULL, NULL},
{"ServerConnectAlgorithm", &DMWRITE, DMT_STRING, get_xmpp_connection_server_connect_algorithm, set_xmpp_connection_server_connect_algorithm, NULL, NULL},
{"KeepAliveInterval", &DMWRITE, DMT_LONG, get_xmpp_connection_keepalive_interval, set_xmpp_connection_keepalive_interval, NULL, NULL},
{"ServerConnectAttempts", &DMWRITE, DMT_UNINT, get_xmpp_connection_server_attempts, set_xmpp_connection_server_attempts, NULL, NULL},
{"ServerRetryInitialInterval", &DMWRITE, DMT_UNINT, get_xmpp_connection_retry_initial_interval, set_xmpp_connection_retry_initial_interval, NULL, NULL},
{"ServerRetryIntervalMultiplier", &DMWRITE, DMT_UNINT, get_xmpp_connection_retry_interval_multiplier, set_xmpp_connection_retry_interval_multiplier, NULL, NULL},
{"ServerRetryMaxInterval", &DMWRITE, DMT_UNINT, get_xmpp_connection_retry_max_interval, set_xmpp_connection_retry_max_interval, NULL, NULL},
{"UseTLS", &DMWRITE, DMT_BOOL, get_xmpp_connection_server_usetls, set_xmpp_connection_server_usetls, NULL, NULL},
{"JabberID", &DMREAD, DMT_STRING, get_xmpp_connection_jabber_id, NULL, NULL, NULL},
{"Status", &DMREAD, DMT_STRING, get_xmpp_connection_status, NULL, NULL, NULL},
{"ServerNumberOfEntries", &DMREAD, DMT_UNINT, get_xmpp_connection_server_number_of_entries, NULL, NULL, NULL},
{0}
};
DMOBJ tXMPPConnectionObj[] = {
/* OBJ, permission, addobj, delobj, browseinstobj, finform, notification, nextobj, leaf*/
{"Server", &DMREAD, NULL, NULL, NULL, browsexmpp_connection_serverInst, NULL, NULL, NULL, tXMPPConnectionServerParams, NULL},
{0}
};
/*** XMPP.Connection.Server. ***/
DMLEAF tXMPPConnectionServerParams[] = {
/* PARAM, permission, type, getvlue, setvalue, forced_inform, notification*/
{"Enable", &DMWRITE, DMT_BOOL, get_xmpp_connection_server_enable, set_xmpp_connection_server_enable, NULL, NULL},
{"Alias", &DMWRITE, DMT_STRING, get_xmpp_connection_server_alias, set_xmpp_connection_server_alias, NULL, NULL},
{"ServerAddress", &DMWRITE, DMT_STRING, get_xmpp_connection_server_server_address, set_xmpp_connection_server_server_address, NULL, NULL},
{"Port", &DMWRITE, DMT_UNINT, get_xmpp_connection_server_port, set_xmpp_connection_server_port, NULL, NULL},
{0}
};
int add_xmpp_connection(char *refparam, struct dmctx *ctx, void *data, char **instancepara)
{
struct uci_section *xmpp_connection, *xmpp_connection_server;
char *value1, *value2, *last_inst;
last_inst = get_last_instance("cwmp_xmpp", "xmpp_connection", "connection_instance");
dmuci_add_section_and_rename("cwmp_xmpp", "xmpp_connection", &xmpp_connection, &value1);
dmuci_add_section_and_rename("cwmp_xmpp", "xmpp_connection_server", &xmpp_connection_server, &value2);
dmasprintf(instancepara, "%d", atoi(last_inst)+1);
dmuci_set_value_by_section(xmpp_connection, "connection_instance", *instancepara);
dmuci_set_value_by_section(xmpp_connection, "enable", "0");
dmuci_set_value_by_section(xmpp_connection, "interval", "30");
dmuci_set_value_by_section(xmpp_connection, "attempt", "16");
dmuci_set_value_by_section(xmpp_connection, "serveralgorithm", "DNS-SRV");
dmuci_set_value_by_section(xmpp_connection_server, "id_connection", *instancepara);
dmuci_set_value_by_section(xmpp_connection_server, "connection_server_instance", "1");
dmuci_set_value_by_section(xmpp_connection_server, "enable", "0");
dmuci_set_value_by_section(xmpp_connection_server, "port", "5222");
return 0;
}
int delete_xmpp_connection(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action)
{
int found = 0;
struct uci_section *s, *ss = NULL;
struct uci_section *connsection = (struct uci_section *)data;
char *prev_connection_instance;
switch (del_action) {
case DEL_INST:
dmuci_get_value_by_section_string(connsection, "connection_instance", &prev_connection_instance);
uci_foreach_option_eq("cwmp_xmpp", "xmpp_connection_server", "id_connection", prev_connection_instance, s) {
dmuci_delete_by_section(s, NULL, NULL);
break;
}
dmuci_delete_by_section(connsection, NULL, NULL);
return 0;
case DEL_ALL:
uci_foreach_sections("cwmp_xmpp", "xmpp_connection", s) {
if (found != 0) {
dmuci_delete_by_section(ss, NULL, NULL);
}
ss = s;
found++;
}
if (ss != NULL) {
dmuci_delete_by_section(ss, NULL, NULL);
}
uci_foreach_sections("cwmp_xmpp", "xmpp_connection_server", s) {
if (found != 0) {
dmuci_delete_by_section(ss, NULL, NULL);
}
ss = s;
found++;
}
if (ss != NULL) {
dmuci_delete_by_section(ss, NULL, NULL);
}
return 0;
}
return 0;
}
/*#Device.XMPP.ConnectionNumberOfEntries!UCI:cwmp_xmpp/xmpp_connection/*/
int get_xmpp_connection_nbr_entry(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *s;
int cnt = 0;
uci_foreach_sections("cwmp_xmpp", "xmpp_connection", s) {
cnt++;
}
dmasprintf(value, "%d", cnt); // MEM WILL BE FREED IN DMMEMCLEAN
return 0;
}
int get_xmpp_connection_supported_server_connect_algorithms(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = "DNS-SRV , ServerTable";
return 0;
}
/*#Device.XMPP.Connection.{i}.Enable!UCI:cwmp_xmpp/xmpp_connection,@i-1/enable*/
int get_connection_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *connsection = (struct uci_section *)data;
dmuci_get_value_by_section_string(connsection, "enable", value);
return 0;
}
int set_connection_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct uci_section *connsection = (struct uci_section *)data;
bool b;
switch (action) {
case VALUECHECK:
if (string_to_bool(value, &b))
return FAULT_9007;
return 0;
case VALUESET:
string_to_bool(value, &b);
dmuci_set_value_by_section(connsection, "enable", b ? "1" : "0");
return 0;
}
return 0;
}
/*#Device.XMPP.Connection.{i}.Alias!UCI:cwmp_xmpp/xmpp_connection,@i-1/connection_alias*/
int get_xmpp_connection_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *connsection = (struct uci_section *)data;
dmuci_get_value_by_section_string(connsection, "connection_alias", value);
return 0;
}
int set_xmpp_connection_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct uci_section *connsection = (struct uci_section *)data;
bool b;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section(connsection, "connection_alias", value);
return 0;
}
return 0;
}
/*#Device.XMPP.Connection.{i}.Username!UCI:cwmp_xmpp/xmpp_connection,@i-1/username*/
int get_xmpp_connection_username(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *connsection = (struct uci_section *)data;
dmuci_get_value_by_section_string(connsection, "username", value);
return 0;
}
int set_xmpp_connection_username(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct uci_section *connsection = (struct uci_section *)data;
bool b;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section(connsection, "username", value);
return 0;
}
return 0;
}
/*#Device.XMPP.Connection.{i}.Password!UCI:cwmp_xmpp/xmpp_connection,@i-1/password*/
int get_xmpp_connection_password(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = "";
return 0;
}
int set_xmpp_connection_password(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct uci_section *connsection = (struct uci_section *)data;
bool b;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section(connsection, "password", value);
return 0;
}
return 0;
}
/*#Device.XMPP.Connection.{i}.Domain!UCI:cwmp_xmpp/xmpp_connection,@i-1/domain*/
int get_xmpp_connection_domain(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *connsection = (struct uci_section *)data;
dmuci_get_value_by_section_string(connsection, "domain", value);
return 0;
}
int set_xmpp_connection_domain(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct uci_section *connsection = (struct uci_section *)data;
bool b;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section(connsection, "domain", value);
return 0;
}
return 0;
}
/*#Device.XMPP.Connection.{i}.Ressource!UCI:cwmp_xmpp/xmpp_connection,@i-1/resource*/
int get_xmpp_connection_resource(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *connsection = (struct uci_section *)data;
dmuci_get_value_by_section_string(connsection, "resource", value);
return 0;
}
int set_xmpp_connection_resource(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct uci_section *connsection = (struct uci_section *)data;
bool b;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section(connsection, "resource", value);
return 0;
}
return 0;
}
/*#Device.XMPP.Connection.{i}.ServerConnectAlgorithm!UCI:cwmp_xmpp/xmpp_connection,@i-1/serveralgorithm*/
int get_xmpp_connection_server_connect_algorithm(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *connsection = (struct uci_section *)data;
dmuci_get_value_by_section_string(connsection, "serveralgorithm", value);
return 0;
}
int set_xmpp_connection_server_connect_algorithm(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct uci_section *connsection = (struct uci_section *)data;
bool b;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
if(strcmp(value, "DNS-SRV") == 0 || strcmp(value, "ServerTable") == 0)
dmuci_set_value_by_section(connsection, "serveralgorithm", value);
return 0;
}
return 0;
}
/*#Device.XMPP.Connection.{i}.KeepAliveInterval!UCI:cwmp_xmpp/xmpp_connection,@i-1/interval*/
int get_xmpp_connection_keepalive_interval(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *connsection = (struct uci_section *)data;
dmuci_get_value_by_section_string(connsection, "interval", value);
return 0;
}
int set_xmpp_connection_keepalive_interval(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct uci_section *connsection = (struct uci_section *)data;
bool b;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section(connsection, "interval", value);
return 0;
}
return 0;
}
/*#Device.XMPP.Connection.{i}.ServerConnectAttempts!UCI:cwmp_xmpp/xmpp_connection,@i-1/attempt*/
int get_xmpp_connection_server_attempts(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *connsection = (struct uci_section *)data;
dmuci_get_value_by_section_string(connsection, "attempt", value);
return 0;
}
int set_xmpp_connection_server_attempts(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct uci_section *connsection = (struct uci_section *)data;
bool b;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section(connsection, "attempt", value);
return 0;
}
return 0;
}
/*#Device.XMPP.Connection.{i}.ServerRetryInitialInterval!UCI:cwmp_xmpp/xmpp_connection,@i-1/initial_retry_interval*/
int get_xmpp_connection_retry_initial_interval(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *connsection = (struct uci_section *)data;
dmuci_get_value_by_section_string(connsection, "initial_retry_interval", value);
return 0;
}
int set_xmpp_connection_retry_initial_interval(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct uci_section *connsection = (struct uci_section *)data;
bool b;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section(connsection, "initial_retry_interval", value);
return 0;
}
return 0;
}
/*#Device.XMPP.Connection.{i}.ServerRetryIntervalMultiplier!UCI:cwmp_xmpp/xmpp_connection,@i-1/retry_interval_multiplier*/
int get_xmpp_connection_retry_interval_multiplier(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *connsection = (struct uci_section *)data;
dmuci_get_value_by_section_string(connsection, "retry_interval_multiplier", value);
return 0;
}
int set_xmpp_connection_retry_interval_multiplier(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct uci_section *connsection = (struct uci_section *)data;
bool b;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section(connsection, "retry_interval_multiplier", value);
return 0;
}
return 0;
}
/*#Device.XMPP.Connection.{i}.ServerRetryMaxInterval!UCI:cwmp_xmpp/xmpp_connection,@i-1/retry_max_interval*/
int get_xmpp_connection_retry_max_interval(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *connsection = (struct uci_section *)data;
dmuci_get_value_by_section_string(connsection, "retry_max_interval", value);
return 0;
}
int set_xmpp_connection_retry_max_interval(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct uci_section *connsection = (struct uci_section *)data;
bool b;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section(connsection, "retry_max_interval", value);
return 0;
}
return 0;
}
/*#Device.XMPP.Connection.{i}.UseTLS!UCI:cwmp_xmpp/xmpp_connection,@i-1/usetls*/
int get_xmpp_connection_server_usetls(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *connsection = (struct uci_section *)data;
dmuci_get_value_by_section_string(connsection, "usetls", value);
return 0;
}
int set_xmpp_connection_server_usetls(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct uci_section *connsection = (struct uci_section *)data;
bool b;
switch (action) {
case VALUECHECK:
if (string_to_bool(value, &b))
return FAULT_9007;
return 0;
case VALUESET:
string_to_bool(value, &b);
dmuci_set_value_by_section(connsection, "usetls", b ? "1" : "0");
return 0;
}
return 0;
}
int get_xmpp_connection_jabber_id(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *connsection = (struct uci_section *)data;
char *resource, *domain, *username;
dmuci_get_value_by_section_string(connsection, "resource", &resource);
dmuci_get_value_by_section_string(connsection, "domain", &domain);
dmuci_get_value_by_section_string(connsection, "username", &username);
if(*resource != '\0' || *domain != '\0' || *username != '\0')
dmasprintf(value, "%s@%s/%s", username, domain, resource);
else
*value = "";
return 0;
}
/*#Device.XMPP.Connection.{i}.Status!UCI:cwmp_xmpp/xmpp_connection,@i-1/enable*/
int get_xmpp_connection_status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *connsection = (struct uci_section *)data;
char *status;
dmuci_get_value_by_section_string(connsection, "enable", &status);
if(strcmp(status,"1") == 0)
*value = "Enabled";
else
*value = "Disabled";
return 0;
}
int get_xmpp_connection_server_number_of_entries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = "1";
return 0;
}
/*#Device.XMPP.Connection.{i}.Server.{i}.Enable!UCI:cwmp_xmpp/xmpp_connection,@i-1/enable*/
int get_xmpp_connection_server_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *connsection = (struct uci_section *)data;
dmuci_get_value_by_section_string(connsection, "enable", value);
return 0;
}
int set_xmpp_connection_server_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct uci_section *connsection = (struct uci_section *)data;
bool b;
switch (action) {
case VALUECHECK:
if (string_to_bool(value, &b))
return FAULT_9007;
return 0;
case VALUESET:
string_to_bool(value, &b);
dmuci_set_value_by_section(connsection, "enable", b ? "1" : "0");
return 0;
}
return 0;
}
/*#Device.XMPP.Connection.{i}.Server.{i}.Alias!UCI:cwmp_xmpp/xmpp_connection,@i-1/connection_server_alias*/
int get_xmpp_connection_server_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *connsection = (struct uci_section *)data;
dmuci_get_value_by_section_string(connsection, "connection_server_alias", value);
return 0;
}
int set_xmpp_connection_server_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct uci_section *connsection = (struct uci_section *)data;
bool b;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section(connsection, "connection_server_alias", value);
return 0;
}
return 0;
}
/*#Device.XMPP.Connection.{i}.Server.{i}.ServerAddress!UCI:cwmp_xmpp/xmpp_connection,@i-1/server_address*/
int get_xmpp_connection_server_server_address(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *connsection = (struct uci_section *)data;
dmuci_get_value_by_section_string(connsection, "server_address", value);
return 0;
}
int set_xmpp_connection_server_server_address(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct uci_section *connsection = (struct uci_section *)data;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section(connsection, "server_address", value);
return 0;
}
return 0;
}
/*#Device.XMPP.Connection.{i}.Server.{i}.Port!UCI:cwmp_xmpp/xmpp_connection,@i-1/port*/
int get_xmpp_connection_server_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *connsection = (struct uci_section *)data;
dmuci_get_value_by_section_string(connsection, "port", value);
return 0;
}
int set_xmpp_connection_server_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct uci_section *connsection = (struct uci_section *)data;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section(connsection, "port", value);
return 0;
}
return 0;
}
/**************************************************************************
* LINKER
***************************************************************************/
int get_xmpp_connection_linker(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker) {
char *conn_instance;
struct uci_section *connsection = (struct uci_section *)data;
if (connsection)
{
dmuci_get_value_by_section_string(connsection, "connection_instance", &conn_instance);
dmasprintf(linker,"xmppc:%s", conn_instance);
return 0;
}
else
*linker = "";
return 0;
}
/*************************************************************
* ENTRY METHOD
/*************************************************************/
/*#Device.XMPP.Connection.{i}.!UCI:cwmp_xmpp/xmpp_connection/dmmap_cwmp_xmpp*/
int browsexmpp_connectionInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *iconnection = NULL, *iconnection_last = NULL;
struct uci_section *s = NULL;
uci_foreach_sections("cwmp_xmpp", "xmpp_connection", s) {
iconnection = handle_update_instance(1, dmctx, &iconnection_last, update_instance_alias, 3, s, "connection_instance", "connection_instance_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, iconnection) == DM_STOP)
break;
}
return 0;
}
/*#Device.XMPP.Connection.{i}.!UCI:cwmp_xmpp/xmpp_connection_server/dmmap_cwmp_xmpp*/
int browsexmpp_connection_serverInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *iconnectionserver = NULL, *iconnectionserver_last = NULL, *prev_connection_instance;
struct uci_section *s = NULL, *connsection = (struct uci_section *)prev_data;
dmuci_get_value_by_section_string(connsection, "connection_instance", &prev_connection_instance);
uci_foreach_option_eq("cwmp_xmpp", "xmpp_connection_server", "id_connection", prev_connection_instance, s) {
iconnectionserver = handle_update_instance(1, dmctx, &iconnectionserver_last, update_instance_alias, 3, s, "connection_server_instance", "connection_server_instance_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, iconnectionserver) == DM_STOP)
break;
}
return 0;
}

View file

@ -1,69 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2018 Inteno Broadband Technology AB
* Author Imen Bhiri <imen.bhiri@pivasoftware.com>
* Author: Amin Ben Ramdhane <amin.benramdhane@pivasoftware.com>
*
*/
#ifndef __XMPP_H
#define __XMPP_H
extern DMOBJ tXMPPObj[];
extern DMLEAF tXMPPParams[];
extern DMLEAF tXMPPConnectionParams[];
extern DMOBJ tXMPPConnectionObj[];
extern DMLEAF tXMPPConnectionServerParams[];
int browsexmpp_connectionInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browsexmpp_connection_serverInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int add_xmpp_connection(char *refparam, struct dmctx *ctx, void *data, char **instancepara);
int delete_xmpp_connection(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
int get_xmpp_connection_nbr_entry(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_xmpp_connection_supported_server_connect_algorithms(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_connection_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_xmpp_connection_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_xmpp_connection_username(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_xmpp_connection_password(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_xmpp_connection_domain(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_xmpp_connection_resource(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_xmpp_connection_server_connect_algorithm(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_xmpp_connection_keepalive_interval(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_xmpp_connection_server_attempts(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_xmpp_connection_retry_initial_interval(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_xmpp_connection_retry_interval_multiplier(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_xmpp_connection_retry_max_interval(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_xmpp_connection_server_usetls(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_xmpp_connection_jabber_id(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_xmpp_connection_status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_xmpp_connection_server_number_of_entries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_xmpp_connection_server_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_xmpp_connection_server_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_xmpp_connection_server_server_address(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_xmpp_connection_server_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_connection_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_xmpp_connection_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_xmpp_connection_username(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_xmpp_connection_password(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_xmpp_connection_domain(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_xmpp_connection_resource(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_xmpp_connection_server_connect_algorithm(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_xmpp_connection_keepalive_interval(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_xmpp_connection_server_attempts(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_xmpp_connection_retry_initial_interval(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_xmpp_connection_retry_interval_multiplier(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_xmpp_connection_retry_max_interval(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_xmpp_connection_server_usetls(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_xmpp_connection_server_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_xmpp_connection_server_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_xmpp_connection_server_server_address(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_xmpp_connection_server_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_xmpp_connection_linker(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker);
#endif

View file

@ -1,68 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2015 Inteno Broadband Technology AB
* Author Imen Bhiri <imen.bhiri@pivasoftware.com>
*
*/
#include <uci.h>
#include <stdio.h>
#include <ctype.h>
#include "dmuci.h"
#include "dmubus.h"
#include "dmcwmp.h"
#include "dmcommon.h"
#include "deviceconfig.h"
#define BACKUP_CONFIG_FILE "/etc/backup"
#define RESTORE_FUNCTION_PATH "/usr/share/icwmp/functions/conf_backup"
/*** DMROOT.ConfigFile. ***/
DMLEAF tDeviceConfigParam[] = {
{"ConfigFile", &DMWRITE, DMT_STRING, get_config_file, set_config_file, NULL, NULL},
{0}
};
int get_config_file(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
FILE *f = NULL;
char *buffer = NULL;
long length;
*value = "";
dmcmd("/bin/sh", 2, RESTORE_FUNCTION_PATH, "export_conf");
f = fopen (BACKUP_CONFIG_FILE, "rb");
if (f != NULL)
{
fseek(f, 0, SEEK_END);
length = ftell(f);
buffer = dmcalloc(1, length+1);
if (buffer)
{
fseek(f, 0, SEEK_SET);
fread(buffer, 1, length, f);
}
fclose(f);
}
if (buffer)
*value = buffer;
return 0;
}
int set_config_file(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmcmd("/bin/sh", 2, RESTORE_FUNCTION_PATH, "import_conf");
return 0;
}
return 0;
}

View file

@ -1,8 +0,0 @@
#ifndef __SE_CONFIG_FILE_H
#define __SE_CONFIG_FILE_H
extern DMLEAF tDeviceConfigParam[];
int get_config_file(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_config_file(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
#endif

View file

@ -1,245 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2012-2016 PIVA SOFTWARE (www.pivasoftware.com)
* Author: Imen Bhiri <imen.bhiri@pivasoftware.com>
* Author: Feten Besbes <feten.besbes@pivasoftware.com>
*/
#include <ctype.h>
#include <uci.h>
#include <stdio.h>
#include "dmcwmp.h"
#include "dmuci.h"
#include "dmubus.h"
#include "dmcommon.h"
#include "downloaddiagnostic.h"
/*** DMROOT.DownloadDiagnostics. ***/
DMLEAF tDownloadDiagnosticsParam[] = {
{"DiagnosticsState", &DMWRITE, DMT_STRING, get_download_diagnostics_state, set_download_diagnostics_state, NULL, NULL},
{"DownloadURL", &DMWRITE, DMT_STRING, get_download_diagnostics_url, set_download_diagnostics_url, NULL, NULL},
{"EthernetPriority", &DMWRITE, DMT_UNINT, get_download_diagnostics_ethernet_priority,set_download_diagnostics_ethernet_priority, NULL, NULL},
{"ROMTime", &DMREAD, DMT_TIME, get_download_diagnostic_romtime, NULL, NULL, NULL},
{"BOMTime", &DMREAD, DMT_TIME, get_download_diagnostic_bomtime, NULL, NULL, NULL},
{"EOMTime", &DMREAD, DMT_TIME, get_download_diagnostic_eomtime, NULL, NULL, NULL},
{"TestBytesReceived", &DMREAD, DMT_UNINT, get_download_diagnostic_testbytes, NULL, NULL, NULL},
{"TotalBytesReceived", &DMREAD, DMT_UNINT, get_download_diagnostic_totalbytes, NULL, NULL, NULL},
{"TCPOpenRequestTime", &DMREAD, DMT_TIME, get_download_diagnostic_tcp_open_request_time, NULL, NULL, NULL},
{"TCPOpenResponseTime", &DMREAD, DMT_TIME, get_download_diagnostic_tcp_open_response_time, NULL, NULL, NULL},
{"DSCP", &DMWRITE, DMT_UNINT, get_download_diagnostics_dscp, set_download_diagnostics_dscp, NULL, NULL},
//{"Interface", &DMWRITE, DMT_UNINT, get_download_diagnostics_interface, set_download_diagnostics_interface, NULL, NULL},
{0}
};
static inline char *download_diagnostic_get(char *option, char *def)
{
char *tmp;
dmuci_get_varstate_string("cwmp", "@downloaddiagnostic[0]", option, &tmp);
if(tmp && tmp[0] == '\0')
return dmstrdup(def);
else
return tmp;
}
int get_download_diagnostics_state(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = download_diagnostic_get("DiagnosticState", "None");
return 0;
}
int set_download_diagnostics_state(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
char *tmp;
struct uci_section *curr_section = NULL;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
if (strcmp(value, "Requested") == 0) {
DOWNLOAD_DIAGNOSTIC_STOP
curr_section = dmuci_walk_state_section("cwmp", "downloaddiagnostic", NULL, NULL, CMP_SECTION, NULL, NULL, GET_FIRST_SECTION);
if(!curr_section)
{
dmuci_add_state_section("cwmp", "downloaddiagnostic", &curr_section, &tmp);
}
dmuci_set_varstate_value("cwmp", "@downloaddiagnostic[0]", "DiagnosticState", value);
cwmp_set_end_session(END_SESSION_DOWNLOAD_DIAGNOSTIC);
}
return 0;
}
return 0;
}
int get_download_diagnostics_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_varstate_string("cwmp", "@downloaddiagnostic[0]", "interface", value);
return 0;
}
int set_download_diagnostics_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
char *tmp;
struct uci_section *curr_section = NULL;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
DOWNLOAD_DIAGNOSTIC_STOP
curr_section = (struct uci_section *)dmuci_walk_state_section("cwmp", "downloaddiagnostic", NULL, NULL, CMP_SECTION, NULL, NULL, GET_FIRST_SECTION);
if(!curr_section)
{
dmuci_add_state_section("cwmp", "downloaddiagnostic", &curr_section, &tmp);
}
dmuci_set_varstate_value("cwmp", "@downloaddiagnostic[0]", "interface", value);
return 0;
}
return 0;
}
int get_download_diagnostics_url(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_varstate_string("cwmp", "@downloaddiagnostic[0]", "url", value);
return 0;
}
int set_download_diagnostics_url(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
char *tmp;
struct uci_section *curr_section = NULL;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
DOWNLOAD_DIAGNOSTIC_STOP
curr_section = (struct uci_section *)dmuci_walk_state_section("cwmp", "downloaddiagnostic", NULL, NULL, CMP_SECTION, NULL, NULL, GET_FIRST_SECTION);
if(!curr_section)
{
dmuci_add_state_section("cwmp", "downloaddiagnostic", &curr_section, &tmp);
}
dmuci_set_varstate_value("cwmp", "@downloaddiagnostic[0]", "url", value);
return 0;
}
return 0;
}
int get_download_diagnostics_ethernet_priority(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = "";
return 0;
}
int set_download_diagnostics_ethernet_priority(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
char *tmp;
struct uci_section *curr_section = NULL;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
DOWNLOAD_DIAGNOSTIC_STOP
curr_section = (struct uci_section *)dmuci_walk_state_section("cwmp", "downloaddiagnostic", NULL, NULL, CMP_SECTION, NULL, NULL, GET_FIRST_SECTION);
if(!curr_section)
{
dmuci_add_state_section("cwmp", "downloaddiagnostic", &curr_section, &tmp);
}
dmuci_set_varstate_value("cwmp", "@downloaddiagnostic[0]", "ethernetpriority", value);
return 0;
}
return 0;
}
int get_download_diagnostic_romtime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_varstate_string("cwmp", "@downloaddiagnostic[0]", "ROMtime", value);
if ((*value)[0] == '\0')
*value = "0";
return 0;
}
int get_download_diagnostic_bomtime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_varstate_string("cwmp", "@downloaddiagnostic[0]", "BOMtime", value);
if ((*value)[0] == '\0')
*value = "0";
return 0;
}
int get_download_diagnostic_eomtime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_varstate_string("cwmp", "@downloaddiagnostic[0]", "EOMtime", value);
if ((*value)[0] == '\0')
*value = "0";
return 0;
}
int get_download_diagnostic_testbytes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_varstate_string("cwmp", "@downloaddiagnostic[0]", "TestBytesReceived", value);
if ((*value)[0] == '\0')
*value = "0";
return 0;
}
int get_download_diagnostic_totalbytes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_varstate_string("cwmp", "@downloaddiagnostic[0]", "TotalBytesReceived", value);
if ((*value)[0] == '\0')
*value = "0";
return 0;
}
int get_download_diagnostic_tcp_open_request_time(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_varstate_string("cwmp", "@downloaddiagnostic[0]", "TCPOpenRequestTime", value);
if ((*value)[0] == '\0')
*value = "0";
return 0;
}
int get_download_diagnostic_tcp_open_response_time(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_varstate_string("cwmp", "@downloaddiagnostic[0]", "TCPOpenResponseTime", value);
if ((*value)[0] == '\0')
*value = "0";
return 0;
}
int get_download_diagnostics_dscp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_varstate_string("cwmp", "@downloaddiagnostic[0]", "DSCP", value);
if ((*value)[0] == '\0')
*value = "0";
return 0;
}
int set_download_diagnostics_dscp(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
char *tmp;
struct uci_section *curr_section = NULL;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
DOWNLOAD_DIAGNOSTIC_STOP
curr_section = (struct uci_section *)dmuci_walk_state_section("cwmp", "downloaddiagnostic", NULL, NULL, CMP_SECTION, NULL, NULL, GET_FIRST_SECTION);
if(!curr_section)
{
dmuci_add_state_section("cwmp", "downloaddiagnostic", &curr_section, &tmp);
}
dmuci_set_varstate_value("cwmp", "@downloaddiagnostic[0]", "DSCP", value);
return 0;
}
return 0;
}

View file

@ -1,34 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2012-2016 PIVA SOFTWARE (www.pivasoftware.com)
* Author: Imen Bhiri <imen.bhiri@pivasoftware.com>
* Author: Anis Ellouze <anis.ellouze@pivasoftware.com>
*/
#ifndef __DOWNLOAD_DIAGNOSTIC_H
#define __DOWNLOAD_DIAGNOSTIC_H
static inline char *download_diagnostic_get(char *option, char *def);
int get_download_diagnostics_state(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_download_diagnostics_state(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_download_diagnostics_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_download_diagnostics_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_download_diagnostics_url(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_download_diagnostics_url(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_download_diagnostics_ethernet_priority(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_download_diagnostics_ethernet_priority(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_download_diagnostic_romtime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_download_diagnostic_bomtime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_download_diagnostic_eomtime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_download_diagnostic_testbytes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_download_diagnostic_totalbytes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_download_diagnostic_tcp_open_request_time(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_download_diagnostic_tcp_open_response_time(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_download_diagnostics_dscp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_download_diagnostics_dscp(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
extern DMLEAF tDownloadDiagnosticsParam[];
#endif

View file

@ -1,263 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2012-2014 PIVA SOFTWARE (www.pivasoftware.com)
* Author: Imen Bhiri <imen.bhiri@pivasoftware.com>
* Author: Feten Besbes <feten.besbes@pivasoftware.com>
*/
#include <ctype.h>
#include <uci.h>
#include <stdio.h>
#include "dmcwmp.h"
#include "dmuci.h"
#include "dmubus.h"
#include "dmcommon.h"
#include "ippingdiagnostics.h"
/*** IPPingDiagnostics. ***/
DMLEAF tIPPingDiagnosticsParam[] = {
{"DiagnosticsState", &DMWRITE, DMT_STRING, get_ipping_diagnostics_state, set_ipping_diagnostics_state, NULL, NULL},
{"Interface", &DMWRITE, DMT_STRING, get_ipping_interface, set_ipping_interface, NULL, NULL},
{"Host", &DMWRITE, DMT_STRING, get_ipping_host, set_ipping_host, NULL, NULL},
{"NumberOfRepetitions", &DMWRITE, DMT_UNINT, get_ipping_repetition_number, set_ipping_repetition_number, NULL, NULL},
{"Timeout", &DMWRITE, DMT_UNINT, get_ipping_timeout, set_ipping_timeout, NULL, NULL},
{"DataBlockSize", &DMWRITE, DMT_UNINT, get_ipping_block_size, set_ipping_block_size, NULL, NULL},
{"DSCP", &DMWRITE, DMT_UNINT, get_ipping_dscp, set_ipping_dscp, NULL, NULL},
{"SuccessCount", &DMREAD, DMT_UNINT, get_ipping_success_count, NULL, NULL, NULL},
{"FailureCount", &DMREAD, DMT_UNINT, get_ipping_failure_count, NULL, NULL, NULL},
{"AverageResponseTime", &DMREAD, DMT_UNINT, get_ipping_average_response_time, NULL, NULL, NULL},
{"MinimumResponseTime", &DMREAD, DMT_UNINT, get_ipping_min_response_time, NULL, NULL, NULL},
{"MaximumResponseTime", &DMREAD, DMT_UNINT, get_ipping_max_response_time, NULL, NULL, NULL},
{0}
};
static inline char *ipping_get(char *option, char *def)
{
char *tmp;
dmuci_get_varstate_string("cwmp", "@ippingdiagnostic[0]", option, &tmp);
if(tmp && tmp[0] == '\0')
return dmstrdup(def);
else
return tmp;
}
int get_ipping_diagnostics_state(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = ipping_get("DiagnosticState", "None");
return 0;
}
int set_ipping_diagnostics_state(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
char *tmp;
struct uci_section *curr_section = NULL;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
if (strcmp(value, "Requested") == 0) {
IPPING_STOP
curr_section = (struct uci_section *)dmuci_walk_state_section("cwmp", "ippingdiagnostic", NULL, NULL, CMP_SECTION, NULL, NULL, GET_FIRST_SECTION);
if(!curr_section)
{
dmuci_add_state_section("cwmp", "ippingdiagnostic", &curr_section, &tmp);
}
dmuci_set_varstate_value("cwmp", "@ippingdiagnostic[0]", "DiagnosticState", value);
cwmp_set_end_session(END_SESSION_IPPING_DIAGNOSTIC);
}
return 0;
}
return 0;
}
int get_ipping_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_varstate_string("cwmp", "@ippingdiagnostic[0]", "interface", value);
return 0;
}
int set_ipping_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
char *tmp;
struct uci_section *curr_section = NULL;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
//IPPING_STOP
curr_section = (struct uci_section *)dmuci_walk_state_section("cwmp", "ippingdiagnostic", NULL, NULL, CMP_SECTION, NULL, NULL, GET_FIRST_SECTION);
if(!curr_section)
{
dmuci_add_state_section("cwmp", "ippingdiagnostic", &curr_section, &tmp);
}
dmuci_set_varstate_value("cwmp", "@ippingdiagnostic[0]", "interface", value);
return 0;
}
return 0;
}
int get_ipping_host(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_varstate_string("cwmp", "@ippingdiagnostic[0]", "Host", value);
return 0;
}
int set_ipping_host(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
char *tmp;
struct uci_section *curr_section = NULL;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
IPPING_STOP
curr_section = (struct uci_section *)dmuci_walk_state_section("cwmp", "ippingdiagnostic", NULL, NULL, CMP_SECTION, NULL, NULL, GET_FIRST_SECTION);
if(!curr_section)
{
dmuci_add_state_section("cwmp", "ippingdiagnostic", &curr_section, &tmp);
}
dmuci_set_varstate_value("cwmp", "@ippingdiagnostic[0]", "Host", value);
return 0;
}
return 0;
}
int get_ipping_repetition_number(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = ipping_get("NumberOfRepetitions", "3");
return 0;
}
int set_ipping_repetition_number(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
char *tmp;
struct uci_section *curr_section = NULL;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
IPPING_STOP
curr_section = (struct uci_section *)dmuci_walk_state_section("cwmp", "ippingdiagnostic", NULL, NULL, CMP_SECTION, NULL, NULL, GET_FIRST_SECTION);
if(!curr_section)
{
dmuci_add_state_section("cwmp", "ippingdiagnostic", &curr_section, &tmp);
}
dmuci_set_varstate_value("cwmp", "@ippingdiagnostic[0]", "NumberOfRepetitions", value);
return 0;
}
return 0;
}
int get_ipping_timeout(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = ipping_get("Timeout", "1000");
return 0;
}
int set_ipping_timeout(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct uci_section *curr_section = NULL;
char *tmp;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
IPPING_STOP
curr_section = (struct uci_section *)dmuci_walk_state_section("cwmp", "ippingdiagnostic", NULL, NULL, CMP_SECTION, NULL, NULL, GET_FIRST_SECTION);
if(!curr_section)
{
dmuci_add_state_section("cwmp", "ippingdiagnostic", &curr_section, &tmp);
}
dmuci_set_varstate_value("cwmp", "@ippingdiagnostic[0]", "Timeout", value);
return 0;
}
return 0;
}
int get_ipping_block_size(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = ipping_get("DataBlockSize", "64");
return 0;
}
int set_ipping_block_size(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
char *tmp;
struct uci_section *curr_section = NULL;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
IPPING_STOP
curr_section = (struct uci_section *)dmuci_walk_state_section("cwmp", "ippingdiagnostic", NULL, NULL, CMP_SECTION, NULL, NULL, GET_FIRST_SECTION);
if(!curr_section)
{
dmuci_add_state_section("cwmp", "ippingdiagnostic", &curr_section, &tmp);
}
dmuci_set_varstate_value("cwmp", "@ippingdiagnostic[0]", "DataBlockSize", value);
}
return 0;
}
int get_ipping_dscp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = ipping_get("DSCP", "0");
return 0;
}
int set_ipping_dscp(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
char *tmp;
struct uci_section *curr_section = NULL;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
IPPING_STOP
curr_section = (struct uci_section *)dmuci_walk_state_section("cwmp", "ippingdiagnostic", NULL, NULL, CMP_SECTION, NULL, NULL, GET_FIRST_SECTION);
if(!curr_section)
{
dmuci_add_state_section("cwmp", "ippingdiagnostic", &curr_section, &tmp);
}
dmuci_set_varstate_value("cwmp", "@ippingdiagnostic[0]", "DSCP", value);
}
return 0;
}
int get_ipping_success_count(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = ipping_get("SuccessCount", "0");
return 0;
}
int get_ipping_failure_count(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = ipping_get("FailureCount", "0");
return 0;
}
int get_ipping_average_response_time(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = ipping_get("AverageResponseTime", "0");
return 0;
}
int get_ipping_min_response_time(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = ipping_get("MinimumResponseTime", "0");
return 0;
}
int get_ipping_max_response_time(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = ipping_get("MaximumResponseTime", "0");
return 0;
}

View file

@ -1,36 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2012-2014 PIVA SOFTWARE (www.pivasoftware.com)
* Author: Imen Bhiri <imen.bhiri@pivasoftware.com>
*/
#ifndef __IPPING_DIAGNOSTIC_H
#define __IPPING_DIAGNOSTIC_H
extern DMLEAF tIPPingDiagnosticsParam[];
int get_ipping_diagnostics_state(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_ipping_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_ipping_host(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_ipping_repetition_number(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_ipping_timeout(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_ipping_block_size(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_ipping_dscp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_ipping_success_count(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_ipping_failure_count(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_ipping_average_response_time(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_ipping_min_response_time(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_ipping_max_response_time(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_ipping_diagnostics_state(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_ipping_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_ipping_host(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_ipping_repetition_number(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_ipping_timeout(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_ipping_block_size(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_ipping_dscp(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
#endif

View file

@ -1,200 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2015 Inteno Broadband Technology AB
* Author Imen Bhiri <imen.bhiri@pivasoftware.com>
*
*/
#include <uci.h>
#include "dmcwmp.h"
#include "dmuci.h"
#include "dmubus.h"
#include "dmcommon.h"
#include "lan_interfaces.h"
struct ethrnet_ifaces_s ethrnet_ifaces_g = {0};
void laninterface_lookup(char *eths[], int *size);
/*** LANInterfaces. ***/
DMOBJ tLANInterfacesObj[] = {
{"LANEthernetInterfaceConfig", &DMREAD, NULL, NULL, NULL, browselaninterface_lanInst, NULL, NULL, NULL, tlaninterface_lanParam, NULL},
{"WLANConfiguration", &DMREAD, NULL, NULL, NULL, browselaninterface_wlanInst, NULL, NULL, NULL, tlaninterface_wlanParam, NULL},
{0}
};
DMLEAF tLANInterfacesParam[] = {
{"LANEthernetInterfaceNumberOfEntries", &DMREAD, DMT_UNINT, get_lan_ethernet_interface_number, NULL, NULL, NULL},
{"LANWLANConfigurationNumberOfEntries", &DMREAD, DMT_UNINT, get_lan_wlan_configuration_number, NULL, NULL, NULL},
{0}
};
/*** LANInterfaces.LANEthernetInterfaceConfig. ***/
DMLEAF tlaninterface_lanParam[] = {
{"Alias", &DMWRITE, DMT_STRING, get_lan_eth_int_alias, set_lan_eth_int_alias, NULL, NULL},
{CUSTOM_PREFIX"EthName", &DMREAD, DMT_STRING, get_eth_name, NULL, NULL, NULL},
{0}
};
/*** LANInterfaces.WLANConfiguration. ***/
DMLEAF tlaninterface_wlanParam[] = {
{"Alias", &DMWRITE, DMT_STRING, get_wlan_conf_alias, set_wlan_conf_alias, NULL, NULL},
{0}
};
//////////////////////INIT ARGS////////////////////////////////
int init_lan_interface_args(struct linterfargs *args, char *lif, struct uci_section *port_sec)
{
args->linterf = lif;
args->port_sec = port_sec;
return 0;
}
int get_lan_ethernet_interface_number(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmasprintf(value, "%d", ethrnet_ifaces_g.eths_size);// MEM WILL BE FREED IN DMMEMCLEAN
return 0;
}
static inline int lan_wlan_configuration_number()
{
int cnt = 0;
struct uci_section *s;
char *pch, *phy_itf, *phy_itf_local;
uci_foreach_sections("wireless", "wifi-iface", s) {
cnt++;
}
return cnt;
}
int get_lan_wlan_configuration_number(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
int cnt = lan_wlan_configuration_number();
dmasprintf(value, "%d", cnt);// MEM WILL BE FREED IN DMMEMCLEAN
return 0;
}
int get_eth_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct linterfargs *lifargs = (struct linterfargs *)data;
*value = lifargs->linterf;
return 0;
}
void laninterface_lookup(char *eths[], int *size)
{
static char eths_buf[64];
char *phy_itf;
char *savepch;
int n = 0;
if (*size)
return;
db_get_value_string("hw", "board", "ethernetLanPorts", &phy_itf);
strcpy(eths_buf, phy_itf);
eths[n] = strtok_r(eths_buf, " ", &savepch);
while (eths[n] != NULL) {
eths[++n] = strtok_r(NULL, " ", &savepch);
}
*size = n;
}
inline void init_laninterface_lan(struct dmctx *ctx, void *data)
{
laninterface_lookup(ethrnet_ifaces_g.eths, &(ethrnet_ifaces_g.eths_size));
}
////////////////////////SET AND GET ALIAS/////////////////////////////////
int get_lan_eth_int_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct linterfargs *args = (struct linterfargs *)data;
dmuci_get_value_by_section_string(args->port_sec, "lanportalias", value);
return 0;
}
int set_lan_eth_int_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct linterfargs *args = (struct linterfargs *)data;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section(args->port_sec, "lanportalias", value);
return 0;
}
return 0;
}
int get_wlan_conf_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *wiface_sec = (struct uci_section *)data;
struct uci_section *dmmap_section;
get_dmmap_section_of_config_section("dmmap_wireless", "wifi-iface", section_name(wiface_sec), &dmmap_section);
dmuci_get_value_by_section_string(dmmap_section, "wifacealias", value);
return 0;
}
int set_wlan_conf_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct uci_section *wiface_sec = (struct uci_section *)data;
struct uci_section *dmmap_section;
get_dmmap_section_of_config_section("dmmap_wireless", "wifi-iface", section_name(wiface_sec), &dmmap_section);
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section(dmmap_section, "wifacealias", value);
return 0;
}
return 0;
}
/////////////SUB ENTRIES///////////////
bool check_laninterfaces(struct dmctx *dmctx, void *data)
{
init_laninterface_lan(dmctx, data);
return true;
}
int browselaninterface_lanInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *ei, *ei_last = NULL;
int i = 0;
struct linterfargs curr_linterfargs = {0};
struct linterfargs *args = &curr_linterfargs;
struct uci_section *s = NULL;
update_section_list(DMMAP,"lan_port", NULL, ethrnet_ifaces_g.eths_size, NULL, NULL, NULL, NULL, NULL);
uci_path_foreach_sections(icwmpd, "dmmap", "lan_port", s) {
init_lan_interface_args(args, ethrnet_ifaces_g.eths[i++], s);
ei = handle_update_instance(1, dmctx, &ei_last, update_instance_alias_icwmpd, 3, s, "lanportinstance", "lanportalias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)args, ei) == DM_STOP)
break;
}
return 0;
}
int browselaninterface_wlanInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
struct uci_section *s = NULL;
char *wi, *wi_last = NULL;
struct dmmap_dup *p;
LIST_HEAD(dup_list);
synchronize_specific_config_sections_with_dmmap("wireless", "wifi-iface", "dmmap_wireless", &dup_list);
list_for_each_entry(p, &dup_list, list) {
wi = handle_update_instance(1, dmctx, &wi_last, update_instance_alias, 3, p->dmmap_section, "wifaceinstance", "wifacealias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, wi) == DM_STOP)
break;
}
free_dmmap_config_dup_list(&dup_list);
return 0;
}

View file

@ -1,34 +0,0 @@
#ifndef __LAN_INTERFACES_H
#define __LAN_INTERFACES_H
struct linterfargs
{
char *linterf;
struct uci_section *port_sec;
};
struct ethrnet_ifaces_s
{
char *eths[16];
int eths_size;
};
bool check_laninterfaces(struct dmctx *dmctx, void *data);
extern DMLEAF tlaninterface_lanParam[];
extern DMLEAF tlaninterface_wlanParam[];
extern DMLEAF tLANInterfacesParam[];
extern DMOBJ tLANInterfacesObj[];
int browselaninterface_lanInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browselaninterface_wlanInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int get_lan_eth_int_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_eth_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wlan_conf_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_lan_ethernet_interface_number(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_lan_wlan_configuration_number(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_lan_eth_int_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_wlan_conf_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
#endif

File diff suppressed because it is too large Load diff

View file

@ -1,285 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2012-2014 PIVA SOFTWARE (www.pivasoftware.com)
* Author: Imen Bhiri <imen.bhiri@pivasoftware.com>
* Author: Feten Besbes <feten.besbes@pivasoftware.com>
*/
#ifndef __LAN_DEVICE_H
#define __LAN_DEVICE_H
#include <libubox/blobmsg_json.h>
#include <json-c/json.h>
#define NVRAM_FILE "/proc/nvram/WpaKey"
extern DMLEAF tLanhost_Config_ManagementParam[];
extern DMLEAF tDHCPStaticAddressParam[];
extern DMLEAF tIPInterfaceParam[];
extern DMLEAF tlanethernetinterfaceconfigParam[];
extern DMOBJ tLanhost_Config_ManagementObj[];
extern DMLEAF tWlanConfigurationParam[];
extern DMLEAF tIEEE80211rParams[];
extern DMLEAF tWPSParam[];
extern DMLEAF tWepKeyParam[];
extern DMLEAF tpresharedkeyParam[];
extern DMLEAF tassociateddeviceParam[];
extern DMOBJ tWlanConfigurationObj[];
extern DMOBJ tLANDeviceinstObj[];
extern DMOBJ tLANDeviceObj[];
extern DMOBJ tlanethernetinterfaceconfigObj[];
extern DMLEAF tlanethernetinterfaceStatsParam[];
extern DMLEAF tLANDeviceParam[];
extern DMLEAF tlandevice_hostParam[];
extern DMOBJ tlandevice_hostObj[];
extern DMLEAF tlandevice_hostsParam[];
extern DMOBJ tDHCPConditionalServingPoolobj[];
extern DMLEAF tDHCPConditionalServingPoolParam[];
extern DMLEAF tDHCPOptionParam[];
struct wl_clientargs
{
char *mac;
char *wiface;
};
struct clientargs
{
json_object *client;
char *lan_name;
};
struct ldlanargs
{
struct uci_section *ldlansection;
char *ldinstance;
};
struct ldwlanargs
{
struct uci_section *lwlansection;
int wlctl_num;
struct uci_section *device_section;
char *wunit;
char *wiface;
json_object *res;
int pki;
};
struct ldethargs
{
struct uci_section *lan_ethsection;
char *eth;
};
struct wlan_psk
{
struct uci_section *wlanpsk;
struct uci_section *lwlansection;
char *wiface;
int pki;
};
struct wlan_wep
{
struct uci_section *wlanwep;
struct uci_section *lwlansection;
unsigned int key_index;
};
typedef struct dhcp_param
{
char *interface;
char *state_sec;
}dhcp_param;
struct dhcppooloptionargs
{
struct uci_section *dhcppooloptionsection;
struct uci_section *dhcppoolsection;
};
int browselandeviceInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseIPInterfaceInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseDhcp_static_addressInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browselanethernetinterfaceconfigInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseWlanConfigurationInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseWepKeyInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browsepresharedkeyInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseassociateddeviceInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browselandevice_hostInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseentry_landevice_dhcpconditionalservingpool_option_instance(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browselandevice_lanhostconfigmanagement_dhcpconditionalservingpool_instance(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int add_landevice_wlanconfiguration(char *refparam, struct dmctx *ctx, void *data, char **instancepara);
int delete_landevice_wlanconfiguration(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
int add_landevice_dhcpstaticaddress(char *refparam, struct dmctx *ctx, void *data, char **instancepara);
int delete_landevice_dhcpstaticaddress(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
int add_dhcp_conditional_serving_pool(char *refparam, struct dmctx *ctx, void *data, char **instancepara);
int delete_dhcp_conditional_serving_pool(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
int add_dhcp_serving_pool_option(char *refparam, struct dmctx *ctx, void *data, char **instancepara);
int delete_dhcp_serving_pool_option(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
int add_landevice(char *refparam, struct dmctx *ctx, void *data, char **instancepara);
int delete_landevice(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
int get_lan_dev_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_lan_dns(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_lan_dhcp_server_configurable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_lan_dhcp_server_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_lan_dhcp_interval_address_start(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_lan_dhcp_interval_address_end(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_lan_dhcp_reserved_addresses(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_lan_dhcp_subnetmask(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_lan_dhcp_iprouters(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_lan_dhcp_leasetime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_lan_dhcp_domainname(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_lan_ip_int_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_interface_enable_ipinterface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_interface_firewall_enabled_ipinterface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_interface_ipaddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_interface_subnetmask(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_interface_addressingtype(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_dhcp_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_dhcpstaticaddress_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_dhcpstaticaddress_chaddr(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_dhcpstaticaddress_yiaddr(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_lan_host_nbr_entries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_dhcp_conditional_servingpool_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_dhcp_conditional_servingpool_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_dhcp_conditional_servingpool_vendorclassid(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_dhcp_conditional_servingpool_network_id(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_dhcp_servingpool_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_dhcp_servingpool_tag(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_dhcp_servingpool_value(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_lan_host_ipaddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_lan_host_hostname(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_lan_host_active(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_lan_host_macaddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_lan_host_interfacetype(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_lan_host_addresssource(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_lan_host_leasetimeremaining(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_lan_eth_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_lan_eth_iface_cfg_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_lan_eth_iface_cfg_status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_lan_eth_iface_cfg_maxbitrate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_lan_eth_iface_cfg_duplexmode(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_lan_eth_iface_cfg_stats_tx_bytes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_lan_eth_iface_cfg_stats_rx_bytes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_lan_eth_iface_cfg_stats_tx_packets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_lan_eth_iface_cfg_stats_rx_packets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wlan_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wlan_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wlan_status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
static int get_wlan_bssid(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wlan_max_bit_rate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wlan_channel(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wlan_auto_channel_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
static int get_wlan_ssid(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wlan_beacon_type(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wlan_mac_control_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wlan_possible_channels(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wlan_standard(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wlan_wep_key_index(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wlan_wep_encryption_level(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wlan_basic_encryption_modes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wlan_basic_authentication_mode(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wlan_wpa_encryption_modes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wlan_wpa_authentication_mode(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wlan_ieee_11i_encryption_modes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wlan_ieee_11i_authentication_mode(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wlan_radio_enabled(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wlan_device_operation_mode(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wlan_authentication_service_mode(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wlan_total_associations(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wlan_channel(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wlan_devstatus_statistics_tx_bytes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wlan_devstatus_statistics_rx_bytes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wlan_devstatus_statistics_tx_packets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wlan_devstatus_statistics_rx_packets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
static int get_wlan_ssid_advertisement_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
static int get_wmm_enabled(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_x_iopsys_eu_channelmode(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_x_iopsys_eu_supported_standard(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_x_iopsys_eu_operating_channel_bandwidth(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_x_iopsys_eu_maxssid(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_x_iopsys_eu_scantimer(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_x_iopsys_eu_frequency(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wlan_wps_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_ieee80211r_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wlan_wep_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wlan_psk_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wlan_psk_assoc_MACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wlan_associated_macaddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wlan_associated_ipddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wlan_associated_authenticationstate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_linker_lanhost_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_lan_dns(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_lan_dhcp_server_configurable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_lan_dhcp_server_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_lan_dhcp_address_start(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_lan_dhcp_address_end(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_lan_dhcp_reserved_addresses(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_lan_dhcp_subnetmask(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_lan_dhcp_iprouters(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_lan_dhcp_leasetime(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_lan_dhcp_domainname(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_lan_ip_int_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_interface_enable_ipinterface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_interface_firewall_enabled_ipinterface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_interface_ipaddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_interface_subnetmask(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_interface_addressingtype(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_dhcpstaticaddress_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_dhcpstaticaddress_chaddr(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_dhcpstaticaddress_yiaddr(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_dhcp_conditional_servingpool_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_dhcp_conditionalservingpool_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_dhcp_conditional_servingpool_vendorclassid(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_dhcp_conditional_servingpool_network_id(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_dhcp_servingpool_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_dhcp_servingpool_tag(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_dhcp_servingpool_value(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_lan_eth_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_lan_eth_iface_cfg_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_lan_eth_iface_cfg_maxbitrate(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_lan_eth_iface_cfg_duplexmode(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_wlan_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_wlan_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_wlan_max_bit_rate(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_wlan_channel(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_wlan_auto_channel_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
static int set_wlan_ssid(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_wlan_beacon_type(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_wlan_mac_control_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_wlan_standard(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_wlan_wep_key_index(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_wlan_key_passphrase(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_wlan_basic_encryption_modes(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_wlan_basic_authentication_mode(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_wlan_wpa_encryption_modes(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_wlan_wpa_authentication_mode(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_wlan_ieee_11i_encryption_modes(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_wlan_ieee_11i_authentication_mode(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_wlan_radio_enabled(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_wlan_device_operation_mode(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_wlan_authentication_service_mode(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
static int set_wlan_ssid_advertisement_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
static int set_wmm_enabled(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_x_iopsys_eu_channelmode(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_x_iopsys_eu_operating_channel_bandwidth(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_x_iopsys_eu_maxssid(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_x_iopsys_eu_scantimer(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_x_iopsys_eu_frequency(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_wlan_wps_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_ieee80211r_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_wlan_wep_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_wlan_wep_key1(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_wlan_psk_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_wlan_pre_shared_key(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_wlan_preshared_key_passphrase(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_lan_dev_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_dhcp_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
#endif

File diff suppressed because it is too large Load diff

View file

@ -1,102 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2012-2015 PIVA SOFTWARE (www.pivasoftware.com)
* Author: Anis Ellouze <anis.ellouze@pivasoftware.com>
*
*/
#ifndef __Layer_2_bridging_H
#define __Layer_2_bridging_H
extern DMOBJ tLayer2BridgingObj[];
extern DMOBJ tlayer2_bridgeObj[];
extern DMLEAF tbridge_vlanParam[];
extern DMLEAF tlayer2_bridgeParam[];
extern DMLEAF tlayer2_markingParam[];
extern DMLEAF tavailableinterfaceParam[];
struct wan_interface
{
char *instance;
char *name;
char *package;
char *section;
};
struct args_layer2
{
struct uci_section *layer2section;
struct uci_section *layer2sectionlev2;
char *bridge_instance;
char *availableinterface_instance;
char *interface_type;
char *oface;
};
int browselayer2_availableinterfaceInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browselayer2_bridgeInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browselayer2_markingInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browsebridge_vlanInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int set_marking_bridge_key_sub(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value);
int set_marking_interface_key_sub(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value);
int set_bridge_vlan_enable_sub(char *refparam, struct dmctx *ctx, void *data, char *instance, bool b);
int set_bridge_vlanid_sub(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value);
void remove_config_interfaces(char *baseifname, char *bridge_key, struct uci_section *bridge_s, char *mbi);
int synchrinize_layer2_bridgeInst(struct dmctx *dmctx);
int synchronize_availableinterfaceInst(struct dmctx *dmctx);
void init_args_layer2(struct args_layer2 *args, struct uci_section *s, struct uci_section *ss,
char *availableinterface_instance, char *bridge_instance,
char *interface_type, char *oface);
void init_args_layer2_vlan(struct args_layer2 *args, struct uci_section *ss);
struct uci_section *update_availableinterface_list(struct dmctx *ctx, char *iface, char **instance, char **instance_last);
void update_markinginterface_list(struct uci_section *interface_section, char *bridge_key, char *ifname);
int add_layer2bridging_bridge(char *refparam, struct dmctx *ctx, void *data, char **instance);
int delete_layer2bridging_bridge(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
int add_layer2bridging_marking(char *refparam, struct dmctx *ctx, void *data, char **instance);
int delete_layer2bridging_marking(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
int add_layer2bridging_bridge_vlan(char *refparam, struct dmctx *ctx, void *data, char **instance);
int delete_layer2bridging_bridge_vlan(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
int get_avai_int_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_avai_int_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_marking_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_marking_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_bridge_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_bridge_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_bridge_vlan_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_bridge_vlan_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_bridge_vlan_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_bridge_vlan_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_bridge_vlan_vid(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_bridge_vlan_vid(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_bridge_status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_bridge_status(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_bridge_key(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_bridge_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_bridge_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_bridge_vlanid(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_bridge_vlanid(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_associated_interfaces(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_associated_interfaces(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_available_interface_key(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_interface_reference(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_interfaces_type(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
char *layer2_get_last_section_instance(char *package, char *section, char *opt_inst);
int update_bridge_vlan_config(char *vid, char *bridge_key, char* ifname);
int update_bridge_all_vlan_config_bybridge(struct dmctx *ctx, struct args_layer2 *curr_args);
void update_add_vlan_interfaces(char *bridge_key, char *vid);
void update_remove_vlan_interfaces(char *bridge_key, char *vid);
void update_add_vlan_to_bridge_interface(char *bridge_key, struct uci_section *dmmap_s);
int get_marking_bridge_reference(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
void get_baseifname_from_ifname(char *ifname, char *baseifname);
int set_marking_bridge_key(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_marking_interface_key(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_marking_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_brvlan_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_brvlan_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_marking_interface_key(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_bridge_vlan_vid_sub(struct uci_section *br_sec, struct uci_section *vb, char *value);
#endif

View file

@ -1,762 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2015 Inteno Broadband Technology AB
* Author Imen Bhiri <imen.bhiri@pivasoftware.com>
*
*/
#include <uci.h>
#include <ctype.h>
#include <arpa/inet.h>
#include "dmcwmp.h"
#include "dmentry.h"
#include "dmuci.h"
#include "dmubus.h"
#include "dmcommon.h"
#include "dmjson.h"
#include "layer_3_forwarding.h"
/*** Layer3Forwarding. ***/
DMOBJ tLayer3ForwardingObj[] = {
/* OBJ, permission, addobj, delobj, browseinstobj, finform, notification, nextobj, leaf*/
{"Forwarding", &DMWRITE, add_forwarding, delete_forwarding, NULL, browseForwardingInst, NULL, NULL, NULL, tForwardingInstParam, NULL},
{0}
};
DMLEAF tLayer3ForwardingParam[] = {
{"DefaultConnectionService", &DMWRITE, DMT_STRING, get_layer3_def_conn_serv, set_layer3_def_conn_serv, NULL, NULL},
{"ForwardNumberOfEntries", &DMREAD, DMT_UNINT, get_layer3_nbr_entry, NULL, NULL, NULL},
{0}
};
/*** Layer3Forwarding.Forwarding.{i}. ***/
DMLEAF tForwardingInstParam[] = {
{"Enable", &DMForwarding_perm, DMT_BOOL, get_layer3_enable, set_layer3_enable, NULL, NULL},
{"Status", &DMREAD, DMT_STRING, get_layer3_status, NULL, NULL, NULL},
{"Alias", &DMWRITE, DMT_STRING, get_layer3_alias, set_layer3_alias, NULL, NULL},
{"Type", &DMREAD, DMT_STRING, get_layer3_type, NULL, NULL, NULL},
{"DestIPAddress", &DMForwarding_perm, DMT_STRING, get_layer3_destip, set_layer3_destip, NULL, NULL},
{"DestSubnetMask", &DMForwarding_perm, DMT_STRING, get_layer3_destmask, set_layer3_destmask, NULL, NULL},
{"SourceIPAddress", &DMREAD, DMT_STRING, get_layer3_src_address, NULL, NULL, NULL},
{"SourceSubnetMask", &DMREAD, DMT_STRING, get_layer3_src_mask, NULL, NULL, NULL},
{"GatewayIPAddress", &DMForwarding_perm, DMT_STRING, get_layer3_gatewayip, set_layer3_gatewayip, NULL, NULL},
{"Interface", &DMForwarding_perm, DMT_STRING, get_layer3_interface_linker_parameter, set_layer3_interface_linker_parameter, NULL, NULL},
{"ForwardingMetric", &DMForwarding_perm, DMT_STRING, get_layer3_metric, set_layer3_metric, NULL, NULL},
{"MTU", &DMForwarding_perm, DMT_STRING, get_layer3_mtu, set_layer3_mtu, NULL, NULL},
{0}
};
inline int init_args_rentry(struct routingfwdargs *args, struct uci_section *s, char *permission, struct proc_routing *proute, int type)
{
args->permission = permission;
args->routefwdsection = s;
args->proute = proute;
args->type = type;
return 0;
}
/*************************************************************************************
**** function related to get_object_layer3 ****
**************************************************************************************/
static bool is_proute_static(struct proc_routing *proute)
{
char *mask;
struct uci_section *s;
uci_foreach_option_eq("network", "route", "target", proute->destination, s) {
dmuci_get_value_by_section_string(s, "netmask", &mask);
if (mask[0] == '\0' || strcmp(proute->mask, mask) == 0)
return true;
}
uci_foreach_option_eq("network", "route_disabled", "target", proute->destination, s) {
dmuci_get_value_by_section_string(s, "netmask", &mask);
if (mask[0] == '\0' || strcmp(proute->mask, mask) == 0)
return true;
}
return false;
}
static bool is_cfg_route_active(struct uci_section *s)
{
FILE *fp;
char line[MAX_PROC_ROUTING];
struct proc_routing proute;
char *dest, *mask;
dmuci_get_value_by_section_string(s, "target", &dest);
dmuci_get_value_by_section_string(s, "netmask", &mask);
fp = fopen(ROUTE_FILE, "r");
if ( fp != NULL)
{
fgets(line, MAX_PROC_ROUTING, fp);
while (fgets(line, MAX_PROC_ROUTING, fp) != NULL )
{
if (line[0] == '\n')
continue;
parse_proc_route_line(line, &proute);
if (strcmp(dest, proute.destination) == 0 &&
(mask[0] == '\0' || strcmp(mask, proute.mask) == 0)) {
fclose(fp) ;
return true;
}
}
fclose(fp) ;
}
return false;
}
static int get_forwarding_last_inst()
{
char *rinst = NULL, *drinst = NULL, *dsinst = NULL, *tmp;
int r = 0, dr = 0, ds = 0, max;
struct uci_section *s;
int cnt = 0;
FILE *fp;
char line[MAX_PROC_ROUTING];
struct proc_routing proute;
uci_foreach_sections("network", "route", s) {
dmuci_get_value_by_section_string(s, "routeinstance", &tmp);
if (tmp[0] == '\0')
break;
rinst = tmp;
}
uci_foreach_sections("network", "route_disabled", s) {
dmuci_get_value_by_section_string(s, "routeinstance", &tmp);
if (tmp[0] == '\0')
break;
dsinst = tmp;
}
uci_path_foreach_sections(icwmpd, "dmmap", "route_dynamic", s) {
dmuci_get_value_by_section_string(s, "routeinstance", &tmp);
if (tmp[0] == '\0')
break;
drinst = tmp;
}
if (rinst) r = atoi(rinst);
if (dsinst) ds = atoi(dsinst);
if (drinst) dr = atoi(drinst);
max = (r>ds&&r>dr?r:ds>dr?ds:dr);
return max;
}
static char *forwarding_update_instance_alias_icwmpd(int action, char **last_inst, void *argv[])
{
char *instance, *alias;
char buf[8] = {0};
struct uci_section *s = (struct uci_section *) argv[0];
char *inst_opt = (char *) argv[1];
char *alias_opt = (char *) argv[2];
bool *find_max = (bool *) argv[3];
dmuci_get_value_by_section_string(s, inst_opt, &instance);
if (instance[0] == '\0') {
if (*find_max) {
int m = get_forwarding_last_inst();
sprintf(buf, "%d", m+1);
*find_max = false;
}
else if (last_inst == NULL) {
sprintf(buf, "%d", 1);
}
else {
sprintf(buf, "%d", atoi(*last_inst)+1);
}
instance = DMUCI_SET_VALUE_BY_SECTION(icwmpd, s, inst_opt, buf);
}
*last_inst = instance;
if (action == INSTANCE_MODE_ALIAS) {
dmuci_get_value_by_section_string(s, alias_opt, &alias);
if (alias[0] == '\0') {
sprintf(buf, "cpe-%s", instance);
alias = DMUCI_SET_VALUE_BY_SECTION(icwmpd, s, alias_opt, buf);
}
sprintf(buf, "[%s]", alias);
instance = dmstrdup(buf);
}
return instance;
}
static char *get_last_instance_route_forwarding(void)
{
char *inst_route, *inst_route_dynamic, *inst_route_disabled;
char *inst = "0";
inst_route = get_last_instance_icwmpd("dmmap_route_forwarding", "route", "routeinstance");
if (inst_route == NULL)
inst_route = "0";
inst_route_dynamic = get_last_instance_icwmpd("dmmap_route_forwarding", "route_dynamic", "routeinstance");
if (inst_route_dynamic == NULL)
inst_route_dynamic = "0";
inst_route_disabled = get_last_instance_icwmpd("dmmap_route_forwarding", "route_disabled", "routeinstance");
if (inst_route_disabled == NULL)
inst_route_disabled = "0";
if(atoi(inst_route) > atoi(inst_route_dynamic))
inst = inst_route;
else
inst = inst_route_dynamic;
if(atoi(inst_route_disabled) > atoi(inst))
inst = inst_route_disabled;
return inst;
}
static struct uci_section *update_route_dynamic_section(struct proc_routing *proute)
{
struct uci_section *s = NULL;
char *name, *mask, *last_inst, *instance;
uci_path_foreach_option_eq(icwmpd, "dmmap_route_forwarding", "route_dynamic", "target", proute->destination, s) {
dmuci_get_value_by_section_string(s, "netmask", &mask);
if (strcmp(proute->mask, mask) == 0)
return s;
}
if (!s) {
last_inst = get_last_instance_route_forwarding();
dmasprintf(&instance, "%d", atoi(last_inst)+1);
DMUCI_ADD_SECTION(icwmpd, "dmmap_route_forwarding", "route_dynamic", &s, &name);
DMUCI_SET_VALUE_BY_SECTION(icwmpd, s, "target", proute->destination);
DMUCI_SET_VALUE_BY_SECTION(icwmpd, s, "netmask", proute->mask);
DMUCI_SET_VALUE_BY_SECTION(icwmpd, s, "metric", proute->metric);
DMUCI_SET_VALUE_BY_SECTION(icwmpd, s, "gateway", proute->gateway);
DMUCI_SET_VALUE_BY_SECTION(icwmpd, s, "interface", proute->iface);
DMUCI_SET_VALUE_BY_SECTION(icwmpd, s, "routeinstance", instance);
dmfree(instance);
}
return s;
}
int add_forwarding(char *refparam, struct dmctx *ctx, void *data, char **instancepara)
{
char *value, *v;
char *instance;
struct uci_section *s = NULL;
struct uci_section *dmmap_route = NULL;
check_create_dmmap_package("dmmap_route_forwarding");
instance = get_last_instance_route_forwarding();
dmuci_add_section_and_rename("network", "route", &s, &value);
dmuci_set_value_by_section(s, "metric", "0");
dmuci_set_value_by_section(s, "interface", "lan");
dmuci_add_section_icwmpd("dmmap_route_forwarding", "route", &dmmap_route, &v);
dmuci_set_value_by_section(dmmap_route, "section_name", section_name(s));
*instancepara = update_instance_icwmpd(dmmap_route, instance, "routeinstance");
return 0;
}
int delete_forwarding(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action)
{
struct routingfwdargs *routeargs = (struct routingfwdargs *)data;
struct uci_section *dmmap_section= NULL;
switch (del_action) {
case DEL_INST:
get_dmmap_section_of_config_section("dmmap_route_forwarding", "route", section_name(routeargs->routefwdsection), &dmmap_section);
if(dmmap_section != NULL) {
dmuci_delete_by_section(dmmap_section, NULL, NULL);
dmuci_delete_by_section(routeargs->routefwdsection, NULL, NULL);
break;
}
get_dmmap_section_of_config_section("dmmap_route_forwarding", "route_disabled", section_name(routeargs->routefwdsection), &dmmap_section);
if(dmmap_section != NULL) {
dmuci_delete_by_section(dmmap_section, NULL, NULL);
dmuci_delete_by_section(routeargs->routefwdsection, NULL, NULL);
}
break;
case DEL_ALL:
return FAULT_9005;
}
return 0;
}
int get_layer3_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct routingfwdargs *routeargs = (struct routingfwdargs *)data;
if (routeargs->routefwdsection == NULL) {
*value = "1";
return 0;
}
if(strcmp(routeargs->routefwdsection->type, "route_disabled") == 0)
*value = "0";
else {
*value = "1";
}
return 0;
}
int set_layer3_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
bool b;
char *pch;
struct routingfwdargs *routeargs = (struct routingfwdargs *)data;
switch (action) {
case VALUECHECK:
if (string_to_bool(value, &b))
return FAULT_9007;
return 0;
case VALUESET:
string_to_bool(value, &b);
if (b) {
if (routeargs->type == ROUTE_STATIC)
return 0;
dmuci_set_value_by_section(routeargs->routefwdsection, NULL, "route"); //TODO test
}
else {
if (routeargs->type == ROUTE_DISABLED)
return 0;
dmuci_set_value_by_section(routeargs->routefwdsection, NULL, "route_disabled"); //TODO test
}
return 0;
}
return 0;
}
int get_layer3_status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct routingfwdargs *routeargs = (struct routingfwdargs *)data;
if (routeargs->routefwdsection == NULL) {
*value = "Enabled";
return 0;
}
if(strcmp(routeargs->routefwdsection->type, "route_disabled") == 0) {
*value = "Disabled";
} else {
if (is_cfg_route_active(routeargs->routefwdsection))
*value = "Enabled";
else
*value = "Error";
}
return 0;
}
int get_layer3_type(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char *netmask;
struct routingfwdargs *routeargs = (struct routingfwdargs *)data;
if (routeargs->routefwdsection != NULL) {
dmuci_get_value_by_section_string(routeargs->routefwdsection, "netmask", value);
}
else {
struct proc_routing *proute = routeargs->proute;
*value = proute->mask;
}
*value = (strcmp(*value, "255.255.255.255") == 0 || (*value)[0] == '\0') ? "Host" : "Network";
return 0;
}
int get_layer3_destip(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct routingfwdargs *routeargs = (struct routingfwdargs *)data;
if (routeargs->routefwdsection != NULL) {
dmuci_get_value_by_section_string(routeargs->routefwdsection, "target", value);
if ((*value)[0] == '\0') {
*value = "0.0.0.0";
}
}
else {
struct proc_routing *proute = routeargs->proute;
*value = dmstrdup(proute->destination); // MEM WILL BE FREED IN DMMEMCLEAN
}
return 0;
}
int set_layer3_destip(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct routingfwdargs *routeargs = (struct routingfwdargs *)data;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section(routeargs->routefwdsection, "target", value);
return 0;
}
return 0;
}
int get_layer3_destmask(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct routingfwdargs *routeargs = (struct routingfwdargs *)data;
if (routeargs->routefwdsection != NULL) {
dmuci_get_value_by_section_string(routeargs->routefwdsection, "netmask", value);
if ((*value)[0] == '\0') {
*value = "255.255.255.255";
}
}
else {
struct proc_routing *proute = routeargs->proute;
*value = dmstrdup(proute->mask); // MEM WILL BE FREED IN DMMEMCLEAN
}
return 0;
}
int set_layer3_destmask(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct routingfwdargs *routeargs = (struct routingfwdargs *)data;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section(routeargs->routefwdsection, "netmask", value);
return 0;
}
return 0;
}
int get_layer3_src_address(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = "0.0.0.0";
return 0;
}
int get_layer3_src_mask(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = "0.0.0.0";
return 0;
}
int get_layer3_gatewayip(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct routingfwdargs *routeargs = (struct routingfwdargs *)data;
if (routeargs->routefwdsection != NULL) {
dmuci_get_value_by_section_string(routeargs->routefwdsection, "gateway", value);
if ((*value)[0] == '\0') {
*value = "0.0.0.0";
}
}
else {
struct proc_routing *proute = routeargs->proute;
*value = dmstrdup(proute->gateway); // MEM WILL BE FREED IN DMMEMCLEAN
}
return 0;
}
int set_layer3_gatewayip(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct routingfwdargs *routeargs = (struct routingfwdargs *)data;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section(routeargs->routefwdsection, "gateway", value);
return 0;
}
return 0;
}
char *get_layer3_interface(struct dmctx *ctx, struct routingfwdargs *routeargs)
{
json_object *res;
char *val, *bval, *ifname, *device;
char *name;
struct uci_section *ss;
if (routeargs->routefwdsection != NULL) {
dmuci_get_value_by_section_string(routeargs->routefwdsection, "interface", &val);
return val;
}
else {
struct proc_routing *proute = routeargs->proute;
bval = proute->iface;
val = bval;
if (!strstr(bval, "br-")) {
uci_foreach_option_cont("network", "interface", "ifname", bval, ss) {
ifname = section_name(ss);
dmubus_call("network.interface", "status", UBUS_ARGS{{"interface", ifname, String}}, 1, &res);
if (res) {
device = dmjson_get_value(res, 1, "device");
if (strcmp(bval, device) == 0) {
return ifname;
}
}
}
}
else {
val = bval + sizeof("br-") - 1;
}
return val;
}
return "";
}
int get_layer3_interface_linker_parameter(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char *iface, *linker;
*value = "";
iface = get_layer3_interface(ctx, (struct routingfwdargs *)data);
if (iface[0] != '\0') {
dmastrcat(&linker, "linker_interface:", iface);
adm_entry_get_linker_param(ctx, dm_print_path("%s%cWANDevice%c", dmroot, dm_delim, dm_delim), linker, value); // MEM WILL BE FREED IN DMMEMCLEAN
if (*value == NULL) {
adm_entry_get_linker_param(ctx, dm_print_path("%s%cLANDevice%c", dmroot, dm_delim, dm_delim), linker, value); // MEM WILL BE FREED IN DMMEMCLEAN
if (*value == NULL)
*value = "";
}
dmfree(linker);
}
return 0;
}
int set_layer3_interface_linker_parameter(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
char *linker, *iface;
struct routingfwdargs *routeargs = (struct routingfwdargs *)data;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
adm_entry_get_linker_value(ctx, value, &linker);
if (linker) {
iface = linker + sizeof("linker_interface:") - 1;
dmuci_set_value_by_section(routeargs->routefwdsection, "interface", iface);
dmfree(linker);
}
return 0;
}
return 0;
}
int get_layer3_metric(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char *name;
struct routingfwdargs *routeargs = (struct routingfwdargs *)data;
if (routeargs->routefwdsection != NULL) {
dmuci_get_value_by_section_string(routeargs->routefwdsection, "metric", value);
}
else {
struct proc_routing *proute = routeargs->proute;
*value = dmstrdup(proute->metric); // MEM WILL BE FREED IN DMMEMCLEAN
}
if ((*value)[0] == '\0') {
*value = "0";
}
return 0;
}
int set_layer3_metric(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct routingfwdargs *routeargs = (struct routingfwdargs *)data;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section(routeargs->routefwdsection, "metric", value);
return 0;
}
return 0;
}
int get_layer3_mtu(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct routingfwdargs *routeargs = (struct routingfwdargs *)data;
if (routeargs->routefwdsection != NULL) {
dmuci_get_value_by_section_string(routeargs->routefwdsection, "mtu", value);
}
else {
struct proc_routing *proute = routeargs->proute;
*value = dmstrdup(proute->mtu); // MEM WILL BE FREED IN DMMEMCLEAN
}
if ((*value)[0] == '\0') {
*value = "1500";
}
return 0;
}
int set_layer3_mtu(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct routingfwdargs *routeargs = (struct routingfwdargs *)data;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section(routeargs->routefwdsection, "mtu", value);
return 0;
}
return 0;
}
int get_layer3_def_conn_serv(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char *iface, *linker;
dmuci_get_option_value_string("cwmp", "cpe", "default_wan_interface", &iface);
if (iface[0] != '\0') {
dmasprintf(&linker, "linker_interface:%s", iface);
adm_entry_get_linker_param(ctx, dm_print_path("%s%cWANDevice%c", dmroot, dm_delim, dm_delim), linker, value); // MEM WILL BE FREED IN DMMEMCLEAN
if (*value == NULL) {
*value = "";
}
dmfree(linker);
}
return 0;
}
int set_layer3_def_conn_serv(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
int i;
char *linker, *iface;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
adm_entry_get_linker_value(ctx, value, &linker);
if (linker) {
iface = linker + sizeof("linker_interface:") - 1;
dmuci_set_value("cwmp", "cpe", "default_wan_interface", iface);
dmfree(linker);
}
return 0;
}
return 0;
}
int get_layer3_nbr_entry(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *s;
int cnt = 0;
FILE *fp;
char line[MAX_PROC_ROUTING];
struct proc_routing proute;
uci_foreach_sections("network", "route", s) {
cnt++;
}
uci_foreach_sections("network", "route_disabled", s) {
cnt++;
}
fp = fopen(ROUTE_FILE, "r");
if ( fp != NULL)
{
fgets(line, MAX_PROC_ROUTING, fp);
while (fgets(line, MAX_PROC_ROUTING, fp) != NULL )
{
if (line[0] == '\n')
continue;
parse_proc_route_line(line, &proute);
if (is_proute_static(&proute))
continue;
cnt++;
}
fclose(fp) ;
}
dmasprintf(value, "%d", cnt); // MEM WILL BE FREED IN DMMEMCLEAN
return 0;
}
int get_layer3_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *dmmap_section;
*value = "";
if(((struct routingfwdargs *)data)->type == ROUTE_DYNAMIC)
dmmap_section= ((struct routingfwdargs *)data)->routefwdsection;
else if (((struct routingfwdargs *)data)->type == ROUTE_STATIC)
get_dmmap_section_of_config_section("dmmap_route_forwarding", "route", section_name(((struct routingfwdargs *)data)->routefwdsection), &dmmap_section);
else
get_dmmap_section_of_config_section("dmmap_route_forwarding", "route_disabled", section_name(((struct routingfwdargs *)data)->routefwdsection), &dmmap_section);
dmuci_get_value_by_section_string(dmmap_section, "routealias", value);
return 0;
}
int set_layer3_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct uci_section *dmmap_section;
if(((struct routingfwdargs *)data)->type == ROUTE_DYNAMIC)
dmmap_section= ((struct routingfwdargs *)data)->routefwdsection;
else if (((struct routingfwdargs *)data)->type == ROUTE_STATIC)
get_dmmap_section_of_config_section("dmmap_route_forwarding", "route", section_name(((struct routingfwdargs *)data)->routefwdsection), &dmmap_section);
else
get_dmmap_section_of_config_section("dmmap_route_forwarding", "route_disabled", section_name(((struct routingfwdargs *)data)->routefwdsection), &dmmap_section);
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section(dmmap_section, "routealias", value);
return 0;
}
return 0;
}
/////////////SUB ENTRIES///////////////
struct dm_permession_s DMForwarding_perm = {"0", &get_forwording_perm};
char *get_forwording_perm(char *refparam, struct dmctx *dmctx, void *data, char *instance)
{
return ((struct routingfwdargs *)data)->permission;
}
int browseForwardingInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *iroute = NULL, *iroute_last = NULL;
char *permission = "1";
struct uci_section *s = NULL, *ss = NULL;
FILE* fp = NULL;
char line[MAX_PROC_ROUTING];
struct proc_routing proute;
bool find_max = true;
struct routingfwdargs curr_routefwdargs = {0};
struct dmmap_dup *p;
LIST_HEAD(dup_list);
synchronize_specific_config_sections_with_dmmap("network", "route", "dmmap_route_forwarding", &dup_list);
list_for_each_entry(p, &dup_list, list) {
init_args_rentry(&curr_routefwdargs, p->config_section, "1", NULL, ROUTE_STATIC);
iroute = handle_update_instance(1, dmctx, &iroute_last, forwarding_update_instance_alias_icwmpd, 4, p->dmmap_section, "routeinstance", "routealias", &find_max);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_routefwdargs, iroute) == DM_STOP)
goto end;
}
free_dmmap_config_dup_list(&dup_list);
synchronize_specific_config_sections_with_dmmap("network", "route_disabled", "dmmap_route_forwarding", &dup_list);
list_for_each_entry(p, &dup_list, list) {
init_args_rentry(&curr_routefwdargs, p->config_section, "1", NULL, ROUTE_DISABLED);
iroute = handle_update_instance(1, dmctx, &iroute_last, forwarding_update_instance_alias_icwmpd, 4, p->dmmap_section, "routeinstance", "routealias", &find_max);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_routefwdargs, iroute) == DM_STOP)
goto end;
}
free_dmmap_config_dup_list(&dup_list);
fp = fopen(ROUTE_FILE, "r");
if ( fp != NULL)
{
fgets(line, MAX_PROC_ROUTING, fp);
while (fgets(line, MAX_PROC_ROUTING, fp) != NULL )
{
if (line[0] == '\n')
continue;
parse_proc_route_line(line, &proute);
if (is_proute_static(&proute))
continue;
ss = update_route_dynamic_section(&proute);
init_args_rentry(&curr_routefwdargs, ss, "0", &proute, ROUTE_DYNAMIC);
iroute = handle_update_instance(1, dmctx, &iroute_last, forwarding_update_instance_alias_icwmpd, 4, ss, "routeinstance", "routealias", &find_max);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_routefwdargs, iroute) == DM_STOP)
goto end;
}
fclose(fp);
}
end:
return 0;
}

View file

@ -1,49 +0,0 @@
#ifndef __LAYER3_FORWORDING_H
#define __LAYER3_FORWORDING_H
#define ROUTE_FILE "/proc/net/route"
enum enum_route_type {
ROUTE_STATIC,
ROUTE_DYNAMIC,
ROUTE_DISABLED
};
extern struct dm_permession_s DMForwarding_perm;
extern DMLEAF tForwardingInstParam[];
extern DMOBJ tLayer3ForwardingObj[];
extern DMLEAF tLayer3ForwardingParam[];
int browseForwardingInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
char *get_forwording_perm(char *refparam, struct dmctx *dmctx, void *data, char *instance);
int add_forwarding(char *refparam, struct dmctx *ctx, void *data, char **instancepara);
int delete_forwarding(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
int get_layer3_def_conn_serv(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_layer3_nbr_entry(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_layer3_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_layer3_status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_layer3_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_layer3_type(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_layer3_destip(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_layer3_destmask(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_layer3_src_address(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_layer3_src_mask(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_layer3_gatewayip(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_layer3_interface_linker_parameter(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_layer3_metric(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_layer3_mtu(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_layer3_def_conn_serv(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_layer3_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_layer3_destip(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_layer3_destmask(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_layer3_gatewayip(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_layer3_interface_linker_parameter(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_layer3_metric(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_layer3_mtu(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_layer3_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
#endif

View file

@ -1,267 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2012-2016 PIVA SOFTWARE (www.pivasoftware.com)
* Author: Imen Bhiri <imen.bhiri@pivasoftware.com>
* Author: Anis Ellouze <anis.ellouze@pivasoftware.com>
*/
#include <ctype.h>
#include <uci.h>
#include <stdio.h>
#include "dmcwmp.h"
#include "dmuci.h"
#include "dmubus.h"
#include "dmcommon.h"
#include "uploaddiagnostic.h"
DMLEAF tUploadDiagnosticsParam[] = {
{"DiagnosticsState", &DMWRITE, DMT_STRING, get_upload_diagnostics_state, set_upload_diagnostics_state, NULL, NULL},
{"UploadURL", &DMWRITE, DMT_STRING, get_upload_diagnostics_url, set_upload_diagnostics_url, NULL, NULL},
{"TestFileLength", &DMWRITE, DMT_UNINT, get_upload_diagnostic_test_file_length, set_upload_diagnostic_test_file_length, NULL, NULL},
{"EthernetPriority", &DMWRITE, DMT_UNINT, get_upload_diagnostics_ethernet_priority, set_upload_diagnostics_ethernet_priority, NULL, NULL},
{"ROMTime", &DMREAD, DMT_TIME, get_upload_diagnostic_romtime, NULL, NULL, NULL},
{"BOMTime", &DMREAD, DMT_TIME, get_upload_diagnostic_bomtime, NULL, NULL, NULL},
{"EOMTime", &DMREAD, DMT_TIME, get_upload_diagnostic_eomtime, NULL, NULL, NULL},
{"TotalBytesSent", &DMREAD, DMT_UNINT, get_upload_diagnostic_totalbytes, NULL, NULL, NULL},
{"TCPOpenRequestTime", &DMREAD, DMT_TIME, get_upload_diagnostic_tcp_open_request_time, NULL, NULL, NULL},
{"TCPOpenResponseTime", &DMREAD, DMT_TIME, get_upload_diagnostic_tcp_open_response_time, NULL, NULL, NULL},
{"DSCP", &DMWRITE, DMT_UNINT, get_upload_diagnostic_dscp, set_upload_diagnostic_dscp, NULL, NULL},
//{"Interface", &DMWRITE, DMT_UNINT, get_upload_diagnostics_interface, set_upload_diagnostics_interface, NULL, NULL},
{0}
};
static inline char *upload_diagnostic_get(char *option, char *def)
{
char *tmp;
dmuci_get_varstate_string("cwmp", "@uploaddiagnostic[0]", option, &tmp);
if(tmp && tmp[0] == '\0')
return dmstrdup(def);
else
return tmp;
}
int get_upload_diagnostics_state(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = upload_diagnostic_get("DiagnosticState", "None");
return 0;
}
int set_upload_diagnostics_state(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
char *tmp;
struct uci_section *curr_section = NULL;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
if (strcmp(value, "Requested") == 0) {
UPLOAD_DIAGNOSTIC_STOP
curr_section = (struct uci_section *)dmuci_walk_state_section("cwmp", "downloaddiagnostic", NULL, NULL, CMP_SECTION, NULL, NULL, GET_FIRST_SECTION);
if(!curr_section)
{
dmuci_add_state_section("cwmp", "uploaddiagnostic", &curr_section, &tmp);
}
dmuci_set_varstate_value("cwmp", "@uploaddiagnostic[0]", "DiagnosticState", value);
cwmp_set_end_session(END_SESSION_UPLOAD_DIAGNOSTIC);
}
return 0;
}
return 0;
}
int get_upload_diagnostics_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_varstate_string("cwmp", "@uploaddiagnostic[0]", "interface", value);
return 0;
}
int set_upload_diagnostics_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
char *tmp;
struct uci_section *curr_section = NULL;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
UPLOAD_DIAGNOSTIC_STOP
curr_section = (struct uci_section *)dmuci_walk_state_section("cwmp", "uploaddiagnostic", NULL, NULL, CMP_SECTION, NULL, NULL, GET_FIRST_SECTION);
if(!curr_section)
{
dmuci_add_state_section("cwmp", "uploaddiagnostic", &curr_section, &tmp);
}
dmuci_set_varstate_value("cwmp", "@uploaddiagnostic[0]", "interface", value);
return 0;
}
return 0;
}
int get_upload_diagnostics_url(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_varstate_string("cwmp", "@uploaddiagnostic[0]", "url", value);
return 0;
}
int set_upload_diagnostics_url(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
char *tmp;
struct uci_section *curr_section = NULL;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
UPLOAD_DIAGNOSTIC_STOP
curr_section = (struct uci_section *)dmuci_walk_state_section("cwmp", "uploaddiagnostic", NULL, NULL, CMP_SECTION, NULL, NULL, GET_FIRST_SECTION);
if(!curr_section)
{
dmuci_add_state_section("cwmp", "uploaddiagnostic", &curr_section, &tmp);
}
dmuci_set_varstate_value("cwmp", "@uploaddiagnostic[0]", "url", value);
return 0;
}
return 0;
}
int get_upload_diagnostics_ethernet_priority(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = "";
return 0;
}
int set_upload_diagnostics_ethernet_priority(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
char *tmp;
struct uci_section *curr_section = NULL;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
UPLOAD_DIAGNOSTIC_STOP
curr_section = (struct uci_section *)dmuci_walk_state_section("cwmp", "uploaddiagnostic", NULL, NULL, CMP_SECTION, NULL, NULL, GET_FIRST_SECTION);
if(!curr_section)
{
dmuci_add_state_section("cwmp", "uploaddiagnostic", &curr_section, &tmp);
}
dmuci_set_varstate_value("cwmp", "@uploaddiagnostic[0]", "ethernetpriority", value);
return 0;
}
return 0;
}
int get_upload_diagnostic_romtime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_varstate_string("cwmp", "@uploaddiagnostic[0]", "ROMtime", value);
if ((*value)[0] == '\0')
*value = "0";
return 0;
}
int get_upload_diagnostic_bomtime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_varstate_string("cwmp", "@uploaddiagnostic[0]", "BOMtime", value);
if ((*value)[0] == '\0')
*value = "0";
return 0;
}
int get_upload_diagnostic_eomtime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_varstate_string("cwmp", "@uploaddiagnostic[0]", "EOMtime", value);
if ((*value)[0] == '\0')
*value = "0";
return 0;
}
int get_upload_diagnostic_test_file_length(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_varstate_string("cwmp", "@uploaddiagnostic[0]", "TestFileLength", value);
if ((*value)[0] == '\0')
*value = "0";
return 0;
}
int set_upload_diagnostic_test_file_length(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
char *tmp;
struct uci_section *curr_section = NULL;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
UPLOAD_DIAGNOSTIC_STOP
curr_section = (struct uci_section *)dmuci_walk_state_section("cwmp", "uploaddiagnostic", NULL, NULL, CMP_SECTION, NULL, NULL, GET_FIRST_SECTION);
if(!curr_section)
{
dmuci_add_state_section("cwmp", "uploaddiagnostic", &curr_section, &tmp);
}
dmuci_set_varstate_value("cwmp", "@uploaddiagnostic[0]", "TestFileLength", value);
return 0;
}
return 0;
}
int get_upload_diagnostic_totalbytes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_varstate_string("cwmp", "@uploaddiagnostic[0]", "TotalBytesSent", value);
if ((*value)[0] == '\0')
*value = "0";
return 0;
}
int get_upload_diagnostic_tcp_open_request_time(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_varstate_string("cwmp", "@uploaddiagnostic[0]", "TCPOpenRequestTime", value);
if ((*value)[0] == '\0')
*value = "0";
return 0;
}
int get_upload_diagnostic_tcp_open_response_time(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_varstate_string("cwmp", "@uploaddiagnostic[0]", "TCPOpenResponseTime", value);
if ((*value)[0] == '\0')
*value = "0";
return 0;
}
int get_upload_diagnostic_dscp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_varstate_string("cwmp", "@uploaddiagnostic[0]", "DSCP", value);
if ((*value)[0] == '\0')
*value = "0";
return 0;
}
int set_upload_diagnostic_dscp(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
char *tmp;
struct uci_section *curr_section = NULL;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
UPLOAD_DIAGNOSTIC_STOP
curr_section = (struct uci_section *)dmuci_walk_state_section("cwmp", "uploaddiagnostic", NULL, NULL, CMP_SECTION, NULL, NULL, GET_FIRST_SECTION);
if(!curr_section)
{
dmuci_add_state_section("cwmp", "uploaddiagnostic", &curr_section, &tmp);
}
dmuci_set_varstate_value("cwmp", "@uploaddiagnostic[0]", "DSCP", value);
return 0;
}
return 0;
}

View file

@ -1,34 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2012-2014 PIVA SOFTWARE (www.pivasoftware.com)
* Author: Imen Bhiri <imen.bhiri@pivasoftware.com>
*/
#ifndef __UPLOAD_DIAGNOSTIC_H
#define __UPLOAD_DIAGNOSTIC_H
extern DMLEAF tUploadDiagnosticsParam[];
static inline char *upload_diagnostic_get(char *option, char *def);
int get_upload_diagnostics_state(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_upload_diagnostics_state(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_upload_diagnostics_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_upload_diagnostics_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_upload_diagnostics_url(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_upload_diagnostics_url(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_upload_diagnostics_ethernet_priority(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_upload_diagnostics_ethernet_priority(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_upload_diagnostic_romtime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_upload_diagnostic_bomtime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_upload_diagnostic_eomtime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_upload_diagnostic_test_file_length(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_upload_diagnostic_test_file_length(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_upload_diagnostic_totalbytes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_upload_diagnostic_tcp_open_request_time(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_upload_diagnostic_tcp_open_response_time(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_upload_diagnostic_dscp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_upload_diagnostic_dscp(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
#endif

File diff suppressed because it is too large Load diff

View file

@ -1,143 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2015 PIVA SOFTWARE (www.pivasoftware.com)
* Author: Imen Bhiri <imen.bhiri@pivasoftware.com>
* Author: Feten Besbes <feten.besbes@pivasoftware.com>
*/
#ifndef __WAN_DEVICE_H
#define __WAN_DEVICE_H
#include <libubox/blobmsg_json.h>
#include <json-c/json.h>
struct wanargs
{
/* WANDevice */
struct uci_section *wandevsection;
int instance;
char *fdev;
/* WANConnectionDevice */
struct uci_section *wancdsection;
char *fwan;
char *iwan;
char *wan_ifname;
/* WAN###Connection */
struct uci_section *wancprotosection;
};
extern struct dm_permession_s DMWANConnectionDevice;
extern struct dm_notif_s DMWANConnectionDevicenotif;
extern struct dm_forced_inform_s DMWANConnectionProtocolinform;
extern struct dm_notif_s DMWANConnectionDevicenotif;
extern DMOBJ tWANDeviceObj[];
extern DMLEAF tWANDeviceParam[];
extern DMOBJ tWANConnectionDeviceObj[];
extern DMLEAF tWANConnectionDeviceParam[];
extern DMOBJ tWANConnectionObj[];
extern DMLEAF tWANIPConnectionParam[];
extern DMLEAF tWANPPPConnectionParam[];
extern DMLEAF tWANConnectionStatsParam[];
extern DMLEAF tWANConnection_VLANParam[];
extern DMLEAF tWANDSLLinkConfigParam[];
extern DMLEAF tWANCommonInterfaceConfigParam[];
extern DMLEAF tWANDSLInterfaceConfigParam[];
extern DMOBJ tWANEthernetInterfaceConfigObj[];
extern DMLEAF tWANEthernetInterfaceConfigParam[];
extern DMLEAF tWANEthernetInterfaceConfigStatsParam[];
int browsewandeviceInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
unsigned char get_wan_protocol_connection_forced_inform(char *refparam, struct dmctx *dmctx, void *data, char *instance);
int browsewanconnectiondeviceInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browsewanprotocolconnectionipInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browsewanprotocolconnectionpppInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int add_wan_wanconnectiondevice(char *refparam, struct dmctx *ctx, void *data, char **instancepara);
int delete_wan_wanconnectiondevice(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
int add_wan_wanipconnection(char *refparam, struct dmctx *ctx, void *data, char **instancepara);
int delete_wan_wanipconnectiondevice(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
int add_wan_wanpppconnection(char *refparam, struct dmctx *ctx, void *data, char **instancepara);
int delete_wan_wanpppconnectiondevice(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
bool check_wan_is_ethernet(struct dmctx *dmctx, void *data);
bool check_wan_is_atm(struct dmctx *dmctx, void *data);
int get_wan_dev_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wan_con_dev_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wan_ip_con_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_interface_enable_wanproto(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wan_device_mng_status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wan_device_mng_interface_ip(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wan_device_mng_interface_mac(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wan_ip_link_connection_connection_type(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wan_ip_link_connection_addressing_type(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wan_ip_link_connection_nat_enabled(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_interface_firewall_enabled_wanproto(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wan_ip_link_connection_igmp_enabled(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wan_ip_link_connection_dns_enabled(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wan_ip_link_connection_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wan_ppp_con_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_interface_enable_wanproto(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wan_device_ppp_status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wan_device_mng_interface_mac(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wan_device_ppp_username(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wan_link_connection_eth_bytes_received(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wan_link_connection_eth_bytes_sent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wan_link_connection_eth_pack_received(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wan_link_connection_eth_pack_sent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wan_ip_link_connection_vid(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wan_ip_link_connection_vpriority(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wan_ip_link_connection_layer2_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wan_dsl_link_config_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wan_dsl_link_config_destination_address(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wan_dsl_link_config_atm_encapsulation(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wan_device_wan_access_type(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wan_device_wan_dsl_interface_config_status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wan_device_wan_dsl_interface_config_modulation_type(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wan_device_dsl_datapath(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wan_device_dsl_downstreamcurrrate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wan_device_dsl_downstreammaxrate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wan_device_dsl_downstreamattenuation(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wan_device_dsl_downstreamnoisemargin(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wan_device_dsl_upstreamcurrrate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wan_device_dsl_upstreammaxrate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wan_device_dsl_upstreamattenuation(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wan_device_dsl_upstreamnoisemargin(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_annexm_status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wan_eth_intf_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wan_eth_intf_status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wan_eth_intf_mac(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wan_eth_intf_stats_tx_bytes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wan_eth_intf_stats_rx_bytes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wan_eth_intf_stats_tx_packets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wan_eth_intf_stats_rx_packets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_protocol_connection_linker(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_wan_dev_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_wan_con_dev_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_wan_ip_con_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_interface_enable_wanproto(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_wan_ip_link_connection_connection_type(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_wan_ip_link_connection_addressing_type(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_wan_ip_link_connection_nat_enabled(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_interface_firewall_enabled_wanproto(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_wan_ip_link_connection_igmp_enabled(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_wan_ip_link_connection_dns_enabled(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_wan_ip_link_connection_connection_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_wan_ppp_con_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_interface_enable_wanproto(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_wan_device_username(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_wan_device_password(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_wan_ip_link_connection_vid(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_wan_ip_link_connection_vpriority(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_wan_ip_link_connection_layer2_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_wan_dsl_link_config_destination_address(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_wan_dsl_link_config_atm_encapsulation(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_annexm_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_wan_eth_intf_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
#endif

View file

@ -1,259 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2015 Inteno Broadband Technology AB
* Author Imen Bhiri <imen.bhiri@pivasoftware.com>
*
*/
#include <uci.h>
#include <stdio.h>
#include <ctype.h>
#include "dmuci.h"
#include "dmubus.h"
#include "dmcwmp.h"
#include "dmcommon.h"
#include "x_iopsys_eu_wifi.h"
#include "dmjson.h"
/*** X_IOPSYS_EU_Wifi. ***/
DMLEAF tsewifiParam[] = {
{"Bandsteering_Enable", &DMWRITE, DMT_BOOL, get_bandsteering_enable, set_bandsteering_enable, NULL, NULL},
{"Bandsteering_Rssi_Threshold", &DMWRITE, DMT_BOOL, get_bandsteering_rssi_threshold, set_bandsteering_rssi_threshold, NULL, NULL},
{"Bandsteering_Policy", &DMWRITE, DMT_BOOL, get_bandsteering_policy, set_bandsteering_policy, NULL, NULL},
{"Bandsteering_Bw_Util", &DMWRITE, DMT_BOOL, get_bandsteering_bw_util, set_bandsteering_bw_util, NULL, NULL},
{0}
};
DMOBJ tsewifiObj[] = {
/* OBJ, permission, addobj, delobj, browseinstobj, finform, notification, nextobj, leaf*/
{"Radio", &DMREAD, NULL, NULL, NULL, browsesewifiradioInst, NULL, NULL, NULL, tsewifiradioParam, NULL},
{0}
};
/*** X_IOPSYS_EU_Wifi.Radio.{i}. ***/
DMLEAF tsewifiradioParam[] = {
{"Alias", &DMWRITE, DMT_STRING, get_radio_alias, set_radio_alias, NULL, NULL},
{"Frequency", &DMREAD, DMT_STRING, get_wifi_frequency, NULL, NULL, NULL},
{"MaxAssociations", &DMWRITE, DMT_STRING, get_wifi_maxassoc, set_wifi_maxassoc, NULL, NULL},
{"DFSEnable", &DMWRITE, DMT_BOOL, get_wifi_dfsenable, set_wifi_dfsenable, NULL, NULL},
{0}
};
int get_bandsteering_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string("wireless", "bandsteering", "enabled", value);
return 0;
}
int set_bandsteering_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
bool b;
switch (action) {
case VALUECHECK:
if (string_to_bool(value, &b))
return FAULT_9007;
return 0;
case VALUESET:
string_to_bool(value, &b);
if (b) {
dmuci_set_value("wireless", "bandsteering", "enabled", "1");
}
else {
dmuci_set_value("wireless", "bandsteering", "enabled", "0");
}
return 0;
}
return 0;
}
int get_bandsteering_rssi_threshold(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string("wireless", "bandsteering", "rssi_threshold", value);
return 0;
}
int set_bandsteering_rssi_threshold(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
if (value == NULL)
return FAULT_9007;
return 0;
case VALUESET:
dmuci_set_value("wireless", "bandsteering", "rssi_threshold", value);
return 0;
}
return 0;
}
int get_bandsteering_policy(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string("wireless", "bandsteering", "policy", value);
return 0;
}
int set_bandsteering_policy(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
if (value == NULL)
return FAULT_9007;
return 0;
case VALUESET:
dmuci_set_value("wireless", "bandsteering", "policy", value);
return 0;
}
return 0;
}
int get_bandsteering_bw_util(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string("wireless", "bandsteering", "bw_util", value);
return 0;
}
int set_bandsteering_bw_util(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
bool b;
switch (action) {
case VALUECHECK:
if (value==NULL)
return FAULT_9007;
return 0;
case VALUESET:
dmuci_set_value("wireless", "bandsteering", "bw_util", value);
return 0;
}
return 0;
}
int get_wifi_frequency(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char *freq;
json_object *res;
struct uci_section *sewifisection = (struct uci_section *)data;
char *wlan_name = section_name(sewifisection);
dmubus_call("router.wireless", "status", UBUS_ARGS{{"vif", wlan_name, String}}, 1, &res);
DM_ASSERT(res, *value = "");
freq = dmjson_get_value(res, 1, "frequency");
if(strcmp(freq, "2") == 0 ) {
dmastrcat(value, freq, ".4GHz"); // MEM WILL BE FREED IN DMMEMCLEAN
return 0;
}
dmastrcat(value, freq, "GHz"); // MEM WILL BE FREED IN DMMEMCLEAN
return 0;
}
int get_wifi_maxassoc(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *sewifisection = (struct uci_section *)data;
dmuci_get_value_by_section_string(sewifisection, "maxassoc", value);
return 0;
}
int set_wifi_maxassoc(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct uci_section *sewifisection = (struct uci_section *)data;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section(sewifisection, "maxassoc", value);
return 0;
}
return 0;
}
int get_wifi_dfsenable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char *val;
struct uci_section *sewifisection = (struct uci_section *)data;
char *wlan_name = section_name(sewifisection);
*value = "";
dmuci_get_value_by_section_string(sewifisection, "band", &val);
if (val[0] == 'a') {
dmuci_get_value_by_section_string(sewifisection, "dfsc", value);
if ((*value)[0] == '\0')
*value = "0";
}
return 0;
}
int set_wifi_dfsenable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
bool b;
char *val;
struct uci_section *sewifisection = (struct uci_section *)data;
char *wlan_name = section_name(sewifisection);
switch (action) {
case VALUECHECK:
if (string_to_bool(value, &b))
return FAULT_9007;
return 0;
case VALUESET:
dmuci_get_value_by_section_string(sewifisection, "band", &val);
if (val[0] == 'a') {
string_to_bool(value, &b);
if (b)
dmuci_set_value_by_section(sewifisection, "dfsc", "1");
else
dmuci_set_value_by_section(sewifisection, "dfsc", "0");
}
return 0;
}
return 0;
}
////////////////////////SET AND GET ALIAS/////////////////////////////////
static int get_radio_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *dmmap_section;
get_dmmap_section_of_config_section("dmmap_wireless", "wifi-device", section_name((struct uci_section *)data), &dmmap_section);
dmuci_get_value_by_section_string(dmmap_section, "radioalias", value);
return 0;
}
static int set_radio_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct uci_section *dmmap_section;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
get_dmmap_section_of_config_section("dmmap_wireless", "wifi-device", section_name((struct uci_section *)data), &dmmap_section);
dmuci_set_value_by_section(dmmap_section, "radioalias", value);
return 0;
}
return 0;
}
int browsesewifiradioInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *wnum = NULL, *wnum_last = NULL;
struct uci_section *s = NULL;
struct dmmap_dup *p;
LIST_HEAD(dup_list);
synchronize_specific_config_sections_with_dmmap("wireless", "wifi-device", "dmmap_wireless", &dup_list);
list_for_each_entry(p, &dup_list, list) {
wnum = handle_update_instance(1, dmctx, &wnum_last, update_instance_alias, 3, p->dmmap_section, "radioinstance", "radioalias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, wnum) == DM_STOP)
break;
}
free_dmmap_config_dup_list(&dup_list);
return 0;
}

View file

@ -1,28 +0,0 @@
#ifndef __SE_WIFI_H
#define __SE_WIFI_H
extern DMLEAF tsewifiradioParam[];
extern DMLEAF tsewifiParam[];
extern DMOBJ tsewifiObj[];
int get_bandsteering_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_bandsteering_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_bandsteering_rssi_threshold(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_bandsteering_rssi_threshold(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_bandsteering_policy(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_bandsteering_policy(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_bandsteering_bw_util(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_bandsteering_bw_util(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int browsesewifiradioInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
static int get_radio_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wifi_frequency(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wifi_maxassoc(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_wifi_dfsenable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
static int set_radio_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_wifi_maxassoc(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_wifi_dfsenable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
#endif

File diff suppressed because it is too large Load diff

View file

@ -1,144 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2019 iopsys Software Solutions AB
* Author: Anis Ellouze <anis.ellouze@pivasoftware.com>
* Author: Amin Ben Ramdhane <amin.benramdhane@pivasoftware.com>
*
*/
#ifndef __BRIDGING_H
#define __BRIDGING_H
struct bridging_args
{
struct uci_section *bridge_sec;
char *br_key;
char *ifname;
char *br_inst;
};
struct bridging_port_args
{
struct uci_section *bridge_port_sec;
struct uci_section *bridge_sec;
bool vlan;
char *ifname;
};
struct bridging_vlan_args
{
struct uci_section *bridge_vlan_sec;
struct uci_section *bridge_sec;
char *vlan_port;
char *br_inst;
char *ifname;
};
extern DMOBJ tBridgingObj[];
extern DMLEAF tBridgingParams[];
extern DMOBJ tBridgingBridgeObj[];
extern DMLEAF tBridgingBridgeParams[];
extern DMLEAF tBridgeVlanParams[];
extern DMLEAF tBridgePortParams[];
extern DMLEAF tBridgeVlanPortParams[];
extern DMOBJ tBridgePortObj[];
extern DMLEAF tBridgePortStatParams[];
int browseBridgeVlanPortInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseBridgeVlanInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseBridgePortInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseBridgeInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int get_linker_br_port(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker);
int get_linker_br_vlan(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker);
int add_bridge(char *refparam, struct dmctx *ctx, void *data, char **instance);
int delete_bridge(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
int add_br_vlan(char *refparam, struct dmctx *ctx, void *data, char **instance);
int delete_br_vlan(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
int add_br_port(char *refparam, struct dmctx *ctx, void *data, char **instance);
int delete_br_port(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
int get_Max_Bridge_Entries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_Max_DBridge_Entries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_Max_QBridge_Entries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_Max_VLAN_Entries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_Max_Provider_Bridge_Entries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_Max_Filter_Entries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_Bridge_Number_Of_Entries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_br_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_br_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_br_status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_br_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_br_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_br_standard(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_br_standard(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_br_port_number_of_entries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_br_vlan_number_of_entries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_br_vlan_port_number_of_entries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_br_associated_interfaces(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_br_associated_interfaces(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_br_port_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_br_port_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_br_port_status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_br_port_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_br_port_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_br_port_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_br_port_last_change(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_br_port_management(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_br_port_management(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_br_port_type(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_br_port_type(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_br_port_default_user_priority(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_br_port_default_user_priority(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_br_port_priority_regeneration(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_br_port_priority_regeneration(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_br_port_port_state(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_br_port_pvid(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_br_port_pvid(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_br_port_tpid(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_br_port_tpid(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_port_lower_layer(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_port_lower_layer(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_br_port_stats_tx_bytes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_br_port_stats_rx_bytes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_br_port_stats_tx_packets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_br_port_stats_rx_packets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_br_port_stats_tx_errors(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_br_port_stats_rx_errors(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_br_port_stats_tx_unicast_packets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_br_port_stats_rx_unicast_packets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_br_port_stats_tx_discard_packets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_br_port_stats_rx_discard_packets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_br_port_stats_tx_multicast_packets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_br_port_stats_rx_multicast_packets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_br_port_stats_tx_broadcast_packets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_br_port_stats_rx_broadcast_packets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_br_port_stats_rx_unknown_proto_packets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_br_vlan_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_br_vlan_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_br_vlan_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_br_vlan_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_br_vlan_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_br_vlan_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_br_vlan_vid(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_br_vlan_vid(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_br_vlan_priority(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_br_vlan_priority(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_vlan_port_vlan_ref(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_vlan_port_vlan_ref(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_vlan_port_port_ref(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_vlan_port_port_ref(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_br_vlan_untagged(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_br_vlan_untagged(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
#endif

File diff suppressed because it is too large Load diff

View file

@ -1,240 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2016 Inteno Broadband Technology AB
* Author: Anis Ellouze <anis.ellouze@pivasoftware.com>
*
*/
#ifndef __DHCP_H
#define __DHCP_H
#include <json-c/json.h>
struct dhcp_args
{
struct uci_section *dhcp_sec;
char *interface;
};
struct dhcp_static_args
{
struct uci_section *dhcpsection;
};
struct client_args
{
json_object *client;
char *key;
};
struct dhcp_client_ipv4address_args {
char *mac;
char *ip;
unsigned int leasetime;
};
struct dhcp_client_args {
struct uci_section *dhcp_client_conf;
struct uci_section *dhcp_client_dm;
struct uci_section *macclassifier;
struct uci_section *vendorclassidclassifier;
struct uci_section *userclassclassifier;
char *ip;
char *mask;
};
struct dhcp_client_option_args {
struct uci_section *opt_sect;
struct uci_section *client_sect;
char *option_tag;
char *value;
};
extern DMOBJ tDhcpv4Obj[];
extern DMOBJ tDhcpv4ServerObj[];
extern DMOBJ tDhcpServerPoolObj[];
extern DMOBJ tDhcpServerPoolClientObj[];
extern DMLEAF tDhcpServerPoolParams[];
extern DMLEAF tDhcpServerPoolAddressParams[];
extern DMLEAF tDhcpServerPoolClientParams[];
extern DMLEAF tDhcpServerPoolClientIPv4AddressParams[];
extern DMLEAF tDHCPv4Params[];
extern DMOBJ tDHCPv4ClientObj[];
extern DMLEAF tDHCPv4ClientParams[];
extern DMLEAF tDHCPv4ClientSentOptionParams[];
extern DMLEAF tDHCPv4ClientReqOptionParams[];
extern DMOBJ tDHCPv4ServerObj[];
extern DMLEAF tDHCPv4ServerParams[];
extern DMLEAF tDHCPv4ServerPoolOptionParams[];
extern DMLEAF tDHCPv4ServerPoolClientIPv4AddressParams[];
extern DMLEAF tDHCPv4ServerPoolClientOptionParams[];
extern DMOBJ tDHCPv4RelayObj[];
extern DMLEAF tDHCPv4RelayParams[];
extern DMLEAF tDHCPv4RelayForwardingParams[];
int browseDhcpInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseDhcpStaticInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseDhcpClientInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseDhcpClientIPv4Inst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseDHCPv4ClientInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseDHCPv4ClientSentOptionInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseDHCPv4ClientReqOptionInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseDHCPv4ServerPoolOptionInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseDHCPv4ServerPoolClientOptionInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseDHCPv4RelayForwardingInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int add_dhcp_server(char *refparam, struct dmctx *ctx, void *data, char **instancepara);
int delete_dhcp_server(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
int add_dhcp_staticaddress(char *refparam, struct dmctx *ctx, void *data, char **instancepara);
int delete_dhcp_staticaddress(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
int addObjDHCPv4Client(char *refparam, struct dmctx *ctx, void *data, char **instance);
int delObjDHCPv4Client(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
int addObjDHCPv4ClientSentOption(char *refparam, struct dmctx *ctx, void *data, char **instance);
int delObjDHCPv4ClientSentOption(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
int addObjDHCPv4ClientReqOption(char *refparam, struct dmctx *ctx, void *data, char **instance);
int delObjDHCPv4ClientReqOption(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
int addObjDHCPv4ServerPoolOption(char *refparam, struct dmctx *ctx, void *data, char **instance);
int delObjDHCPv4ServerPoolOption(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
int addObjDHCPv4RelayForwarding(char *refparam, struct dmctx *ctx, void *data, char **instance);
int delObjDHCPv4RelayForwarding(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
int get_server_pool_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_dns_server(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_dhcp_configurable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_dhcp_status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_dhcp_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_dhcp_interval_address_min(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_dhcp_interval_address_max(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_dhcp_reserved_addresses(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_dhcp_subnetmask(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_dhcp_iprouters(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_dhcp_leasetime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_dhcp_domainname(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_dhcp_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_dhcp_static_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_dhcp_staticaddress_chaddr(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_dhcp_staticaddress_yiaddr(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_dhcp_client_chaddr(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_dhcp_client_ipv4address_ip_address(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_dhcp_client_ipv4address_leasetime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_dhcp_sever_pool_order(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_static_address_number_of_entries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_option_number_of_entries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_clients_number_of_entries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_dhcp_client_active(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_server_pool_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_dns_server(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_dhcp_configurable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_dhcp_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_dhcp_address_min(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_dhcp_address_max(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_dhcp_reserved_addresses(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_dhcp_subnetmask(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_dhcp_iprouters(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_dhcp_leasetime(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_dhcp_domainname(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_dhcp_interface_linker_parameter(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_dhcp_static_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_dhcp_staticaddress_chaddr(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_dhcp_staticaddress_yiaddr(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_dhcp_sever_pool_order(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_dhcp_client_linker(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker);
int set_section_order(char *package, char *dmpackage, char* sect_type, struct uci_section *dmmap_sect, struct uci_section *conf, int set_force, char* order);
int get_DHCPv4_ClientNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DHCPv4Client_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv4Client_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv4Client_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv4Client_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv4Client_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv4Client_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv4Client_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DHCPv4Client_DHCPStatus(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DHCPv4Client_Renew(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv4Client_Renew(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv4Client_IPAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DHCPv4Client_SubnetMask(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DHCPv4Client_IPRouters(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DHCPv4Client_DNSServers(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DHCPv4Client_LeaseTimeRemaining(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DHCPv4Client_DHCPServer(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DHCPv4Client_PassthroughEnable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv4Client_PassthroughEnable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv4Client_PassthroughDHCPPool(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv4Client_PassthroughDHCPPool(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv4Client_SentOptionNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DHCPv4Client_ReqOptionNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DHCPv4ClientSentOption_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv4ClientSentOption_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv4ClientSentOption_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv4ClientSentOption_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv4ClientSentOption_Tag(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv4ClientSentOption_Tag(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv4ClientSentOption_Value(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv4ClientSentOption_Value(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv4ClientReqOption_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv4ClientReqOption_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv4ClientReqOption_Order(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv4ClientReqOption_Order(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv4ClientReqOption_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv4ClientReqOption_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv4ClientReqOption_Tag(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv4ClientReqOption_Tag(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv4ClientReqOption_Value(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DHCPv4Server_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv4Server_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv4ServerPoolOption_Tag(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv4ServerPoolOption_Tag(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv4Server_PoolNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DHCPv4ServerPoolOption_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv4ServerPoolOption_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv4ServerPoolOption_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv4ServerPoolOption_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv4ServerPoolOption_Value(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv4ServerPoolOption_Value(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv4ServerPoolClientOption_Tag(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DHCPv4RelayForwarding_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv4RelayForwarding_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv4RelayForwarding_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DHCPv4RelayForwarding_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv4RelayForwarding_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv4RelayForwarding_Order(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv4RelayForwarding_Order(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv4RelayForwarding_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv4RelayForwarding_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv4RelayForwarding_VendorClassID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv4RelayForwarding_VendorClassID(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv4RelayForwarding_VendorClassIDExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv4RelayForwarding_VendorClassIDExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv4RelayForwarding_VendorClassIDMode(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv4RelayForwarding_VendorClassIDMode(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv4RelayForwarding_ClientID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv4RelayForwarding_ClientID(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv4RelayForwarding_ClientIDExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv4RelayForwarding_ClientIDExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv4RelayForwarding_UserClassID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv4RelayForwarding_UserClassID(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv4RelayForwarding_UserClassIDExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv4RelayForwarding_UserClassIDExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv4RelayForwarding_Chaddr(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv4RelayForwarding_Chaddr(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv4RelayForwarding_ChaddrMask(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv4RelayForwarding_ChaddrMask(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv4RelayForwarding_ChaddrExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv4RelayForwarding_ChaddrExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv4RelayForwarding_LocallyServed(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv4RelayForwarding_LocallyServed(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv4RelayForwarding_DHCPServerIPAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv4RelayForwarding_DHCPServerIPAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv4ServerPoolClientOption_Value(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DHCPv4Relay_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv4Relay_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv4Relay_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DHCPv4Relay_ForwardingNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
#endif

File diff suppressed because it is too large Load diff

View file

@ -1,190 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2019 iopsys Software Solutions AB
* Author: Omar Kallel <omar.kallel@pivasoftware.com>
*/
#ifndef __DHCPV6_H
#define __DHCPV6_H
extern DMOBJ tDHCPv6Obj[];
extern DMLEAF tDHCPv6Params[];
extern DMOBJ tDHCPv6ClientObj[];
extern DMLEAF tDHCPv6ClientParams[];
extern DMLEAF tDHCPv6ClientServerParams[];
extern DMLEAF tDHCPv6ClientSentOptionParams[];
extern DMLEAF tDHCPv6ClientReceivedOptionParams[];
extern DMOBJ tDHCPv6ServerObj[];
extern DMLEAF tDHCPv6ServerParams[];
extern DMOBJ tDHCPv6ServerPoolObj[];
extern DMLEAF tDHCPv6ServerPoolParams[];
extern DMOBJ tDHCPv6ServerPoolClientObj[];
extern DMLEAF tDHCPv6ServerPoolClientParams[];
extern DMLEAF tDHCPv6ServerPoolClientIPv6AddressParams[];
extern DMLEAF tDHCPv6ServerPoolClientIPv6PrefixParams[];
extern DMLEAF tDHCPv6ServerPoolClientOptionParams[];
extern DMLEAF tDHCPv6ServerPoolOptionParams[];
struct dhcpv6_client_args {
struct uci_section *dhcp_client_conf;
struct uci_section *dhcp_client_dm;
char *ip;
};
struct dhcpv6_args
{
struct uci_section *dhcp_sec;
char *interface;
};
struct clientv6_args
{
json_object *client;
json_object *clientparam;
int idx;
};
struct dhcpv6_client_option_args {
struct uci_section *opt_sect;
struct uci_section *client_sect;
char *option_tag;
char *value;
};
int browseDHCPv6ClientInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseDHCPv6ClientServerInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseDHCPv6ClientSentOptionInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseDHCPv6ClientReceivedOptionInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseDHCPv6ServerPoolInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseDHCPv6ServerPoolClientInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseDHCPv6ServerPoolOptionInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseDHCPv6ServerPoolClientIPv6AddressInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseDHCPv6ServerPoolClientIPv6PrefixInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseDHCPv6ServerPoolClientOptionInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int addObjDHCPv6Client(char *refparam, struct dmctx *ctx, void *data, char **instance);
int delObjDHCPv6Client(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
int addObjDHCPv6ClientSentOption(char *refparam, struct dmctx *ctx, void *data, char **instance);
int delObjDHCPv6ClientSentOption(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
int addObjDHCPv6ServerPool(char *refparam, struct dmctx *ctx, void *data, char **instance);
int delObjDHCPv6ServerPool(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
int addObjDHCPv6ServerPoolOption(char *refparam, struct dmctx *ctx, void *data, char **instance);
int delObjDHCPv6ServerPoolOption(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
int get_DHCPv6_ClientNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DHCPv6Client_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv6Client_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv6Client_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv6Client_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv6Client_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv6Client_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv6Client_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DHCPv6Client_DUID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DHCPv6Client_RequestAddresses(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv6Client_RequestAddresses(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv6Client_RequestPrefixes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv6Client_RequestPrefixes(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv6Client_RapidCommit(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv6Client_RapidCommit(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv6Client_Renew(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv6Client_Renew(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv6Client_SuggestedT1(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv6Client_SuggestedT1(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv6Client_SuggestedT2(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv6Client_SuggestedT2(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv6Client_SupportedOptions(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DHCPv6Client_RequestedOptions(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv6Client_RequestedOptions(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv6Client_ServerNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DHCPv6Client_SentOptionNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DHCPv6Client_ReceivedOptionNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DHCPv6ClientServer_SourceAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DHCPv6ClientServer_DUID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DHCPv6ClientServer_InformationRefreshTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DHCPv6ClientSentOption_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv6ClientSentOption_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv6ClientSentOption_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv6ClientSentOption_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv6ClientSentOption_Tag(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv6ClientSentOption_Tag(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv6ClientSentOption_Value(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv6ClientSentOption_Value(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv6ClientReceivedOption_Tag(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DHCPv6ClientReceivedOption_Value(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DHCPv6ClientReceivedOption_Server(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DHCPv6Server_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv6Server_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv6Server_PoolNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DHCPv6ServerPool_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv6ServerPool_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv6ServerPool_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DHCPv6ServerPool_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv6ServerPool_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv6ServerPool_Order(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv6ServerPool_Order(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv6ServerPool_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv6ServerPool_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv6ServerPool_DUID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv6ServerPool_DUID(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv6ServerPool_DUIDExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv6ServerPool_DUIDExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv6ServerPool_VendorClassID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv6ServerPool_VendorClassID(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv6ServerPool_VendorClassIDExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv6ServerPool_VendorClassIDExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv6ServerPool_UserClassID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv6ServerPool_UserClassID(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv6ServerPool_UserClassIDExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv6ServerPool_UserClassIDExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv6ServerPool_SourceAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv6ServerPool_SourceAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv6ServerPool_SourceAddressMask(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv6ServerPool_SourceAddressMask(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv6ServerPool_SourceAddressExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv6ServerPool_SourceAddressExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv6ServerPool_IANAEnable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv6ServerPool_IANAEnable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv6ServerPool_IANAManualPrefixes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv6ServerPool_IANAManualPrefixes(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv6ServerPool_IANAPrefixes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DHCPv6ServerPool_IAPDEnable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv6ServerPool_IAPDEnable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv6ServerPool_IAPDManualPrefixes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv6ServerPool_IAPDManualPrefixes(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv6ServerPool_IAPDPrefixes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DHCPv6ServerPool_IAPDAddLength(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv6ServerPool_IAPDAddLength(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv6ServerPool_ClientNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DHCPv6ServerPool_OptionNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DHCPv6ServerPoolClient_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv6ServerPoolClient_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv6ServerPoolClient_SourceAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DHCPv6ServerPoolClient_Active(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DHCPv6ServerPoolClient_IPv6AddressNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DHCPv6ServerPoolClient_IPv6PrefixNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DHCPv6ServerPoolClient_OptionNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DHCPv6ServerPoolClientIPv6Address_IPAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DHCPv6ServerPoolClientIPv6Address_PreferredLifetime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DHCPv6ServerPoolClientIPv6Address_ValidLifetime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DHCPv6ServerPoolClientIPv6Prefix_Prefix(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DHCPv6ServerPoolClientIPv6Prefix_PreferredLifetime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DHCPv6ServerPoolClientIPv6Prefix_ValidLifetime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DHCPv6ServerPoolClientOption_Tag(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DHCPv6ServerPoolClientOption_Value(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DHCPv6ServerPoolOption_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv6ServerPoolOption_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv6ServerPoolOption_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv6ServerPoolOption_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv6ServerPoolOption_Tag(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv6ServerPoolOption_Tag(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv6ServerPoolOption_Value(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv6ServerPoolOption_Value(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DHCPv6ServerPoolOption_PassthroughClient(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DHCPv6ServerPoolOption_PassthroughClient(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
#endif //__DHCPV6_H

File diff suppressed because it is too large Load diff

View file

@ -1,106 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2019 iopsys Software Solutions AB
* Author: Amin Ben Ramdhane <amin.benramdhane@pivasoftware.com>
*/
#ifndef _DNS_H
#define _DNS_H
#include "dmcwmp.h"
extern DMOBJ tDNSObj[];
extern DMLEAF tDNSParams[];
extern DMLEAF tClientParams[];
extern DMOBJ tClientObj[];
extern DMLEAF tServerParams[];
extern DMLEAF tRelayParams[];
extern DMOBJ tRelayObj[];
extern DMLEAF tForwardingParams[];
extern DMOBJ tDiagnosticsObj[];
extern DMLEAF tNSLookupDiagnosticsParams[];
extern DMOBJ tNSLookupDiagnosticsObj[];
extern DMLEAF tResultParams[];
extern DMLEAF tSDParams[];
extern DMOBJ tSDObj[];
extern DMLEAF tServiceParams[];
extern DMOBJ tSDServiceObj[];
extern DMLEAF tTextRecordParams[];
struct NSLookupResult
{
char *Status;
char *AnswerType;
char *HostNameReturned;
char *IPAddresses;
char *DNSServerIP;
char *ResponseTime;
};
int browseServerInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseRelayForwardingInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseResultInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int add_client_server(char *refparam, struct dmctx *ctx, void *data, char **instance);
int add_relay_forwarding(char *refparam, struct dmctx *ctx, void *data, char **instance);
int delete_client_server(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
int delete_relay_forwarding(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
int get_dns_supported_record_types(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_client_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_client_status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_client_server_number_of_entries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_server_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_server_status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_server_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_server_dns_server(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_server_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_server_type(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_relay_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_relay_status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_relay_forward_number_of_entries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_forwarding_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_forwarding_status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_forwarding_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_forwarding_dns_server(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_forwarding_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_forwarding_type(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_nslookupdiagnostics_diagnostics_state(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_nslookupdiagnostics_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_nslookupdiagnostics_host_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_nslookupdiagnostics_d_n_s_server(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_nslookupdiagnostics_timeout(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_nslookupdiagnostics_number_of_repetitions(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_nslookupdiagnostics_success_count(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_nslookupdiagnostics_result_number_of_entries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_result_status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_result_answer_type(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_result_host_name_returned(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_result_i_p_addresses(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_result_d_n_s_server_i_p(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_result_response_time(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_client_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_server_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_server_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_server_dns_server(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_server_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_relay_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_forwarding_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_forwarding_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_forwarding_dns_server(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_forwarding_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_nslookupdiagnostics_diagnostics_state(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_nslookupdiagnostics_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_nslookupdiagnostics_host_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_nslookupdiagnostics_d_n_s_server(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_nslookupdiagnostics_timeout(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_nslookupdiagnostics_number_of_repetitions(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
#endif

File diff suppressed because it is too large Load diff

View file

@ -1,179 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2019 iopsys Software Solutions AB
* Author: AMIN Ben Ramdhane <amin.benramdhane@pivasoftware.com>
*/
#ifndef __DSL_H
#define __DSL_H
struct dsl_line_args
{
struct uci_section *line_sec;
char *id;
};
struct dsl_channel_args
{
struct uci_section *channel_sec;
char *id;
};
extern DMOBJ tDSLObj[];
extern DMLEAF tDSLParams[];
extern DMOBJ tDSLLineObj[];
extern DMLEAF tDSLLineParams[];
extern DMOBJ tDSLLineStatsObj[];
extern DMLEAF tDSLLineStatsParams[];
extern DMLEAF tDSLLineStatsTotalParams[];
extern DMLEAF tDSLLineStatsShowtimeParams[];
extern DMLEAF tDSLLineStatsLastShowtimeParams[];
extern DMLEAF tDSLLineStatsCurrentDayParams[];
extern DMLEAF tDSLLineStatsQuarterHourParams[];
extern DMOBJ tDSLChannelObj[];
extern DMLEAF tDSLChannelParams[];
extern DMOBJ tDSLChannelStatsObj[];
extern DMLEAF tDSLChannelStatsParams[];
extern DMLEAF tDSLChannelStatsTotalParams[];
extern DMLEAF tDSLChannelStatsShowtimeParams[];
extern DMLEAF tDSLChannelStatsLastShowtimeParams[];
extern DMLEAF tDSLChannelStatsCurrentDayParams[];
extern DMLEAF tDSLChannelStatsQuarterHourParams[];
int browseDSLLineInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseDSLChannelInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int get_dsl_line_linker(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker);
int get_dsl_channel_linker(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker);
int get_DSL_LineNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSL_ChannelNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLine_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DSLLine_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DSLLine_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLine_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DSLLine_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DSLLine_Name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLine_LowerLayers(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DSLLine_LowerLayers(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DSLLine_Upstream(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLine_FirmwareVersion(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLine_LinkStatus(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLine_StandardsSupported(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLine_XTSE(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLine_StandardUsed(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLine_XTSUsed(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLine_LineEncoding(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLine_AllowedProfiles(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLine_CurrentProfile(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLine_PowerManagementState(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLine_SuccessFailureCause(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLine_UPBOKLERPb(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLine_RXTHRSHds(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLine_ACTRAMODEds(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLine_ACTRAMODEus(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLine_SNRMROCus(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLine_LastStateTransmittedDownstream(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLine_LastStateTransmittedUpstream(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLine_US0MASK(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLine_TRELLISds(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLine_TRELLISus(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLine_ACTSNRMODEds(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLine_ACTSNRMODEus(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLine_LineNumber(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLine_UpstreamMaxBitRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLine_DownstreamMaxBitRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLine_UpstreamNoiseMargin(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLine_DownstreamNoiseMargin(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLine_SNRMpbus(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLine_SNRMpbds(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLine_UpstreamAttenuation(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLine_DownstreamAttenuation(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLine_UpstreamPower(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLine_DownstreamPower(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLine_XTURVendor(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLine_XTURCountry(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLine_XTURANSIStd(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLine_XTURANSIRev(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLine_XTUCVendor(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLine_XTUCCountry(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLine_XTUCANSIStd(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLine_XTUCANSIRev(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLineStats_TotalStart(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLineStats_ShowtimeStart(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLineStats_LastShowtimeStart(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLineStats_CurrentDayStart(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLineStats_QuarterHourStart(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLineStatsTotal_ErroredSecs(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLineStatsTotal_SeverelyErroredSecs(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLineStatsShowtime_ErroredSecs(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLineStatsShowtime_SeverelyErroredSecs(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLineStatsLastShowtime_ErroredSecs(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLineStatsLastShowtime_SeverelyErroredSecs(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLineStatsCurrentDay_ErroredSecs(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLineStatsCurrentDay_SeverelyErroredSecs(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLineStatsQuarterHour_ErroredSecs(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLLineStatsQuarterHour_SeverelyErroredSecs(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannel_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DSLChannel_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DSLChannel_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannel_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_DSLChannel_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_DSLChannel_Name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannel_LowerLayers(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannel_LinkEncapsulationSupported(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannel_LinkEncapsulationUsed(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannel_LPATH(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannel_INTLVDEPTH(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannel_INTLVBLOCK(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannel_ActualInterleavingDelay(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannel_ACTINP(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannel_INPREPORT(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannel_NFEC(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannel_RFEC(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannel_LSYMB(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannel_UpstreamCurrRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannel_DownstreamCurrRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannel_ACTNDR(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannel_ACTINPREIN(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannelStats_TotalStart(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannelStats_ShowtimeStart(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannelStats_LastShowtimeStart(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannelStats_CurrentDayStart(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannelStats_QuarterHourStart(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannelStatsTotal_XTURFECErrors(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannelStatsTotal_XTUCFECErrors(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannelStatsTotal_XTURHECErrors(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannelStatsTotal_XTUCHECErrors(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannelStatsTotal_XTURCRCErrors(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannelStatsTotal_XTUCCRCErrors(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannelStatsShowtime_XTURFECErrors(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannelStatsShowtime_XTUCFECErrors(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannelStatsShowtime_XTURHECErrors(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannelStatsShowtime_XTUCHECErrors(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannelStatsShowtime_XTURCRCErrors(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannelStatsShowtime_XTUCCRCErrors(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannelStatsLastShowtime_XTURFECErrors(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannelStatsLastShowtime_XTUCFECErrors(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannelStatsLastShowtime_XTURHECErrors(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannelStatsLastShowtime_XTUCHECErrors(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannelStatsLastShowtime_XTURCRCErrors(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannelStatsLastShowtime_XTUCCRCErrors(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannelStatsCurrentDay_XTURFECErrors(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannelStatsCurrentDay_XTUCFECErrors(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannelStatsCurrentDay_XTURHECErrors(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannelStatsCurrentDay_XTUCHECErrors(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannelStatsCurrentDay_XTURCRCErrors(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannelStatsCurrentDay_XTUCCRCErrors(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannelStatsQuarterHour_XTURFECErrors(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannelStatsQuarterHour_XTUCFECErrors(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannelStatsQuarterHour_XTURHECErrors(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannelStatsQuarterHour_XTUCHECErrors(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannelStatsQuarterHour_XTURCRCErrors(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_DSLChannelStatsQuarterHour_XTUCCRCErrors(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
#endif //__DSL_H

File diff suppressed because it is too large Load diff

View file

@ -1,139 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2019 iopsys Software Solutions AB
* Author: Anis Ellouze <anis.ellouze@pivasoftware.com>
* Author: Amin Ben Ramdhane <amin.benramdhane@pivasoftware.com>
*
*/
#ifndef __ETHERNET_H
#define __ETHERNET_H
struct eth_port_args
{
struct uci_section *eth_port_sec;
char *ifname;
};
extern DMOBJ tEthernetObj[];
extern DMLEAF tEthernetParams[];
extern DMOBJ tEthernetInterfaceObj[];
extern DMLEAF tEthernetInterfaceParams[];
extern DMLEAF tEthernetInterfaceStatsParams[];
extern DMOBJ tEthernetLinkObj[];
extern DMLEAF tEthernetLinkParams[];
extern DMLEAF tEthernetLinkStatsParams[];
extern DMOBJ tEthernetVLANTerminationObj[];
extern DMLEAF tEthernetVLANTerminationParams[];
extern DMLEAF tEthernetVLANTerminationStatsParams[];
int browseEthernetInterfaceInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseEthernetLinkInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseEthernetVLANTerminationInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int addObjEthernetLink(char *refparam, struct dmctx *ctx, void *data, char **instance);
int delObjEthernetLink(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
int addObjEthernetVLANTermination(char *refparam, struct dmctx *ctx, void *data, char **instance);
int delObjEthernetVLANTermination(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
int get_linker_interface(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker);
int get_linker_link(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker);
int get_linker_vlan_term(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker);
int get_Ethernet_InterfaceNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_Ethernet_LinkNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_Ethernet_VLANTerminationNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetInterface_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_EthernetInterface_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_EthernetInterface_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetInterface_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_EthernetInterface_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_EthernetInterface_Name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetInterface_LastChange(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetInterface_LowerLayers(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_EthernetInterface_LowerLayers(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_EthernetInterface_Upstream(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetInterface_MACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetInterface_MaxBitRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_EthernetInterface_MaxBitRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_EthernetInterface_CurrentBitRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetInterface_DuplexMode(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_EthernetInterface_DuplexMode(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_EthernetInterface_EEECapability(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetInterfaceStats_BytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetInterfaceStats_BytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetInterfaceStats_PacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetInterfaceStats_PacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetInterfaceStats_ErrorsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetInterfaceStats_ErrorsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetInterfaceStats_UnicastPacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetInterfaceStats_UnicastPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetInterfaceStats_DiscardPacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetInterfaceStats_DiscardPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetInterfaceStats_MulticastPacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetInterfaceStats_MulticastPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetInterfaceStats_BroadcastPacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetInterfaceStats_BroadcastPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetInterfaceStats_UnknownProtoPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetLink_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_EthernetLink_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_EthernetLink_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetLink_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_EthernetLink_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_EthernetLink_Name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetLink_LastChange(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetLink_LowerLayers(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_EthernetLink_LowerLayers(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_EthernetLink_MACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetLinkStats_BytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetLinkStats_BytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetLinkStats_PacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetLinkStats_PacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetLinkStats_ErrorsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetLinkStats_ErrorsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetLinkStats_UnicastPacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetLinkStats_UnicastPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetLinkStats_DiscardPacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetLinkStats_DiscardPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetLinkStats_MulticastPacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetLinkStats_MulticastPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetLinkStats_BroadcastPacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetLinkStats_BroadcastPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetLinkStats_UnknownProtoPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetVLANTermination_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_EthernetVLANTermination_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_EthernetVLANTermination_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetVLANTermination_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_EthernetVLANTermination_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_EthernetVLANTermination_Name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetVLANTermination_LastChange(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetVLANTermination_LowerLayers(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_EthernetVLANTermination_LowerLayers(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_EthernetVLANTermination_VLANID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_EthernetVLANTermination_VLANID(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_EthernetVLANTermination_TPID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_EthernetVLANTermination_TPID(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_EthernetVLANTerminationStats_BytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetVLANTerminationStats_BytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetVLANTerminationStats_PacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetVLANTerminationStats_PacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetVLANTerminationStats_ErrorsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetVLANTerminationStats_ErrorsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetVLANTerminationStats_UnicastPacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetVLANTerminationStats_UnicastPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetVLANTerminationStats_DiscardPacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetVLANTerminationStats_DiscardPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetVLANTerminationStats_MulticastPacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetVLANTerminationStats_MulticastPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetVLANTerminationStats_BroadcastPacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetVLANTerminationStats_BroadcastPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_EthernetVLANTerminationStats_UnknownProtoPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
#endif //__ETHERNET_H

File diff suppressed because it is too large Load diff

View file

@ -1,102 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2019 iopsys Software Solutions AB
*
* Author: Omar Kallel <omar.kallel@pivasoftware.com>
*/
#ifndef _FIREWALL_H
#define _FIREWALL_H
#include "dmcwmp.h"
extern DMOBJ tFirewallObj[];
extern DMLEAF tFirewallParams[];
extern DMLEAF tLevelParams[];
extern DMLEAF tChainParams[];
extern DMOBJ tChainObj[];
extern DMLEAF tRuleParams[];
extern DMOBJ tRuleObj[];
extern DMLEAF tTimeSpanParams[];
int browseLevelInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseChainInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseRuleInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int add_firewall_rule(char *refparam, struct dmctx *ctx, void *data, char **instance);
int delete_firewall_rule(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
int get_firewall_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_firewall_config(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_firewall_advanced_level(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_firewall_level_number_of_entries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_firewall_chain_number_of_entries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_level_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_level_description(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_level_chain(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_level_port_mapping_enabled(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_level_default_log_policy(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_chain_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_chain_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_chain_creator(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_chain_rule_number_of_entries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_rule_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_rule_status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_rule_order(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_rule_description(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_rule_target(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_rule_target_chain(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_rule_source_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_rule_dest_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_rule_i_p_version(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_rule_dest_ip(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_rule_dest_mask(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_rule_source_ip(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_rule_source_mask(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_rule_protocol(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_rule_dest_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_rule_dest_port_range_max(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_rule_source_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_rule_source_port_range_max(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_rule_icmp_type(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_rule_source_mac(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_time_span_supported_days(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_time_span_days(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_time_span_start_time(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_time_span_stop_time(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_firewall_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_firewall_config(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_firewall_advanced_level(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_level_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_level_description(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_level_port_mapping_enabled(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_level_default_log_policy(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_chain_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_chain_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_rule_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_rule_order(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_rule_description(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_rule_target(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_rule_target_chain(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_rule_source_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_rule_dest_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_rule_i_p_version(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_rule_dest_ip(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_rule_dest_mask(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_rule_source_ip(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_rule_source_mask(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_rule_protocol(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_rule_dest_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_rule_dest_port_range_max(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_rule_source_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_rule_source_port_range_max(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_rule_icmp_type(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_rule_source_mac(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_time_span_supported_days(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_time_span_days(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_time_span_start_time(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_time_span_stop_time(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
#endif

View file

@ -1,310 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2016 Inteno Broadband Technology AB
* Author: Anis Ellouze <anis.ellouze@pivasoftware.com>
*
*/
#include <uci.h>
#include <stdio.h>
#include <ctype.h>
#include "dmuci.h"
#include "dmubus.h"
#include "dmcwmp.h"
#include "dmcommon.h"
#include "hosts.h"
#include "dmjson.h"
#include "dmentry.h"
/*** Hosts. ***/
DMOBJ thostsObj[] = {
/* OBJ, permission, addobj, delobj, browseinstobj, finform, notification, nextobj, leaf*/
{"Host", &DMREAD, NULL, NULL, NULL, browsehostInst, NULL, NULL, NULL, thostParam, NULL},
{0}
};
DMLEAF thostsParam[] = {
{"HostNumberOfEntries", &DMREAD, DMT_UNINT, get_host_nbr_entries, NULL, NULL, NULL},
{0}
};
/*** Hosts.Host ***/
DMLEAF thostParam[] = {
{"AssociatedDevice", &DMREAD, DMT_STRING, get_host_associateddevice, NULL, NULL, NULL},
{"Layer3Interface", &DMREAD, DMT_STRING, get_host_layer3interface, NULL, NULL, NULL},
{"IPAddress", &DMREAD, DMT_STRING, get_host_ipaddress, NULL, NULL, NULL},
{"HostName", &DMREAD, DMT_STRING, get_host_hostname, NULL, NULL, NULL},
{"Active", &DMREAD, DMT_BOOL, get_host_active, NULL, NULL, NULL},
{"PhysAddress", &DMREAD, DMT_STRING, get_host_phy_address, NULL, NULL, NULL},
{CUSTOM_PREFIX"LinkType", &DMREAD, DMT_STRING, get_host_interfacetype, NULL, NULL, NULL},
{"AddressSource", &DMREAD, DMT_STRING, get_host_address_source, NULL, NULL, NULL},
{"LeaseTimeRemaining", &DMREAD, DMT_INT, get_host_leasetime_remaining, NULL, NULL, NULL},
{"DHCPClient", &DMREAD, DMT_STRING, get_host_dhcp_client, NULL, NULL, NULL},
{CUSTOM_PREFIX"InterfaceType", &DMREAD, DMT_STRING, get_host_interface_type, NULL, NULL, NULL},
{CUSTOM_PREFIX"ifname", &DMREAD, DMT_STRING, get_host_interfacename, NULL, NULL, NULL},
{0}
};
/*************************************************************
* INIT
/*************************************************************/
inline int init_host_args(struct host_args *args, json_object *clients, char *key)
{
args->client = clients;
args->key = key;
return 0;
}
/*************************************************************
* GET & SET PARAM
/*************************************************************/
int get_host_associateddevice(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *ss;
char *macaddr_linker = dmjson_get_value(((struct host_args *)data)->client, 1, "macaddr");
char *accesspointInstance = NULL, *wifiAssociativeDeviecPath;
uci_path_foreach_sections(icwmpd, "dmmap_wireless", "wifi-iface", ss) {
dmuci_get_value_by_section_string(ss, "accesspointinstance", &accesspointInstance);
if(accesspointInstance[0] != '\0')
dmasprintf(&wifiAssociativeDeviecPath, "Device.WiFi.AccessPoint.%s.AssociatedDevice.", accesspointInstance);
accesspointInstance = NULL;
adm_entry_get_linker_param(ctx, wifiAssociativeDeviecPath, macaddr_linker, value);
if(*value != NULL)
break;
}
if (*value == NULL)
*value = "";
return 0;
}
int get_host_layer3interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char *ip_linker=dmjson_get_value(((struct host_args *)data)->client, 1, "network");
adm_entry_get_linker_param(ctx, "Device.IP.Interface.", ip_linker, value);
if (*value == NULL)
*value = "";
return 0;
}
int 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 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 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");
return 0;
}
int get_host_hostname(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = dmjson_get_value(((struct host_args *)data)->client, 1, "hostname");
return 0;
}
int get_host_active(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = dmjson_get_value(((struct host_args *)data)->client, 1, "connected");
return 0;
}
int get_host_phy_address(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = dmjson_get_value(((struct host_args *)data)->client, 1, "macaddr");
return 0;
}
int get_host_address_source(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char *dhcp;
dhcp = dmjson_get_value(((struct host_args *)data)->client, 1, "dhcp");
if (strcasecmp(dhcp, "true") == 0)
*value = "DHCP";
else
*value = "Static";
return 0;
}
int get_host_leasetime_remaining(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char buf[80], *dhcp;
FILE *fp;
char line[MAX_DHCP_LEASES];
struct tm ts;
char *leasetime, *mac_f, *mac, *line1;
char delimiter[] = " \t";
dhcp = dmjson_get_value(((struct host_args *)data)->client, 1, "dhcp");
if (strcmp(dhcp, "false") == 0) {
*value = "0";
}
else {
mac = dmjson_get_value(((struct host_args *)data)->client, 1, "macaddr");
fp = fopen(DHCP_LEASES_FILE, "r");
if ( fp != NULL)
{
while (fgets(line, MAX_DHCP_LEASES, fp) != NULL )
{
if (line[0] == '\n')
continue;
line1 = dmstrdup(line);
leasetime = cut_fx(line, delimiter, 1);
mac_f = cut_fx(line1, delimiter, 2);
if (strcasecmp(mac, mac_f) == 0) {
int rem_lease = atoi(leasetime) - time(NULL);
if (rem_lease < 0)
*value = "-1";
else
dmasprintf(value, "%d", rem_lease); // MEM WILL BE FREED IN DMMEMCLEAN
fclose(fp) ;
return 0;
}
}
fclose(fp);
*value = "0";
}
}
return 0;
}
int get_host_dhcp_client(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char *linker;
dmasprintf(&linker, "%s", ((struct host_args *)data)->key);
adm_entry_get_linker_param(ctx, dm_print_path("%s%cDHCPv4%c", dmroot, dm_delim, dm_delim), linker, value); // MEM WILL BE FREED IN DMMEMCLEAN
if (*value == NULL) {
*value = "";
}
dmfree(linker);
return 0;
}
static char *get_interface_type(char *mac, char *ndev)
{
json_object *res;
int wlctl_num;
struct uci_section *s, *d;
char *network, *device, *value, *wunit;
char buf[8], *p;
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) {
sprintf(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) {
value = dmjson_get_value(val, 1, "macaddr");
if (strcasecmp(value, mac) == 0)
return "802.11";
}
}
wlctl_num++;
}
}
}
return "Ethernet";
}
int 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;
}
int get_host_nbr_entries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
int entries = 0;
json_object *res;
dmubus_call("router.network", "clients", UBUS_ARGS{}, 0, &res);
DM_ASSERT(res, *value = "0");
json_object_object_foreach(res, key, client_obj) {
entries++;
}
dmasprintf(value, "%d", entries); // MEM WILL BE FREED IN DMMEMCLEAN
return 0;
}
/*************************************************************
* ENTRY METHOD
/*************************************************************/
int browsehostInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
json_object *res, *client_obj;
char *idx, *idx_last = NULL, *connected;
int id = 0;
struct host_args curr_host_args = {0};
dmubus_call("router.network", "clients", UBUS_ARGS{}, 0, &res);
if (res) {
json_object_object_foreach(res, key, client_obj) {
connected = dmjson_get_value(client_obj, 1, "connected");
if(strcmp(connected, "false") == 0)
continue;
init_host_args(&curr_host_args, client_obj, key);
idx = handle_update_instance(2, dmctx, &idx_last, update_instance_without_section, 1, ++id);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_host_args, idx) == DM_STOP)
break;
}
}
return 0;
}

View file

@ -1,40 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2016 Inteno Broadband Technology AB
* Author: Anis Ellouze <anis.ellouze@pivasoftware.com>
*
*/
#ifndef __HOSTS_H
#define __HOSTS_H
struct host_args
{
json_object *client;
char *key;
};
extern DMLEAF thostsParam[];
extern DMLEAF thostParam[];
extern DMOBJ thostsObj[];
int browsehostInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int get_host_nbr_entries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_host_associateddevice(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_host_layer3interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_host_interface_type(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_host_interfacename(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_host_ipaddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_host_hostname(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_host_active(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_host_phy_address(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_host_interfacetype(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_host_address_source(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_host_leasetime_remaining(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_host_dhcp_client(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
#endif

View file

@ -1,534 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2019 iopsys Software Solutions AB
* Author: Amin Ben Ramdhane <amin.benramdhane@pivasoftware.com>
*/
#include "dmcwmp.h"
#include "dmcommon.h"
#include "dmubus.h"
#include "dmjson.h"
#include "dmentry.h"
#include "interfacestack.h"
/* *** Device.InterfaceStack.{i}. *** */
DMLEAF tInterfaceStackParams[] = {
/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification*/
{"Alias", &DMWRITE, DMT_STRING, get_InterfaceStack_Alias, set_InterfaceStack_Alias, NULL, NULL},
{"HigherLayer", &DMREAD, DMT_STRING, get_InterfaceStack_HigherLayer, NULL, NULL, NULL},
{"LowerLayer", &DMREAD, DMT_STRING, get_InterfaceStack_LowerLayer, NULL, NULL, NULL},
{"HigherAlias", &DMREAD, DMT_STRING, get_InterfaceStack_HigherAlias, NULL, NULL, NULL},
{"LowerAlias", &DMREAD, DMT_STRING, get_InterfaceStack_LowerAlias, NULL, NULL, NULL},
{0}
};
/*************************************************************
* ENTRY METHOD
/*************************************************************/
static char *get_instance_by_section(struct dmctx *dmctx, int mode, char *dmmap_config, char *section, struct uci_section *s, char *instance_option, char *alias_option)
{
struct uci_section *dmmap_section;
char *instance;
get_dmmap_section_of_config_section(dmmap_config, section, section_name(s), &dmmap_section);
if(dmmap_section == NULL) {
return "";
}
if (mode == INSTANCE_MODE_NUMBER) {
dmuci_get_value_by_section_string(dmmap_section, instance_option, &instance);
}
else {
dmuci_get_value_by_section_string(dmmap_section, alias_option, &instance);
}
return instance;
}
static char *get_alias_by_section(char *dmmap_config, char *section, struct uci_section *s, char *alias_option)
{
struct uci_section *dmmap_section;
char *alias;
get_dmmap_section_of_config_section(dmmap_config, section, section_name(s), &dmmap_section);
if(dmmap_section == NULL) {
return "";
}
dmuci_get_value_by_section_string(dmmap_section, alias_option, &alias);
return alias;
}
static struct uci_section *create_dmmap_interface_stack_section(char *curr_inst)
{
struct uci_section *s = NULL;
char *name;
check_create_dmmap_package("dmmap_interface_stack");
uci_path_foreach_option_eq(icwmpd, "dmmap_interface_stack", "interface_stack", "interface_stack_instance", curr_inst, s) {
return s;
}
if (!s) {
DMUCI_ADD_SECTION(icwmpd, "dmmap_interface_stack", "interface_stack", &s, &name);
DMUCI_SET_VALUE_BY_SECTION(icwmpd, s, "interface_stack_instance", curr_inst);
}
return s;
}
int browseInterfaceStackInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
struct interfacestack_data ifdata = {0};
struct uci_section *s = NULL, *sd = NULL, *port, *port_s, *ss, *dmmap_s = NULL;
char *proto, *type, *pch, *spch, *layer_inst, *v, *vb, *higheralias, *loweralias, *ifname, *br_inst, *mg, *value, *p, *device, *name;
char *interface_stack_int = NULL, *interface_stack_int_last = NULL, *wanifname, *wanlinker, *mac, *vlan_method, *sectionname, *package, *section;
char buf_lowerlayer[128] = "";
char buf_higherlayer[128] = "";
char buf_higheralias[64] = "";
char buf_loweralias[64] = "";
char buf_instance[32] = "";
char linker[64] = "";
char buf_tmp[64] = "";
int instance = 0, found = 0;
json_object *jobj;
/* Higher layers are Device.IP.Interface.{i}. */
uci_foreach_sections("network", "interface", s) {
dmuci_get_value_by_section_string(s, "type", &type);
if (strcmp(type, "alias") == 0 || strcmp(section_name(s), "loopback")==0)
continue;
layer_inst = get_instance_by_section(dmctx, dmctx->instance_mode, "dmmap_network", "interface", s, "ip_int_instance", "ip_int_alias");
if (*layer_inst == '\0')
continue;
sprintf(buf_higherlayer, "Device.IP.Interface.%s.", layer_inst);
higheralias = get_alias_by_section("dmmap_network", "interface", s, "ip_int_alias");
sprintf(buf_higheralias, "%s", higheralias);
dmuci_get_value_by_section_string(s, "proto", &proto);
if (strstr(proto, "ppp")) {
layer_inst = get_instance_by_section(dmctx, dmctx->instance_mode, "dmmap_network", "interface", s, "ppp_int_instance", "ppp_int_alias");
if (*layer_inst == '\0')
continue;
sprintf(buf_lowerlayer, "Device.PPP.Interface.%s.", layer_inst);
loweralias = get_alias_by_section("dmmap_network", "interface", s, "ppp_int_alias");
sprintf(buf_loweralias, "%s", loweralias);
}
else {
device = get_device(section_name(s));
if (device[0] != '\0') {
adm_entry_get_linker_param(dmctx, dm_print_path("%s%cEthernet%cVLANTermination%c", dmroot, dm_delim, dm_delim, dm_delim), device, &v);
dmuci_get_option_value_string("cwmp", "cpe", "vlan_method", &vlan_method);
if(strcmp(vlan_method, "2") == 0)
loweralias = get_alias_by_section("dmmap_network", "device", s, "all_vlan_term_alias");
else
loweralias = get_alias_by_section("dmmap_network", "device", s, "vlan_term_alias");
if (v != NULL)
found = 1;
}
mac = get_macaddr(section_name(s));
if (mac[0] != '\0' && found == 0) {
adm_entry_get_linker_param(dmctx, dm_print_path("%s%cEthernet%cLink%c", dmroot, dm_delim, dm_delim, dm_delim), mac, &v);
loweralias = get_alias_by_section("dmmap", "link", s, "link_alias");
if (v == NULL)
v = "";
}
sprintf(buf_lowerlayer, "%s", v);
sprintf(buf_loweralias, "%s", loweralias);
}
ifdata.higherlayer = buf_higherlayer;
ifdata.lowerlayer = buf_lowerlayer;
ifdata.higheralias = buf_higheralias;
ifdata.loweralias = buf_loweralias;
sprintf(buf_instance, "%d", ++instance);
dmmap_s = create_dmmap_interface_stack_section(buf_instance);
interface_stack_int = handle_update_instance(1, dmctx, &interface_stack_int_last, update_instance_alias, 3, dmmap_s, "interface_stack_instance", "interface_stack_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&ifdata, interface_stack_int) == DM_STOP)
goto end;
}
/* Higher layers are Device.PPP.Interface.{i}. */
uci_foreach_sections("network", "interface", s) {
dmuci_get_value_by_section_string(s, "proto", &proto);
if (!strstr(proto, "ppp"))
continue;
layer_inst = get_instance_by_section(dmctx, dmctx->instance_mode, "dmmap_network", "interface", s, "ppp_int_instance", "ppp_int_alias");
if (*layer_inst == '\0')
continue;
sprintf(buf_higherlayer, "Device.PPP.Interface.%s.", layer_inst);
higheralias = get_alias_by_section("dmmap_network", "interface", s, "ppp_int_alias");
sprintf(buf_higheralias, "%s", higheralias);
found = 0;
device = get_device(section_name(s));
if (device[0] != '\0') {
adm_entry_get_linker_param(dmctx, dm_print_path("%s%cEthernet%cVLANTermination%c", dmroot, dm_delim, dm_delim, dm_delim), device, &v);
dmuci_get_option_value_string("cwmp", "cpe", "vlan_method", &vlan_method);
if(strcmp(vlan_method, "2") == 0)
loweralias = get_alias_by_section("dmmap_network", "device", s, "all_vlan_term_alias");
else
loweralias = get_alias_by_section("dmmap_network", "device", s, "vlan_term_alias");
if (v != NULL)
found = 1;
}
mac = get_macaddr(section_name(s));
if (mac[0] != '\0' && found == 0) {
adm_entry_get_linker_param(dmctx, dm_print_path("%s%cEthernet%cLink%c", dmroot, dm_delim, dm_delim, dm_delim), mac, &v);
loweralias = get_alias_by_section("dmmap", "link", s, "link_alias");
if (v == NULL)
v = "";
}
sprintf(buf_lowerlayer, "%s", v);
sprintf(buf_loweralias, "%s", loweralias);
ifdata.higherlayer = buf_higherlayer;
ifdata.lowerlayer = buf_lowerlayer;
ifdata.higheralias = buf_higheralias;
ifdata.loweralias = buf_loweralias;
sprintf(buf_instance, "%d", ++instance);
dmmap_s = create_dmmap_interface_stack_section(buf_instance);
interface_stack_int = handle_update_instance(1, dmctx, &interface_stack_int_last, update_instance_alias, 3, dmmap_s, "interface_stack_instance", "interface_stack_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&ifdata, interface_stack_int) == DM_STOP)
goto end;
}
/* Higher layers are Device.Ethernet.VLANTermination.{i}. */
uci_foreach_sections("network", "device", s) {
dmuci_get_value_by_section_string(s, "type", &type);
dmuci_get_option_value_string("cwmp", "cpe", "vlan_method", &vlan_method);
if ((strcmp(vlan_method, "2") != 0 && strcmp(vlan_method, "1") != 0) || (strcmp(vlan_method, "1") == 0 && strcmp(type, "untagged") == 0) )
continue;
if(strcmp(vlan_method, "2") == 0)
layer_inst = get_instance_by_section(dmctx, dmctx->instance_mode, "dmmap_network", "device", s, "all_vlan_term_instance", "all_vlan_term_alias");
else
layer_inst = get_instance_by_section(dmctx, dmctx->instance_mode, "dmmap_network", "device", s, "only_tagged_vlan_term_instance", "vlan_term_alias");
if (*layer_inst == '\0')
continue;
sprintf(buf_higherlayer, "Device.Ethernet.VLANTermination.%s.", layer_inst);
if(strcmp(vlan_method, "2") == 0)
higheralias = get_alias_by_section("dmmap_network", "device", s, "all_vlan_term_alias");
else
higheralias = get_alias_by_section("dmmap_network", "device", s, "vlan_term_alias");
sprintf(buf_higheralias, "%s", higheralias);
dmuci_get_value_by_section_string(s, "name", &value);
uci_foreach_sections("network", "interface", ss) {
dmuci_get_value_by_section_string(ss, "ifname", &ifname);
for (pch = strtok_r(ifname, " ", &spch); pch != NULL; pch = strtok_r(NULL, " ", &spch)) {
if(strcmp(pch, value) == 0) {
mac = get_macaddr(section_name(ss));
if (mac[0] != '\0') {
adm_entry_get_linker_param(dmctx, dm_print_path("%s%cEthernet%cLink%c", dmroot, dm_delim, dm_delim, dm_delim), mac, &v);
loweralias = get_alias_by_section("dmmap", "link", ss, "link_alias");
if (v == NULL)
v = "";
break;
}
}
}
}
sprintf(buf_lowerlayer, "%s", v);
sprintf(buf_loweralias, "%s", loweralias);
ifdata.higherlayer = buf_higherlayer;
ifdata.lowerlayer = buf_lowerlayer;
ifdata.higheralias = buf_higheralias;
ifdata.loweralias = buf_loweralias;
sprintf(buf_instance, "%d", ++instance);
dmmap_s = create_dmmap_interface_stack_section(buf_instance);
interface_stack_int = handle_update_instance(1, dmctx, &interface_stack_int_last, update_instance_alias, 3, dmmap_s, "interface_stack_instance", "interface_stack_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&ifdata, interface_stack_int) == DM_STOP)
goto end;
}
/* Higher layers are Device.Ethernet.Link.{i}. */
uci_foreach_sections("network", "interface", s) {
dmuci_get_value_by_section_string(s, "type", &type);
if (strcmp(type, "alias") == 0 || strcmp(section_name(s), "loopback")==0)
continue;
dmuci_get_value_by_section_string(s, "ifname", &ifname);
if (*ifname == '\0' || *ifname == '@')
continue;
layer_inst = get_instance_by_section(dmctx, dmctx->instance_mode, "dmmap", "link", s, "link_instance", "link_alias");
if (*layer_inst == '\0')
continue;
sprintf(buf_higherlayer, "Device.Ethernet.Link.%s.", layer_inst);
higheralias = get_alias_by_section("dmmap", "link", s, "link_alias");
sprintf(buf_higheralias, "%s", higheralias);
if (strcmp(type, "bridge") == 0) {
br_inst = get_alias_by_section("dmmap_network", "interface", s, "bridge_instance");
uci_path_foreach_option_eq(icwmpd, "dmmap_bridge_port", "bridge_port", "bridge_key", br_inst, port) {
dmuci_get_value_by_section_string(port, "mg_port", &mg);
if (strcmp(mg, "true") == 0) {
sprintf(linker, "%s+", section_name(port));
adm_entry_get_linker_param(dmctx, dm_print_path("%s%cBridging%cBridge%c", dmroot, dm_delim, dm_delim, dm_delim), linker, &v);
dmuci_get_value_by_section_string(port, "bridge_port_alias", &loweralias);
break;
}
}
} else {
uci_foreach_option_eq("ports", "ethport", "name", "WAN", port_s) {
dmuci_get_value_by_section_string(port_s, "ifname", &wanifname);
if(strstr(ifname, wanifname)) {
dmasprintf(&wanlinker, "%s.1", wanifname);
adm_entry_get_linker_param(dmctx, dm_print_path("%s%cEthernet%cInterface%c", dmroot, dm_delim, dm_delim, dm_delim), wanlinker, &v);
dmfree(wanlinker);
loweralias = get_alias_by_section("dmmap_ports", "ethport", port_s, "eth_port_alias");
break;
}
}
}
if (v == NULL)
v = "";
sprintf(buf_loweralias, "%s", loweralias);
ifdata.higherlayer = buf_higherlayer;
ifdata.lowerlayer = v;
ifdata.higheralias = buf_higheralias;
ifdata.loweralias = buf_loweralias;
sprintf(buf_instance, "%d", ++instance);
dmmap_s = create_dmmap_interface_stack_section(buf_instance);
interface_stack_int = handle_update_instance(1, dmctx, &interface_stack_int_last, update_instance_alias, 3, dmmap_s, "interface_stack_instance", "interface_stack_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&ifdata, interface_stack_int) == DM_STOP)
goto end;
}
/* Higher layers are Device.Bridging.Bridge.{i}.Port.{i}.*/
uci_foreach_sections("network", "interface", s) {
dmuci_get_value_by_section_string(s, "type", &type);
if (strcmp(type, "bridge") != 0)
continue;
br_inst = get_instance_by_section(dmctx, dmctx->instance_mode, "dmmap_network", "interface", s, "bridge_instance", "bridge_alias");
if (*br_inst == '\0')
continue;
uci_path_foreach_option_eq(icwmpd, "dmmap_bridge_port", "bridge_port", "bridge_key", br_inst, port) {
dmuci_get_value_by_section_string(port, "mg_port", &mg);
if (strcmp(mg, "true") == 0) {
sprintf(linker, "%s+", section_name(port));
adm_entry_get_linker_param(dmctx, dm_print_path("%s%cBridging%cBridge%c", dmroot, dm_delim, dm_delim, dm_delim), linker, &pch);
dmuci_get_value_by_section_string(port, "bridge_port_alias", &higheralias);
sprintf(buf_tmp, "%s", higheralias);
if (pch == NULL)
pch = "";
break;
}
}
uci_path_foreach_option_eq(icwmpd, "dmmap_bridge_port", "bridge_port", "bridge_key", br_inst, sd) {
dmuci_get_value_by_section_string(sd, "mg_port", &mg);
if (strcmp(mg, "true") == 0)
continue;
dmuci_get_value_by_section_string(sd, "section_name", &sectionname);
dmuci_get_value_by_section_string(sd, "package", &package);
dmuci_get_value_by_section_string(sd, "section", &section);
uci_foreach_sections(package, section, port_s) {
if(strcmp(section_name(port_s), sectionname) == 0) {
dmuci_get_value_by_section_string(port_s, "ifname", &ifname);
dmuci_get_value_by_section_string(port_s, "name", &name);
break;
}
}
if(strcmp(package, "network") == 0 && strcmp(section, "device") == 0)
sprintf(linker, "%s+%s", sectionname, name);
else
sprintf(linker, "%s+%s", sectionname, ifname);
adm_entry_get_linker_param(dmctx, dm_print_path("%s%cBridging%cBridge%c", dmroot, dm_delim, dm_delim, dm_delim), linker, &vb);
if (vb == NULL)
vb = "";
dmuci_get_value_by_section_string(sd, "bridge_port_alias", &loweralias);
sprintf(buf_loweralias, "%s", loweralias);
ifdata.higherlayer = pch;
ifdata.lowerlayer = vb;
ifdata.higheralias = buf_tmp;
ifdata.loweralias = buf_loweralias;
sprintf(buf_instance, "%d", ++instance);
dmmap_s = create_dmmap_interface_stack_section(buf_instance);
interface_stack_int = handle_update_instance(1, dmctx, &interface_stack_int_last, update_instance_alias, 3, dmmap_s, "interface_stack_instance", "interface_stack_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&ifdata, interface_stack_int) == DM_STOP)
goto end;
sprintf(buf_higheralias, "%s", loweralias);
if(strcmp(package, "ports") == 0) {
adm_entry_get_linker_param(dmctx, dm_print_path("%s%cEthernet%cInterface%c", dmroot, dm_delim, dm_delim, dm_delim), ifname, &v);
loweralias = get_alias_by_section("dmmap_ports", "ethport", port_s, "eth_port_alias");
} else if(strcmp(package, "wireless") == 0) {
adm_entry_get_linker_param(dmctx,dm_print_path("%s%cWiFi%cSSID%c", dmroot, dm_delim, dm_delim, dm_delim), ifname, &v);
loweralias = get_alias_by_section("dmmap_wireless", "wifi-iface", port_s, "ssidalias");
} else if(strcmp(package, "network") == 0) {
if(strstr(ifname, "atm")) {
adm_entry_get_linker_param(dmctx,dm_print_path("%s%cATM%cLink%c", dmroot, dm_delim, dm_delim, dm_delim), ifname, &v);
uci_foreach_sections("dsl", "atm-device", ss) {
if(strcmp(section_name(ss), ifname) == 0) {
loweralias = get_alias_by_section("dmmap_dsl", "atm-device", ss, "atmlinkalias");
break;
}
}
} else if(strstr(ifname, "ptm")) {
adm_entry_get_linker_param(dmctx,dm_print_path("%s%cPTM%cLink%c", dmroot, dm_delim, dm_delim, dm_delim), ifname, &v);
uci_foreach_sections("dsl", "ptm-device", ss) {
if(strcmp(section_name(ss), ifname) == 0) {
loweralias = get_alias_by_section("dmmap_dsl", "ptm-device", ss, "ptmlinkalias");
break;
}
}
} else {
sprintf(linker, "%s.1", ifname);
adm_entry_get_linker_param(dmctx,dm_print_path("%s%cEthernet%cInterface%c", dmroot, dm_delim, dm_delim, dm_delim), linker, &v);
loweralias = get_alias_by_section("dmmap_ports", "ethport", port_s, "eth_port_alias");
}
}
sprintf(buf_loweralias, "%s", loweralias);
if (v == NULL)
v = "";
ifdata.higherlayer = vb;
ifdata.lowerlayer = v;
ifdata.higheralias = buf_higheralias;
ifdata.loweralias = buf_loweralias;
sprintf(buf_instance, "%d", ++instance);
dmmap_s = create_dmmap_interface_stack_section(buf_instance);
interface_stack_int = handle_update_instance(1, dmctx, &interface_stack_int_last, update_instance_alias, 3, dmmap_s, "interface_stack_instance", "interface_stack_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&ifdata, interface_stack_int) == DM_STOP)
goto end;
if(strcmp(package, "wireless") == 0) {
sprintf(buf_higheralias, "%s", loweralias);
uci_foreach_option_eq("wireless", "wifi-iface", "ifname", ifname, ss) {
dmuci_get_value_by_section_string(ss, "device", &device);
}
if (device[0] != '\0') {
adm_entry_get_linker_param(dmctx, dm_print_path("%s%cWiFi%cRadio%c", dmroot, dm_delim, dm_delim, dm_delim), device, &vb);
uci_foreach_sections("wireless", "wifi-device", ss) {
if(strcmp(section_name(ss), device) == 0) {
loweralias = get_alias_by_section("dmmap_wireless", "wifi-device", ss, "radioalias");
break;
}
}
}
if (vb == NULL)
vb = "";
sprintf(buf_loweralias, "%s", loweralias);
ifdata.higherlayer = v;
ifdata.lowerlayer = vb;
ifdata.higheralias = buf_higheralias;
ifdata.loweralias = buf_loweralias;
sprintf(buf_instance, "%d", ++instance);
dmmap_s = create_dmmap_interface_stack_section(buf_instance);
interface_stack_int = handle_update_instance(1, dmctx, &interface_stack_int_last, update_instance_alias, 3, dmmap_s, "interface_stack_instance", "interface_stack_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&ifdata, interface_stack_int) == DM_STOP)
goto end;
}
if(strcmp(package, "network") == 0) {
if(strstr(ifname, "atm") || strstr(ifname, "ptm")) {
sprintf(buf_higheralias, "%s", loweralias);
char *link_channel = "channel_0";
adm_entry_get_linker_param(dmctx, dm_print_path("%s%cDSL%cChannel%c", dmroot, dm_delim, dm_delim, dm_delim), link_channel, &vb);
if (vb == NULL)
vb = "";
uci_path_foreach_sections(icwmpd, "dmmap", "dsl_channel", ss) {
dmuci_get_value_by_section_string(ss, "dsl_channel_alias", &loweralias);
}
sprintf(buf_loweralias, "%s", loweralias);
ifdata.higherlayer = v;
ifdata.lowerlayer = vb;
ifdata.higheralias = buf_higheralias;
ifdata.loweralias = buf_loweralias;
sprintf(buf_instance, "%d", ++instance);
dmmap_s = create_dmmap_interface_stack_section(buf_instance);
interface_stack_int = handle_update_instance(1, dmctx, &interface_stack_int_last, update_instance_alias, 3, dmmap_s, "interface_stack_instance", "interface_stack_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&ifdata, interface_stack_int) == DM_STOP)
goto end;
sprintf(buf_higheralias, "%s", loweralias);
char *link_line = "line_0";
adm_entry_get_linker_param(dmctx, dm_print_path("%s%cDSL%cLine%c", dmroot, dm_delim, dm_delim, dm_delim), link_line, &value);
if (value == NULL)
value = "";
uci_path_foreach_sections(icwmpd, "dmmap", "dsl_line", ss) {
dmuci_get_value_by_section_string(ss, "dsl_line_alias", &loweralias);
}
sprintf(buf_loweralias, "%s", loweralias);
ifdata.higherlayer = vb;
ifdata.lowerlayer = value;
ifdata.higheralias = buf_higheralias;
ifdata.loweralias = buf_loweralias;
sprintf(buf_instance, "%d", ++instance);
dmmap_s = create_dmmap_interface_stack_section(buf_instance);
interface_stack_int = handle_update_instance(1, dmctx, &interface_stack_int_last, update_instance_alias, 3, dmmap_s, "interface_stack_instance", "interface_stack_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&ifdata, interface_stack_int) == DM_STOP)
goto end;
}
}
}
}
end:
return 0;
}
/*************************************************************
* GET & SET PARAM
/*************************************************************/
int get_Device_InterfaceStackNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *s = NULL;
int cnt = 0;
uci_path_foreach_sections(icwmpd, "dmmap_interface_stack", "interface_stack", s)
{
cnt++;
}
dmasprintf(value, "%d", cnt);
return 0;
}
int get_InterfaceStack_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *s = NULL;
uci_path_foreach_option_eq(icwmpd, "dmmap_interface_stack", "interface_stack", "interface_stack_instance", instance, s) {
dmuci_get_value_by_section_string(s, "interface_stack_alias", value);
}
return 0;
}
int set_InterfaceStack_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct uci_section *s = NULL;
switch (action) {
case VALUECHECK:
break;
case VALUESET:
uci_path_foreach_option_eq(icwmpd, "dmmap_interface_stack", "interface_stack", "interface_stack_instance", instance, s) {
dmuci_set_value_by_section(s, "interface_stack_alias", value);
}
break;
}
return 0;
}
int get_InterfaceStack_HigherLayer(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct interfacestack_data *ifdata = (struct interfacestack_data *) data;
*value = dmstrdup(ifdata->higherlayer);
return 0;
}
int get_InterfaceStack_LowerLayer(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct interfacestack_data *ifdata = (struct interfacestack_data *) data;
*value = dmstrdup(ifdata->lowerlayer);
return 0;
}
int get_InterfaceStack_HigherAlias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct interfacestack_data *ifdata = (struct interfacestack_data *) data;
*value = dmstrdup(ifdata->higheralias);
return 0;
}
int get_InterfaceStack_LowerAlias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct interfacestack_data *ifdata = (struct interfacestack_data *) data;
*value = dmstrdup(ifdata->loweralias);
return 0;
}

View file

@ -1,34 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2019 iopsys Software Solutions AB
* Author: Amin Ben Ramdhane <amin.benramdhane@pivasoftware.com>
*/
#ifndef __INTERFACESTACK_H
#define __INTERFACESTACK_H
extern DMLEAF tInterfaceStackParams[];
struct interfacestack_data {
char *lowerlayer;
char *higherlayer;
char *loweralias;
char *higheralias;
};
int browseInterfaceStackInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int get_Device_InterfaceStackNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_InterfaceStack_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_InterfaceStack_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_InterfaceStack_HigherLayer(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_InterfaceStack_LowerLayer(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_InterfaceStack_HigherAlias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_InterfaceStack_LowerAlias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
#endif //__INTERFACESTACK_H

File diff suppressed because it is too large Load diff

View file

@ -1,404 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2019 iopsys Software Solutions AB
* Author: Anis Ellouze <anis.ellouze@pivasoftware.com>
* Author: Amin Ben Ramdhane <amin.benramdhane@pivasoftware.com>
*
*/
#ifndef __IP_H
#define __IP_H
struct ip_args
{
struct uci_section *ip_sec;
char *ip_4address;
};
struct ipv6_args
{
struct uci_section *ip_sec;
char *ip_6address;
char *ip_6mask;
char *ip_6preferred;
char *ip_6valid;
};
struct ipv6prefix_args
{
struct uci_section *ip_sec;
char *ip_6prefixaddress;
char *ip_6prefixmask;
char *ip_6prefixpreferred;
char *ip_6prefixvalid;
};
extern DMOBJ tIPObj[];
extern DMLEAF tIPParams[];
extern DMOBJ tInterfaceObj[];
extern DMLEAF tIPv4Params[];
extern DMLEAF tIPv6Params[];
extern DMLEAF tIPv6PrefixParams[];
extern DMLEAF tIPInterfaceStatsParams[];
extern DMLEAF tIPInterfaceTWAMPReflectorParams[];
extern DMLEAF tIPintParams[];
extern DMOBJ tDiagnosticObj[];
extern DMLEAF tIPDiagnosticsParams[];
extern DMLEAF tIpPingDiagParams[];
extern DMOBJ tIPDiagnosticsTraceRouteObj[];
extern DMLEAF tIPDiagnosticsTraceRouteParams[];
extern DMLEAF tIPDiagnosticsTraceRouteRouteHopsParams[];
extern DMOBJ tIPDiagnosticsDownloadDiagnosticsObj[];
extern DMLEAF tIPDiagnosticsDownloadDiagnosticsParams[];
extern DMLEAF tIPDiagnosticsDownloadDiagnosticsPerConnectionResultParams[];
extern DMOBJ tIPDiagnosticsUploadDiagnosticsObj[];
extern DMLEAF tIPDiagnosticsUploadDiagnosticsParams[];
extern DMLEAF tIPDiagnosticsUploadDiagnosticsPerConnectionResultParams[];
extern DMLEAF tIPDiagnosticsUDPEchoConfigParams[];
extern DMLEAF tIPDiagnosticsUDPEchoDiagnosticsParams[];
extern DMLEAF tIPDiagnosticsServerSelectionDiagnosticsParams[];
unsigned char get_ipv4_finform(char *refparam, struct dmctx *dmctx, void *data, char *instance);
unsigned char get_ipv6_finform(char *refparam, struct dmctx *dmctx, void *data, char *instance);
int get_linker_ip_interface(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker);
int get_linker_ipv6_prefix(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker);
int browseIPIfaceInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseIfaceIPv4Inst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseIfaceIPv6Inst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseIfaceIPv6PrefixInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseIPInterfaceTWAMPReflectorInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseIPDiagnosticsTraceRouteRouteHopsInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseIPDiagnosticsDownloadDiagnosticsPerConnectionResultInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseIPDiagnosticsUploadDiagnosticsPerConnectionResultInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int add_ip_interface(char *refparam, struct dmctx *ctx, void *data, char **instancepara);
int delete_ip_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
int add_ipv4(char *refparam, struct dmctx *ctx, void *data, char **instancepara);
int delete_ipv4(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
int add_ipv6(char *refparam, struct dmctx *ctx, void *data, char **instancepara);
int delete_ipv6(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
int add_ipv6_prefix(char *refparam, struct dmctx *ctx, void *data, char **instance);
int delete_ipv6_prefix(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
int addObjIPInterfaceTWAMPReflector(char *refparam, struct dmctx *ctx, void *data, char **instance);
int delObjIPInterfaceTWAMPReflector(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
int get_diag_enable_true(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IP_IPv4Capable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IP_IPv4Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IP_IPv4Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IP_IPv4Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IP_IPv6Capable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IP_IPv6Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IP_IPv6Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IP_IPv6Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IP_ULAPrefix(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IP_ULAPrefix(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IP_InterfaceNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_ipv4_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_ipv4_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_firewall_enabled(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_firewall_enabled(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_ipv4_address(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_ipv4_address(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_ipv4_netmask(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_ipv4_netmask(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_ipv4_addressing_type(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_ipv4_addressing_type(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPInterface_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPInterface_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPInterface_IPv4Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPInterface_IPv4Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPInterface_IPv6Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPInterface_IPv6Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPInterface_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPInterface_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPInterface_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPInterface_Name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPInterface_LastChange(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPInterface_LowerLayers(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPInterface_LowerLayers(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPInterface_Router(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPInterface_Router(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPInterface_Reset(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPInterface_Reset(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPInterface_MaxMTUSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPInterface_MaxMTUSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPInterface_Type(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPInterface_Loopback(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPInterface_Loopback(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPInterface_IPv4AddressNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPInterface_IPv6AddressNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPInterface_IPv6PrefixNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPInterface_TWAMPReflectorNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPInterfaceIPv6Address_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPInterfaceIPv6Address_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPInterfaceIPv6Address_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPInterfaceIPv6Address_IPAddressStatus(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPInterfaceIPv6Address_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPInterfaceIPv6Address_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPInterfaceIPv6Address_IPAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPInterfaceIPv6Address_IPAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPInterfaceIPv6Address_Origin(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPInterfaceIPv6Address_Prefix(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPInterfaceIPv6Address_Prefix(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPInterfaceIPv6Address_PreferredLifetime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPInterfaceIPv6Address_PreferredLifetime(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPInterfaceIPv6Address_ValidLifetime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPInterfaceIPv6Address_ValidLifetime(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPInterfaceIPv6Prefix_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPInterfaceIPv6Prefix_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPInterfaceIPv6Prefix_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPInterfaceIPv6Prefix_PrefixStatus(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPInterfaceIPv6Prefix_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPInterfaceIPv6Prefix_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPInterfaceIPv6Prefix_Prefix(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPInterfaceIPv6Prefix_Prefix(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPInterfaceIPv6Prefix_Origin(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPInterfaceIPv6Prefix_StaticType(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPInterfaceIPv6Prefix_StaticType(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPInterfaceIPv6Prefix_ParentPrefix(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPInterfaceIPv6Prefix_ParentPrefix(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPInterfaceIPv6Prefix_ChildPrefixBits(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPInterfaceIPv6Prefix_ChildPrefixBits(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPInterfaceIPv6Prefix_PreferredLifetime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPInterfaceIPv6Prefix_PreferredLifetime(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPInterfaceIPv6Prefix_ValidLifetime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPInterfaceIPv6Prefix_ValidLifetime(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPInterfaceTWAMPReflector_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPInterfaceTWAMPReflector_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPInterfaceTWAMPReflector_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPInterfaceTWAMPReflector_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPInterfaceTWAMPReflector_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPInterfaceTWAMPReflector_Port(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPInterfaceTWAMPReflector_Port(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPInterfaceTWAMPReflector_MaximumTTL(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPInterfaceTWAMPReflector_MaximumTTL(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPInterfaceTWAMPReflector_IPAllowedList(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPInterfaceTWAMPReflector_IPAllowedList(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPInterfaceTWAMPReflector_PortAllowedList(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPInterfaceTWAMPReflector_PortAllowedList(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_ip_interface_statistics_tx_bytes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_ip_interface_statistics_rx_bytes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_ip_interface_statistics_tx_packets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_ip_interface_statistics_rx_packets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_ip_interface_statistics_tx_errors(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_ip_interface_statistics_rx_errors(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_ip_interface_statistics_tx_discardpackets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_ip_interface_statistics_rx_discardpackets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_ip_interface_statistics_tx_unicastpackets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_ip_interface_statistics_rx_unicastpackets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_ip_interface_statistics_tx_multicastpackets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_ip_interface_statistics_rx_multicastpackets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_ip_interface_statistics_tx_broadcastpackets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_ip_interface_statistics_rx_broadcastpackets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_ip_interface_statistics_rx_unknownprotopackets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_ip_ping_diagnostics_state(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_ip_ping_diagnostics_state(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_ip_ping_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_ip_ping_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_ip_ping_protocolversion(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_ip_ping_protocolversion(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_ip_ping_host(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_ip_ping_host(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_ip_ping_repetition_number(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_ip_ping_repetition_number(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_ip_ping_timeout(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_ip_ping_timeout(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_ip_ping_block_size(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_ip_ping_block_size(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_ip_ping_DSCP(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_ip_ping_DSCP(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_ip_ping_success_count(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_ip_ping_failure_count(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_ip_ping_average_response_time(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_ip_ping_min_response_time(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_ip_ping_max_response_time(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_ip_ping_AverageResponseTimeDetailed(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_ip_ping_MinimumResponseTimeDetailed(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_ip_ping_MaximumResponseTimeDetailed(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsTraceRoute_DiagnosticsState(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPDiagnosticsTraceRoute_DiagnosticsState(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPDiagnosticsTraceRoute_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPDiagnosticsTraceRoute_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPDiagnosticsTraceRoute_ProtocolVersion(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPDiagnosticsTraceRoute_ProtocolVersion(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPDiagnosticsTraceRoute_Host(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPDiagnosticsTraceRoute_Host(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPDiagnosticsTraceRoute_NumberOfTries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPDiagnosticsTraceRoute_NumberOfTries(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPDiagnosticsTraceRoute_Timeout(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPDiagnosticsTraceRoute_Timeout(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPDiagnosticsTraceRoute_DataBlockSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPDiagnosticsTraceRoute_DataBlockSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPDiagnosticsTraceRoute_DSCP(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPDiagnosticsTraceRoute_DSCP(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPDiagnosticsTraceRoute_MaxHopCount(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPDiagnosticsTraceRoute_MaxHopCount(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPDiagnosticsTraceRoute_ResponseTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsTraceRoute_RouteHopsNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsTraceRouteRouteHops_Host(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsTraceRouteRouteHops_HostAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsTraceRouteRouteHops_ErrorCode(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsTraceRouteRouteHops_RTTimes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsDownloadDiagnostics_DiagnosticsState(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPDiagnosticsDownloadDiagnostics_DiagnosticsState(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPDiagnosticsDownloadDiagnostics_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPDiagnosticsDownloadDiagnostics_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPDiagnosticsDownloadDiagnostics_DownloadURL(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPDiagnosticsDownloadDiagnostics_DownloadURL(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPDiagnosticsDownloadDiagnostics_DownloadTransports(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsDownloadDiagnostics_DownloadDiagnosticMaxConnections(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsDownloadDiagnostics_DSCP(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPDiagnosticsDownloadDiagnostics_DSCP(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPDiagnosticsDownloadDiagnostics_EthernetPriority(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPDiagnosticsDownloadDiagnostics_EthernetPriority(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPDiagnosticsDownloadDiagnostics_ProtocolVersion(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPDiagnosticsDownloadDiagnostics_ProtocolVersion(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPDiagnosticsDownloadDiagnostics_NumberOfConnections(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPDiagnosticsDownloadDiagnostics_NumberOfConnections(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPDiagnosticsDownloadDiagnostics_ROMTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsDownloadDiagnostics_BOMTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsDownloadDiagnostics_EOMTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsDownloadDiagnostics_TestBytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsDownloadDiagnostics_TotalBytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsDownloadDiagnostics_TotalBytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsDownloadDiagnostics_TestBytesReceivedUnderFullLoading(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsDownloadDiagnostics_TotalBytesReceivedUnderFullLoading(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsDownloadDiagnostics_TotalBytesSentUnderFullLoading(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsDownloadDiagnostics_PeriodOfFullLoading(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsDownloadDiagnostics_TCPOpenRequestTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsDownloadDiagnostics_TCPOpenResponseTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsDownloadDiagnostics_PerConnectionResultNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsDownloadDiagnostics_EnablePerConnectionResults(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPDiagnosticsDownloadDiagnostics_EnablePerConnectionResults(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPDiagnosticsDownloadDiagnosticsPerConnectionResult_ROMTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsDownloadDiagnosticsPerConnectionResult_BOMTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsDownloadDiagnosticsPerConnectionResult_EOMTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsDownloadDiagnosticsPerConnectionResult_TestBytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsDownloadDiagnosticsPerConnectionResult_TotalBytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsDownloadDiagnosticsPerConnectionResult_TotalBytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsDownloadDiagnosticsPerConnectionResult_TCPOpenRequestTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsDownloadDiagnosticsPerConnectionResult_TCPOpenResponseTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsUploadDiagnostics_DiagnosticsState(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPDiagnosticsUploadDiagnostics_DiagnosticsState(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPDiagnosticsUploadDiagnostics_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPDiagnosticsUploadDiagnostics_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPDiagnosticsUploadDiagnostics_UploadURL(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPDiagnosticsUploadDiagnostics_UploadURL(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPDiagnosticsUploadDiagnostics_UploadTransports(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsUploadDiagnostics_DSCP(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPDiagnosticsUploadDiagnostics_DSCP(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPDiagnosticsUploadDiagnostics_EthernetPriority(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPDiagnosticsUploadDiagnostics_EthernetPriority(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPDiagnosticsUploadDiagnostics_TestFileLength(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPDiagnosticsUploadDiagnostics_TestFileLength(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPDiagnosticsUploadDiagnostics_ProtocolVersion(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPDiagnosticsUploadDiagnostics_ProtocolVersion(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPDiagnosticsUploadDiagnostics_NumberOfConnections(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPDiagnosticsUploadDiagnostics_NumberOfConnections(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPDiagnosticsUploadDiagnostics_ROMTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsUploadDiagnostics_BOMTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsUploadDiagnostics_EOMTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsUploadDiagnostics_TestBytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsUploadDiagnostics_TotalBytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsUploadDiagnostics_TotalBytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsUploadDiagnostics_TestBytesSentUnderFullLoading(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsUploadDiagnostics_TotalBytesReceivedUnderFullLoading(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsUploadDiagnostics_TotalBytesSentUnderFullLoading(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsUploadDiagnostics_PeriodOfFullLoading(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsUploadDiagnostics_TCPOpenRequestTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsUploadDiagnostics_TCPOpenResponseTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsUploadDiagnostics_PerConnectionResultNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsUploadDiagnostics_EnablePerConnectionResults(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPDiagnosticsUploadDiagnostics_EnablePerConnectionResults(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPDiagnosticsUploadDiagnosticsPerConnectionResult_ROMTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsUploadDiagnosticsPerConnectionResult_BOMTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsUploadDiagnosticsPerConnectionResult_EOMTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsUploadDiagnosticsPerConnectionResult_TestBytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsUploadDiagnosticsPerConnectionResult_TotalBytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsUploadDiagnosticsPerConnectionResult_TotalBytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsUploadDiagnosticsPerConnectionResult_TCPOpenRequestTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsUploadDiagnosticsPerConnectionResult_TCPOpenResponseTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsUDPEchoConfig_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPDiagnosticsUDPEchoConfig_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPDiagnosticsUDPEchoConfig_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPDiagnosticsUDPEchoConfig_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPDiagnosticsUDPEchoConfig_SourceIPAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPDiagnosticsUDPEchoConfig_SourceIPAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPDiagnosticsUDPEchoConfig_UDPPort(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPDiagnosticsUDPEchoConfig_UDPPort(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPDiagnosticsUDPEchoConfig_EchoPlusEnabled(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPDiagnosticsUDPEchoConfig_EchoPlusEnabled(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPDiagnosticsUDPEchoConfig_EchoPlusSupported(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsUDPEchoConfig_PacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsUDPEchoConfig_PacketsResponded(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsUDPEchoConfig_BytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsUDPEchoConfig_BytesResponded(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsUDPEchoConfig_TimeFirstPacketReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsUDPEchoConfig_TimeLastPacketReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsUDPEchoDiagnostics_DiagnosticsState(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPDiagnosticsUDPEchoDiagnostics_DiagnosticsState(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPDiagnosticsUDPEchoDiagnostics_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPDiagnosticsUDPEchoDiagnostics_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPDiagnosticsUDPEchoDiagnostics_Host(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPDiagnosticsUDPEchoDiagnostics_Host(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPDiagnosticsUDPEchoDiagnostics_Port(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPDiagnosticsUDPEchoDiagnostics_Port(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPDiagnosticsUDPEchoDiagnostics_NumberOfRepetitions(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPDiagnosticsUDPEchoDiagnostics_NumberOfRepetitions(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPDiagnosticsUDPEchoDiagnostics_Timeout(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPDiagnosticsUDPEchoDiagnostics_Timeout(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPDiagnosticsUDPEchoDiagnostics_DataBlockSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPDiagnosticsUDPEchoDiagnostics_DataBlockSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPDiagnosticsUDPEchoDiagnostics_DSCP(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPDiagnosticsUDPEchoDiagnostics_DSCP(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPDiagnosticsUDPEchoDiagnostics_InterTransmissionTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPDiagnosticsUDPEchoDiagnostics_InterTransmissionTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPDiagnosticsUDPEchoDiagnostics_ProtocolVersion(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPDiagnosticsUDPEchoDiagnostics_ProtocolVersion(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPDiagnosticsUDPEchoDiagnostics_SuccessCount(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsUDPEchoDiagnostics_FailureCount(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsUDPEchoDiagnostics_AverageResponseTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsUDPEchoDiagnostics_MinimumResponseTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsUDPEchoDiagnostics_MaximumResponseTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsServerSelectionDiagnostics_DiagnosticsState(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPDiagnosticsServerSelectionDiagnostics_DiagnosticsState(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPDiagnosticsServerSelectionDiagnostics_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPDiagnosticsServerSelectionDiagnostics_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPDiagnosticsServerSelectionDiagnostics_ProtocolVersion(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPDiagnosticsServerSelectionDiagnostics_ProtocolVersion(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPDiagnosticsServerSelectionDiagnostics_Protocol(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPDiagnosticsServerSelectionDiagnostics_Protocol(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPDiagnosticsServerSelectionDiagnostics_Port(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPDiagnosticsServerSelectionDiagnostics_Port(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPDiagnosticsServerSelectionDiagnostics_HostList(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPDiagnosticsServerSelectionDiagnostics_HostList(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPDiagnosticsServerSelectionDiagnostics_NumberOfRepetitions(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPDiagnosticsServerSelectionDiagnostics_NumberOfRepetitions(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPDiagnosticsServerSelectionDiagnostics_Timeout(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_IPDiagnosticsServerSelectionDiagnostics_Timeout(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_IPDiagnosticsServerSelectionDiagnostics_FastestHost(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsServerSelectionDiagnostics_MinimumResponseTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsServerSelectionDiagnostics_AverageResponseTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsServerSelectionDiagnostics_MaximumResponseTime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
#endif

View file

@ -1,683 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2019 iopsys Software Solutions AB
* Author: Anis Ellouze <anis.ellouze@pivasoftware.com>
* Author: Amin Ben Ramdhane <amin.benramdhane@pivasoftware.com>
*
*/
#include <uci.h>
#include <stdio.h>
#include <ctype.h>
#include "dmuci.h"
#include "dmubus.h"
#include "dmcwmp.h"
#include "dmcommon.h"
#include "dmentry.h"
#include "nat.h"
/*** NAT. ***/
DMOBJ tnatObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, finform, notification, nextobj, leaf*/
{"InterfaceSetting", &DMWRITE, add_NAT_InterfaceSetting, delete_NAT_InterfaceSetting, NULL, browseInterfaceSettingInst, NULL, NULL, NULL, tInterfaceSettingParam, NULL},
{"PortMapping", &DMWRITE, add_NAT_PortMapping, delete_NAT_PortMapping, NULL, browsePortMappingInst, NULL, NULL, NULL, tPortMappingParam, NULL},
{0}
};
DMLEAF tnatParam[] = {
{"InterfaceSettingNumberOfEntries", &DMREAD, DMT_UNINT, get_nat_interface_setting_number_of_entries, NULL, NULL, NULL},
{"PortMappingNumberOfEntries", &DMREAD, DMT_UNINT, get_nat_port_mapping_number_of_entries, NULL, NULL, NULL},
{0}
};
/*** NAT.InterfaceSetting. ***/
DMLEAF tInterfaceSettingParam[] = {
{"Enable", &DMWRITE, DMT_BOOL, get_nat_interface_setting_enable, set_nat_interface_setting_enable, NULL, NULL},
{"Status", &DMWRITE, DMT_STRING, get_nat_interface_setting_status, NULL, NULL, NULL},
{"Alias", &DMWRITE, DMT_STRING, get_nat_interface_setting_alias, set_nat_interface_setting_alias, NULL, NULL},
{"Interface", &DMWRITE, DMT_STRING, get_nat_interface_setting_interface, set_nat_interface_setting_interface, NULL, NULL},
{0}
};
/*** NAT.PortMapping. ***/
DMLEAF tPortMappingParam[] = {
{"Enable", &DMWRITE, DMT_BOOL, get_nat_port_mapping_enable, set_nat_port_mapping_enable, NULL, NULL},
{"Status", &DMWRITE, DMT_STRING, get_nat_port_mapping_status, NULL, NULL, NULL},
{"Alias", &DMWRITE, DMT_STRING, get_nat_port_mapping_alias, set_nat_port_mapping_alias, NULL, NULL},
{"Interface", &DMWRITE, DMT_STRING, get_nat_port_mapping_interface, set_nat_port_mapping_interface, NULL, NULL},
{"AllInterfaces", &DMWRITE, DMT_BOOL, get_nat_port_mapping_all_interface, set_nat_port_mapping_all_interface, NULL, NULL},
{"LeaseDuration", &DMWRITE, DMT_UNINT, get_nat_port_mapping_lease_duration, set_nat_port_mapping_lease_duration, NULL, NULL},
{"RemoteHost", &DMWRITE, DMT_STRING, get_nat_port_mapping_remote_host, set_nat_port_mapping_remote_host, NULL, NULL},
{"ExternalPort", &DMWRITE, DMT_UNINT, get_nat_port_mapping_external_port, set_nat_port_mapping_external_port, NULL, NULL},
{"ExternalPortEndRange", &DMWRITE, DMT_UNINT, get_nat_port_mapping_external_port_end_range, set_nat_port_mapping_external_port_end_range, NULL, NULL},
{"InternalPort", &DMWRITE, DMT_UNINT, get_nat_port_mapping_internal_port, set_nat_port_mapping_internal_port, NULL, NULL},
{"Protocol", &DMWRITE, DMT_STRING, get_nat_port_mapping_protocol, set_nat_port_mapping_protocol, NULL, NULL},
{"InternalClient", &DMWRITE, DMT_STRING, get_nat_port_mapping_internal_client, set_nat_port_mapping_internal_client, NULL, NULL},
{"Description", &DMWRITE, DMT_STRING, get_nat_port_mapping_description, set_nat_port_mapping_description, NULL, NULL},
{0}
};
/*************************************************************
* ADD DEL OBJ
/*************************************************************/
int add_NAT_InterfaceSetting(char *refparam, struct dmctx *ctx, void *data, char **instance)
{
char *value, *v, *inst, name[16];
struct uci_section *s = NULL, *dmmap_firewall = NULL;
check_create_dmmap_package("dmmap_firewall");
inst = get_last_instance_icwmpd("dmmap_firewall", "zone", "interface_setting_instance");
sprintf(name, "iface_set_%d", inst ? (atoi(inst)+1) : 1);
dmuci_add_section_and_rename("firewall", "zone", &s, &value);
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_icwmpd("dmmap_firewall", "zone", &dmmap_firewall, &v);
dmuci_set_value_by_section(dmmap_firewall, "section_name", section_name(s));
*instance = update_instance_icwmpd(dmmap_firewall, inst, "interface_setting_instance");
return 0;
}
int delete_NAT_InterfaceSetting(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action)
{
int found = 0;
char *lan_name;
struct uci_section *s = NULL, *ss = NULL, *dmmap_firewall= NULL;
switch (del_action) {
case DEL_INST:
get_dmmap_section_of_config_section("dmmap_firewall", "zone", section_name((struct uci_section *)data), &dmmap_firewall);
if(dmmap_firewall != NULL)
dmuci_delete_by_section(dmmap_firewall, NULL, NULL);
dmuci_delete_by_section((struct uci_section *)data, NULL, NULL);
break;
case DEL_ALL:
uci_foreach_sections("firewall", "zone", s) {
if (found != 0){
get_dmmap_section_of_config_section("dmmap_firewall", "zone", section_name(ss), &dmmap_firewall);
if(dmmap_firewall != NULL)
dmuci_delete_by_section(dmmap_firewall, NULL, NULL);
dmuci_delete_by_section(ss, NULL, NULL);
}
ss = s;
found++;
}
if (ss != NULL){
get_dmmap_section_of_config_section("dmmap_firewall", "zone", section_name(ss), &dmmap_firewall);
if(dmmap_firewall != NULL)
dmuci_delete_by_section(dmmap_firewall, NULL, NULL);
dmuci_delete_by_section(ss, NULL, NULL);
}
return 0;
}
return 0;
}
int add_NAT_PortMapping(char *refparam, struct dmctx *ctx, void *data, char **instance)
{
char *value, *v, *inst, name[16];
struct uci_section *s = NULL, *dmmap_firewall = NULL;
check_create_dmmap_package("dmmap_firewall");
inst = get_last_instance_icwmpd("dmmap_firewall", "redirect", "port_mapping_instance");
sprintf(name, "port_map_%d", inst ? (atoi(inst)+1) : 1);
dmuci_add_section_and_rename("firewall", "redirect", &s, &value);
dmuci_set_value_by_section(s, "name", name);
dmuci_set_value_by_section(s, "src", "wan");
dmuci_set_value_by_section(s, "target", "DNAT");
dmuci_set_value_by_section(s, "dest", "lan");
dmuci_add_section_icwmpd("dmmap_firewall", "redirect", &dmmap_firewall, &v);
dmuci_set_value_by_section(dmmap_firewall, "section_name", section_name(s));
*instance = update_instance_icwmpd(dmmap_firewall, inst, "port_mapping_instance");
return 0;
}
int delete_NAT_PortMapping(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action)
{
int found = 0;
char *lan_name;
struct uci_section *s = NULL, *ss = NULL, *dmmap_firewall= NULL;
switch (del_action) {
case DEL_INST:
get_dmmap_section_of_config_section("dmmap_firewall", "redirect", section_name((struct uci_section *)data), &dmmap_firewall);
if(dmmap_firewall != NULL)
dmuci_delete_by_section(dmmap_firewall, NULL, NULL);
dmuci_delete_by_section((struct uci_section *)data, NULL, NULL);
break;
case DEL_ALL:
uci_foreach_sections("firewall", "redirect", s) {
if (found != 0){
get_dmmap_section_of_config_section("dmmap_firewall", "redirect", section_name(ss), &dmmap_firewall);
if(dmmap_firewall != NULL)
dmuci_delete_by_section(dmmap_firewall, NULL, NULL);
dmuci_delete_by_section(ss, NULL, NULL);
}
ss = s;
found++;
}
if (ss != NULL){
get_dmmap_section_of_config_section("dmmap_firewall", "redirect", section_name(ss), &dmmap_firewall);
if(dmmap_firewall != NULL)
dmuci_delete_by_section(dmmap_firewall, NULL, NULL);
dmuci_delete_by_section(ss, NULL, NULL);
}
return 0;
}
return 0;
}
/**************************************************************************
* SET & GET VALUE
***************************************************************************/
/*#Device.NAT.InterfaceSettingNumberOfEntries!UCI:firewall/zone/*/
int get_nat_interface_setting_number_of_entries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *s = NULL;
int cnt = 0;
uci_foreach_sections("firewall", "zone", s)
{
cnt++;
}
dmasprintf(value, "%d", cnt);
return 0;
}
/*#Device.NAT.PortMappingNumberOfEntries!UCI:firewall/redirect/*/
int get_nat_port_mapping_number_of_entries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *s = NULL;
int cnt = 0;
uci_foreach_sections("firewall", "redirect", s)
{
cnt++;
}
dmasprintf(value, "%d", cnt);
return 0;
}
/*#Device.NAT.InterfaceSetting.{i}.Enable!UCI:firewall/zone,@i-1/masq*/
int get_nat_interface_setting_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char *val;
dmuci_get_value_by_section_string((struct uci_section *)data, "masq", &val);
*value = (*val == '1') ? "1" : "0";
return 0;
}
int set_nat_interface_setting_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
bool b;
switch (action) {
case VALUECHECK:
if (string_to_bool(value, &b))
return FAULT_9007;
return 0;
case VALUESET:
string_to_bool(value, &b);
dmuci_set_value_by_section((struct uci_section *)data, "masq", b ? "1" : "0");
return 0;
}
return 0;
}
/*#Device.NAT.InterfaceSetting.{i}.Status!UCI:firewall/zone,@i-1/masq*/
int get_nat_interface_setting_status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char *val;
dmuci_get_value_by_section_string((struct uci_section *)data, "masq", &val);
*value = (*val == '1') ? "Enabled" : "Disabled";
return 0;
}
int get_nat_interface_setting_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *dmmap_section;
get_dmmap_section_of_config_section("dmmap_firewall", "zone", section_name((struct uci_section *)data), &dmmap_section);
dmuci_get_value_by_section_string(dmmap_section, "interface_setting_alias", value);
return 0;
}
int set_nat_interface_setting_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct uci_section *dmmap_section;
get_dmmap_section_of_config_section("dmmap_firewall", "zone", section_name((struct uci_section *)data), &dmmap_section);
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section(dmmap_section, "interface_setting_alias", value);
return 0;
}
return 0;
}
int get_nat_interface_setting_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_list *v;
struct uci_element *e;
char *ifaceobj, buf[256] = "";
*value = "";
dmuci_get_value_by_section_list((struct uci_section *)data, "network", &v);
if (v == NULL)
return 0;
uci_foreach_element(v, e) {
adm_entry_get_linker_param(ctx, dm_print_path("%s%cIP%cInterface%c", dmroot, dm_delim, dm_delim, dm_delim), e->name, &ifaceobj); // MEM WILL BE FREED IN DMMEMCLEAN
if (ifaceobj == NULL)
continue;
if (*buf != '\0')
strcat(buf, ",");
strcat(buf, ifaceobj);
}
*value = dmstrdup(buf);
return 0;
}
int set_nat_interface_setting_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
char *iface, *pch, *pchr, buf[256] = "";
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
strcpy(buf, value);
dmuci_set_value_by_section((struct uci_section *)data, "network", "");
for(pch = strtok_r(buf, ",", &pchr); pch != NULL; pch = strtok_r(NULL, ",", &pchr)) {
adm_entry_get_linker_value(ctx, pch, &iface);
if (iface) {
dmuci_add_list_value_by_section((struct uci_section *)data, "network", iface);
free(iface);
}
}
return 0;
}
return 0;
}
/*#Device.NAT.PortMapping.{i}.Enable!UCI:firewall/redirect,@i-1/enabled*/
int get_nat_port_mapping_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char *val;
dmuci_get_value_by_section_string((struct uci_section *)data, "enabled", &val);
*value = (*val == '1') ? "1" : "0";
return 0;
}
int set_nat_port_mapping_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
bool b;
switch (action) {
case VALUECHECK:
if (string_to_bool(value, &b))
return FAULT_9007;
return 0;
case VALUESET:
string_to_bool(value, &b);
dmuci_set_value_by_section((struct uci_section *)data, "enabled", b ? "1" : "0");
return 0;
}
return 0;
}
/*#Device.NAT.PortMapping.{i}.Status!UCI:firewall/redirect,@i-1/enabled*/
int get_nat_port_mapping_status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char *val;
dmuci_get_value_by_section_string((struct uci_section *)data, "enabled", &val);
*value = (*val == '1') ? "Enabled" : "Disabled";
return 0;
}
int get_nat_port_mapping_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *dmmap_section;
get_dmmap_section_of_config_section("dmmap_firewall", "redirect", section_name((struct uci_section *)data), &dmmap_section);
dmuci_get_value_by_section_string(dmmap_section, "port_mapping_alias", value);
return 0;
}
int set_nat_port_mapping_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct uci_section *dmmap_section;
get_dmmap_section_of_config_section("dmmap_firewall", "redirect", section_name((struct uci_section *)data), &dmmap_section);
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section(dmmap_section, "port_mapping_alias", value);
return 0;
}
return 0;
}
int get_nat_port_mapping_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *s = NULL;
struct uci_list *v;
struct uci_element *e;
char *zone, *name, *ifaceobj, buf[256] = "";
dmuci_get_value_by_section_string((struct uci_section *)data, "src", &zone);
uci_foreach_sections("firewall", "zone", s) {
dmuci_get_value_by_section_string(s, "name", &name);
if (strcmp(zone, name) == 0) {
dmuci_get_value_by_section_list(s, "network", &v);
break;
}
}
if (v == NULL)
return 0;
uci_foreach_element(v, e) {
adm_entry_get_linker_param(ctx, dm_print_path("%s%cIP%cInterface%c", dmroot, dm_delim, dm_delim, dm_delim), e->name, &ifaceobj); // MEM WILL BE FREED IN DMMEMCLEAN
if (ifaceobj == NULL)
continue;
if (*buf != '\0')
strcat(buf, ",");
strcat(buf, ifaceobj);
}
*value = dmstrdup(buf);
return 0;
}
int set_nat_port_mapping_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
char *iface, *network, *zone;
struct uci_section *s = NULL;
switch (action) {
case VALUECHECK:
break;
case VALUESET:
adm_entry_get_linker_value(ctx, value, &iface);
if (iface[0] != '\0') {
uci_foreach_sections("firewall", "zone", s)
{
dmuci_get_value_by_section_string(s, "network", &network);
if (is_strword_in_optionvalue(network, iface)){
dmuci_get_value_by_section_string(s, "name", &zone);
dmuci_set_value_by_section((struct uci_section *)data, "src", zone);
break;
}
}
}
break;
}
return 0;
}
int get_nat_port_mapping_all_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = "0";
return 0;
}
int set_nat_port_mapping_all_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
bool b;
switch (action) {
case VALUECHECK:
if (string_to_bool(value, &b))
return FAULT_9007;
return 0;
case VALUESET:
return 0;
}
return 0;
}
int get_nat_port_mapping_lease_duration(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
// CPE only supports static port forwards
*value = "0";
return 0;
}
int set_nat_port_mapping_lease_duration(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
// CPE only supports static port forwards
if (strcmp(value, "0") != 0)
return FAULT_9007;
return 0;
case VALUESET:
// Nothing to set for static port forwards
return 0;
}
return 0;
}
/*#Device.NAT.PortMapping.{i}.RemoteHost!UCI:firewall/redirect,@i-1/src_dip*/
int get_nat_port_mapping_remote_host(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_value_by_section_string((struct uci_section *)data, "src_dip", value);
return 0;
}
int set_nat_port_mapping_remote_host(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section((struct uci_section *)data, "src_dip", value);
return 0;
}
return 0;
}
/*#Device.NAT.PortMapping.{i}.ExternalPort!UCI:firewall/redirect,@i-1/src_dport*/
int get_nat_port_mapping_external_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char *dport, *tmp;
dmuci_get_value_by_section_string((struct uci_section *)data, "src_dport", &dport);
if (*dport == '\0') {
*value = "0";
return 0;
}
tmp = strchr(dport, ':');
if (tmp)
*tmp = '\0';
*value = dport;
return 0;
}
int set_nat_port_mapping_external_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
char *dport, buffer[64];
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_get_value_by_section_string((struct uci_section *)data, "src_dport", &dport);
dport = strchr(dport, ':');
if (dport == NULL)
sprintf(buffer, "%s", value);
else
sprintf(buffer, "%s%s", value, dport);
dmuci_set_value_by_section((struct uci_section *)data, "src_dport", buffer);
return 0;
}
return 0;
}
/*#Device.NAT.PortMapping.{i}.ExternalPortEndRange!UCI:firewall/redirect,@i-1/src_dport*/
int get_nat_port_mapping_external_port_end_range(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char *dport, *tmp;
dmuci_get_value_by_section_string((struct uci_section *)data, "src_dport", &dport);
tmp = strchr(dport, ':');
*value = (tmp) ? tmp+1 : "0";
return 0;
}
int set_nat_port_mapping_external_port_end_range(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
char *dport, *tmp, buffer[64];
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_get_value_by_section_string((struct uci_section *)data, "src_dport", &dport);
tmp = strchr(dport, ':');
if (tmp)
*tmp = '\0';
if (*value == '0')
sprintf(buffer, "%s", dport);
else
sprintf(buffer, "%s:%s", dport, value);
dmuci_set_value_by_section((struct uci_section *)data, "src_dport", buffer);
return 0;
}
return 0;
}
/*#Device.NAT.PortMapping.{i}.InternalPort!UCI:firewall/redirect,@i-1/dest_port*/
int get_nat_port_mapping_internal_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_value_by_section_string((struct uci_section *)data, "dest_port", value);
return 0;
}
int set_nat_port_mapping_internal_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section((struct uci_section *)data, "dest_port", value);
return 0;
}
return 0;
}
/*#Device.NAT.PortMapping.{i}.Protocol!UCI:firewall/redirect,@i-1/proto*/
int get_nat_port_mapping_protocol(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char *proto;
dmuci_get_value_by_section_string((struct uci_section *)data, "proto", &proto);
if (strcasecmp(proto, "tcp") == 0)
*value = "TCP";
else if (strcasecmp(proto, "udp") == 0)
*value = "UDP";
else
*value = "TCP/UDP";
return 0;
return 0;
}
int set_nat_port_mapping_protocol(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
char *v;
switch (action) {
case VALUECHECK:
if (strcasecmp("TCP", value) != 0 && strcasecmp("UDP", value) != 0 && strcasecmp("TCP/UDP", value) != 0)
return FAULT_9007;
return 0;
case VALUESET:
if (strcasecmp("TCP", value) == 0)
v = "tcp";
else if (strcasecmp("UDP", value) == 0)
v = "udp";
else
v = "tcpudp";
dmuci_set_value_by_section((struct uci_section *)data, "proto", v);
return 0;
}
return 0;
}
/*#Device.NAT.PortMapping.{i}.InternalClient!UCI:firewall/redirect,@i-1/dest_ip*/
int get_nat_port_mapping_internal_client(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_value_by_section_string((struct uci_section *)data, "dest_ip", value);
return 0;
}
int set_nat_port_mapping_internal_client(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section((struct uci_section *)data, "dest_ip", value);
return 0;
}
return 0;
}
/*#Device.NAT.PortMapping.{i}.Description!UCI:firewall/redirect,@i-1/name*/
int get_nat_port_mapping_description(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_value_by_section_string((struct uci_section *)data, "name", value);
return 0;
}
int set_nat_port_mapping_description(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section((struct uci_section *)data, "name", value);
return 0;
}
return 0;
}
/*************************************************************
* ENTRY METHOD
/*************************************************************/
/*#Device.NAT.InterfaceSetting.{i}.!UCI:firewall/zone/dmmap_firewall*/
int browseInterfaceSettingInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *nati, *nati_last = NULL;
struct dmmap_dup *p;
LIST_HEAD(dup_list);
synchronize_specific_config_sections_with_dmmap("firewall", "zone", "dmmap_firewall", &dup_list);
list_for_each_entry(p, &dup_list, list) {
nati = handle_update_instance(1, dmctx, &nati_last, update_instance_alias, 3, p->dmmap_section, "interface_setting_instance", "interface_setting_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, nati) == DM_STOP)
break;
}
free_dmmap_config_dup_list(&dup_list);
return 0;
}
/*#Device.NAT.PortMapping.{i}.!UCI:firewall/redirect/dmmap_firewall*/
int browsePortMappingInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *natp, *natp_last = NULL, *target;
struct dmmap_dup *p;
LIST_HEAD(dup_list);
synchronize_specific_config_sections_with_dmmap("firewall", "redirect", "dmmap_firewall", &dup_list);
list_for_each_entry(p, &dup_list, list) {
dmuci_get_value_by_section_string(p->config_section, "target", &target);
if (*target != '\0' && strcmp(target, "DNAT") != 0)
continue;
natp = handle_update_instance(1, dmctx, &natp_last, update_instance_alias, 3, p->dmmap_section, "port_mapping_instance", "port_mapping_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, natp) == DM_STOP)
break;
}
free_dmmap_config_dup_list(&dup_list);
return 0;
}

View file

@ -1,65 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2019 iopsys Software Solutions AB
* Author: Imen BHIRI <imen.bhiri@pivasoftware.com>
* Author: Amin Ben Ramdhane <amin.benramdhane@pivasoftware.com>
*
*/
#ifndef __NAT_H
#define __NAT_H
extern DMOBJ tnatObj[];
extern DMLEAF tnatParam[];
extern DMLEAF tInterfaceSettingParam[];
extern DMLEAF tPortMappingParam[];
int browseInterfaceSettingInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browsePortMappingInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int add_NAT_InterfaceSetting(char *refparam, struct dmctx *ctx, void *data, char **instance);
int delete_NAT_InterfaceSetting(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
int add_NAT_PortMapping(char *refparam, struct dmctx *ctx, void *data, char **instance);
int delete_NAT_PortMapping(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
int get_nat_interface_setting_number_of_entries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_nat_port_mapping_number_of_entries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_nat_interface_setting_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_nat_interface_setting_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_nat_interface_setting_status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_nat_interface_setting_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_nat_interface_setting_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_nat_interface_setting_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_nat_interface_setting_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_nat_port_mapping_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_nat_port_mapping_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_nat_port_mapping_status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_nat_port_mapping_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_nat_port_mapping_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_nat_port_mapping_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_nat_port_mapping_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_nat_port_mapping_all_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_nat_port_mapping_all_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_nat_port_mapping_lease_duration(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_nat_port_mapping_lease_duration(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_nat_port_mapping_remote_host(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_nat_port_mapping_remote_host(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_nat_port_mapping_external_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_nat_port_mapping_external_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_nat_port_mapping_external_port_end_range(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_nat_port_mapping_external_port_end_range(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_nat_port_mapping_internal_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_nat_port_mapping_internal_port(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_nat_port_mapping_protocol(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_nat_port_mapping_protocol(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_nat_port_mapping_internal_client(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_nat_port_mapping_internal_client(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_nat_port_mapping_description(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_nat_port_mapping_description(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
#endif

View file

@ -1,591 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2016 Inteno Broadband Technology AB
* Author: Anis Ellouze <anis.ellouze@pivasoftware.com>
*
*/
#include <uci.h>
#include <stdio.h>
#include <ctype.h>
#include "dmuci.h"
#include "dmubus.h"
#include "dmcwmp.h"
#include "dmjson.h"
#include "dmcommon.h"
#include "dmentry.h"
#include "ppp.h"
/*** PPP. ***/
DMLEAF tPPPParams[] = {
/* PARAM, permission, type, getvlue, setvalue, forced_inform, notification*/
{"InterfaceNumberOfEntries", &DMREAD, DMT_UNINT, get_PPP_InterfaceNumberOfEntries, NULL, NULL, NULL},
{0}
};
DMOBJ tpppObj[] = {
/* OBJ, permission, addobj, delobj, browseinstobj, finform, notification, nextobj, leaf*/
{"Interface", &DMWRITE, add_ppp_interface, delete_ppp_interface, NULL, browseInterfaceInst, NULL, NULL, tpppInterfaceObj, tpppInterfaceParam, get_linker_ppp_interface},
{0}
};
/*** PPP.Interface. ***/
DMOBJ tpppInterfaceObj[] = {
/* OBJ, permission, addobj, delobj, browseinstobj, finform, notification, nextobj, leaf*/
{"PPPoE", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tPPPInterfacePPPoEParams, NULL},
{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tStatsParam, NULL},
{0}
};
DMLEAF tpppInterfaceParam[] = {
{"Alias", &DMWRITE, DMT_STRING, get_ppp_alias, set_ppp_alias, NULL, NULL},
{"Status", &DMREAD, DMT_STRING, get_PPPInterface_Status, NULL, NULL, NULL},
{"Enable", &DMWRITE, DMT_BOOL, get_ppp_enable, set_ppp_enable, NULL, NULL},
{"LastChange", &DMREAD, DMT_UNINT, get_PPPInterface_LastChange, NULL, NULL, NULL},
{"Reset", &DMWRITE, DMT_BOOL, get_PPPInterface_Reset, set_PPPInterface_Reset, NULL, NULL},
{"Name", &DMREAD, DMT_STRING, get_ppp_name, NULL, NULL, NULL},
{"LowerLayers", &DMWRITE, DMT_STRING, get_ppp_lower_layer, set_ppp_lower_layer, NULL, NULL},
{"ConnectionStatus", &DMREAD, DMT_STRING, get_ppp_status, NULL, NULL, NULL},
{"Username", &DMWRITE, DMT_STRING, get_ppp_username, set_ppp_username, NULL, NULL},
{"Password", &DMWRITE, DMT_STRING, get_empty, set_ppp_password, NULL, NULL},
{0}
};
/*** PPP.Interface.Stats. ***/
DMLEAF tStatsParam[] = {
{"BytesReceived", &DMREAD, DMT_UNINT, get_ppp_eth_bytes_received, NULL, NULL, NULL},
{"BytesSent", &DMREAD, DMT_UNINT, get_ppp_eth_bytes_sent, NULL, NULL, NULL},
{"PacketsReceived", &DMREAD, DMT_UNINT, get_ppp_eth_pack_received, NULL, NULL, NULL},
{"PacketsSent", &DMREAD, DMT_UNINT, get_ppp_eth_pack_sent, NULL, NULL, NULL},
{"ErrorsSent", &DMREAD, DMT_UNINT, get_PPPInterfaceStats_ErrorsSent, NULL, NULL, NULL},
{"ErrorsReceived", &DMREAD, DMT_UNINT, get_PPPInterfaceStats_ErrorsReceived, NULL, NULL, NULL},
{"UnicastPacketsSent", &DMREAD, DMT_UNINT, get_PPPInterfaceStats_UnicastPacketsSent, NULL, NULL, NULL},
{"UnicastPacketsReceived", &DMREAD, DMT_UNINT, get_PPPInterfaceStats_UnicastPacketsReceived, NULL, NULL, NULL},
{"DiscardPacketsSent", &DMREAD, DMT_UNINT, get_PPPInterfaceStats_DiscardPacketsSent, NULL, NULL, NULL},
{"DiscardPacketsReceived", &DMREAD, DMT_UNINT, get_PPPInterfaceStats_DiscardPacketsReceived, NULL, NULL, NULL},
{"MulticastPacketsSent", &DMREAD, DMT_UNINT, get_PPPInterfaceStats_MulticastPacketsSent, NULL, NULL, NULL},
{"MulticastPacketsReceived", &DMREAD, DMT_UNINT, get_PPPInterfaceStats_MulticastPacketsReceived, NULL, NULL, NULL},
{"BroadcastPacketsSent", &DMREAD, DMT_UNINT, get_PPPInterfaceStats_BroadcastPacketsSent, NULL, NULL, NULL},
{"BroadcastPacketsReceived", &DMREAD, DMT_UNINT, get_PPPInterfaceStats_BroadcastPacketsReceived, NULL, NULL, NULL},
{"UnknownProtoPacketsReceived", &DMREAD, DMT_UNINT, get_PPPInterfaceStats_UnknownProtoPacketsReceived, NULL, NULL, NULL},
{0}
};
DMLEAF tPPPInterfacePPPoEParams[] = {
/* PARAM, permission, type, getvlue, setvalue, forced_inform, notification*/
{"SessionID", &DMREAD, DMT_UNINT, get_PPPInterfacePPPoE_SessionID, NULL, NULL, NULL},
{"ACName", &DMWRITE, DMT_STRING, get_PPPInterfacePPPoE_ACName, set_PPPInterfacePPPoE_ACName, NULL, NULL},
{"ServiceName", &DMWRITE, DMT_STRING, get_PPPInterfacePPPoE_ServiceName, set_PPPInterfacePPPoE_ServiceName, NULL, NULL},
{0}
};
/*************************************************************
* GET SET ALIAS
/*************************************************************/
int get_ppp_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *dmmap_section;
get_dmmap_section_of_config_section("dmmap_network", "interface", section_name((struct uci_section *)data), &dmmap_section);
dmuci_get_value_by_section_string(dmmap_section, "ppp_int_alias", value);
return 0;
}
int set_ppp_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct uci_section *dmmap_section;
get_dmmap_section_of_config_section("dmmap_network", "interface", section_name((struct uci_section *)data), &dmmap_section);
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section(dmmap_section, "ppp_int_alias", value);
return 0;
}
return 0;
}
/**************************************************************************
* GET & SET PARAMETERS
***************************************************************************/
/*#Device.PPP.Interface.{i}.Enable!UBUS:network.interface/status/interface,@Name/up*/
int get_ppp_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return get_interface_enable_ubus(section_name(((struct uci_section *)data)), refparam, ctx, value);
}
int set_ppp_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
return set_interface_enable_ubus(section_name(((struct uci_section *)data)), refparam, ctx, action, value);
}
int get_PPPInterface_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char *status;
get_interface_enable_ubus(section_name(((struct uci_section *)data)), refparam, ctx, &status);
if(strcmp(status, "true") == 0)
*value= "Up";
else
*value= "Down";
return 0;
}
int get_PPPInterface_LastChange(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
json_object *res;
dmubus_call("network.interface", "status", UBUS_ARGS{{"interface", section_name((struct uci_section *)data), String}}, 1, &res);
DM_ASSERT(res, *value = "");
*value = dmjson_get_value(res, 1, "uptime");
return 0;
}
int get_PPPInterface_Reset(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = "false";
return 0;
}
int set_PPPInterface_Reset(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
unsigned char b;
switch (action) {
case VALUECHECK:
if (string_to_bool(value, &b))
return FAULT_9007;
break;
case VALUESET:
string_to_bool(value, &b);
if(b) {
set_interface_enable_ubus(section_name((struct uci_section *)data), refparam, ctx, action, "0");
set_interface_enable_ubus(section_name((struct uci_section *)data), refparam, ctx, action, "1");
}
break;
}
return 0;
}
int get_ppp_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = dmstrdup(section_name(((struct uci_section *)data)));
return 0;
}
/*#Device.PPP.Interface.{i}.Status!UBUS:network.interface/status/interface,@Name/up*/
int get_ppp_status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char *status = NULL;
char *uptime = NULL;
char *pending = NULL;
json_object *res = NULL, *jobj = NULL;
bool bstatus = false, bpend = false;
dmubus_call("network.interface", "status", UBUS_ARGS{{"interface", section_name(((struct uci_section *)data)), String}}, 1, &res);
DM_ASSERT(res, *value = "");
jobj = dmjson_get_obj(res, 1, "up");
if(jobj)
{
status = dmjson_get_value(res, 1, "up");
string_to_bool(status, &bstatus);
if (bstatus) {
uptime = dmjson_get_value(res, 1, "uptime");
pending = dmjson_get_value(res, 1, "pending");
string_to_bool(pending, &bpend);
}
}
if (uptime && atoi(uptime) > 0)
*value = "Connected";
else if (pending && bpend)
*value = "Pending Disconnect";
else
*value = "Disconnected";
return 0;
}
/*#Device.PPP.Interface.{i}.Username!UCI:network/interface,@i-1/username*/
int get_ppp_username(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_value_by_section_string(((struct uci_section *)data), "username", value);
return 0;
}
int set_ppp_username(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section(((struct uci_section *)data), "username", value);
return 0;
}
return 0;
}
/*#Device.PPP.Interface.{i}.Password!UCI:network/interface,@i-1/password*/
int set_ppp_password(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
dmuci_set_value_by_section(((struct uci_section *)data), "password", value);
return 0;
}
return 0;
}
inline int ubus_get_wan_stats(void *data, char *instance, json_object *res, char **value, char *stat_mod)
{
char *ifname, *proto;
dmuci_get_value_by_section_string(((struct uci_section *)data), "ifname", &ifname);
dmuci_get_value_by_section_string(((struct uci_section *)data), "proto", &proto);
if (strcmp(proto, "pppoe") == 0) {
dmubus_call("network.device", "status", UBUS_ARGS{{"name", ifname, String}}, 1, &res);
DM_ASSERT(res, *value = "");
*value = dmjson_get_value(res, 2, "statistics", stat_mod);
}
return 0;
}
/*#Device.PPP.Interface.{i}.Stats.BytesReceived!UBUS:network.device/status/name,@Name/statistics.rx_bytes*/
int get_ppp_eth_bytes_received(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
json_object *res;
ubus_get_wan_stats(data, instance, res, value, "rx_bytes");
return 0;
}
/*#Device.PPP.Interface.{i}.Stats.BytesSent!UBUS:network.device/status/name,@Name/statistics.tx_bytes*/
int get_ppp_eth_bytes_sent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
json_object *res;
ubus_get_wan_stats(data, instance, res, value, "tx_bytes");
return 0;
}
/*#Device.PPP.Interface.{i}.Stats.PacketsReceived!UBUS:network.device/status/name,@Name/statistics.rx_packets*/
int get_ppp_eth_pack_received(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
json_object *res;
ubus_get_wan_stats(data, instance, res, value, "rx_packets");
return 0;
}
/*#Device.PPP.Interface.{i}.Stats.PacketsSent!UBUS:network.device/status/name,@Name/statistics.tx_packets*/
int get_ppp_eth_pack_sent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
json_object *res;
ubus_get_wan_stats(data, instance, res, value, "tx_packets");
return 0;
}
int get_PPPInterfaceStats_ErrorsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
json_object *res;
ubus_get_wan_stats(data, instance, res, value, "tx_errors");
return 0;
}
int get_PPPInterfaceStats_ErrorsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
json_object *res;
ubus_get_wan_stats(data, instance, res, value, "rx_errors");
return 0;
}
int get_PPPInterfaceStats_UnicastPacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = "0";
char *device = get_device(section_name((struct uci_section *)data));
if(device[0] != '\0')
dmasprintf(value, "%d", get_stats_from_ifconfig_command(device, "TX", "unicast"));
return 0;
}
int get_PPPInterfaceStats_UnicastPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = "0";
char *device = get_device(section_name((struct uci_section *)data));
if(device[0] != '\0')
dmasprintf(value, "%d", get_stats_from_ifconfig_command(device, "RX", "unicast"));
return 0;
}
int get_PPPInterfaceStats_DiscardPacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
json_object *res;
ubus_get_wan_stats(data, instance, res, value, "tx_dropped");
return 0;
}
int get_PPPInterfaceStats_DiscardPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
json_object *res;
ubus_get_wan_stats(data, instance, res, value, "rx_dropped");
return 0;
}
int get_PPPInterfaceStats_MulticastPacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = "0";
char *device = get_device(section_name((struct uci_section *)data));
if(device[0] != '\0')
dmasprintf(value, "%d", get_stats_from_ifconfig_command(device, "TX", "multicast"));
return 0;
}
int get_PPPInterfaceStats_MulticastPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = "0";
char *device = get_device(section_name((struct uci_section *)data));
if(device[0] != '\0')
dmasprintf(value, "%d", get_stats_from_ifconfig_command(device, "RX", "multicast"));
return 0;
}
int get_PPPInterfaceStats_BroadcastPacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = "0";
char *device = get_device(section_name((struct uci_section *)data));
if(device[0] != '\0')
dmasprintf(value, "%d", get_stats_from_ifconfig_command(device, "TX", "broadcast"));
return 0;
}
int get_PPPInterfaceStats_BroadcastPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = "0";
char *device = get_device(section_name((struct uci_section *)data));
if(device[0] != '\0')
dmasprintf(value, "%d", get_stats_from_ifconfig_command(device, "RX", "broadcast"));
return 0;
}
int get_PPPInterfaceStats_UnknownProtoPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
json_object *res;
ubus_get_wan_stats(data, instance, res, value, "rx_over_errors");
return 0;
}
int get_ppp_lower_layer(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char *linker;
dmuci_get_value_by_section_string(((struct uci_section *)data), "ifname", &linker);
adm_entry_get_linker_param(ctx, dm_print_path("%s%cATM%cLink%c", dmroot, dm_delim, dm_delim, dm_delim), linker, value);
if (*value == NULL) {
adm_entry_get_linker_param(ctx, dm_print_path("%s%cPTM%cLink%c", dmroot, dm_delim, dm_delim, dm_delim), linker, value);
}
if (*value == NULL) {
adm_entry_get_linker_param(ctx, dm_print_path("%s%cEthernet%cInterface%c", dmroot, dm_delim, dm_delim, dm_delim), linker, value);
}
if (*value == NULL) {
adm_entry_get_linker_param(ctx, dm_print_path("%s%cWiFi%cSSID%c", dmroot, dm_delim, dm_delim, dm_delim), linker, value);
}
if (*value == NULL)
*value = "";
return 0;
}
int set_ppp_lower_layer(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
char *linker;
char *newvalue= NULL;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
if (value[strlen(value)-1]!='.') {
dmasprintf(&newvalue, "%s.", value);
adm_entry_get_linker_value(ctx, newvalue, &linker);
} else
adm_entry_get_linker_value(ctx, value, &linker);
if(linker) dmuci_set_value_by_section(((struct uci_section *)data), "ifname", linker);
else return FAULT_9005;
return 0;
}
return 0;
}
int get_PPP_InterfaceNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *s;
char *proto;
int nbre= 0;
uci_foreach_sections("network", "interface", s) {
dmuci_get_value_by_section_string(s, "proto", &proto);
if (!strstr(proto, "ppp"))
continue;
nbre++;
}
dmasprintf(value, "%d", nbre);
return 0;
}
int get_PPPInterfacePPPoE_SessionID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
//TODO
return 0;
}
int get_PPPInterfacePPPoE_ACName(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char *proto;
dmuci_get_value_by_section_string(((struct uci_section *)data), "proto", &proto);
if (strcmp(proto, "pppoe") == 0) {
dmuci_get_value_by_section_string(((struct uci_section *)data), "ac", value);
return 0;
}
*value= "";
return 0;
}
int set_PPPInterfacePPPoE_ACName(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
char *proto;
switch (action) {
case VALUECHECK:
dmuci_get_value_by_section_string(((struct uci_section *)data), "proto", &proto);
if (strcmp(proto, "pppoe") == 0)
return 0;
return FAULT_9001;
break;
case VALUESET:
dmuci_set_value_by_section(((struct uci_section *)data), "ac", value);
break;
}
return 0;
}
int get_PPPInterfacePPPoE_ServiceName(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char *proto;
dmuci_get_value_by_section_string(((struct uci_section *)data), "proto", &proto);
if (strcmp(proto, "pppoe") == 0) {
dmuci_get_value_by_section_string(((struct uci_section *)data), "service", value);
return 0;
}
*value= "";
return 0;
}
int set_PPPInterfacePPPoE_ServiceName(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
char *proto;
switch (action) {
case VALUECHECK:
dmuci_get_value_by_section_string(((struct uci_section *)data), "proto", &proto);
if (strcmp(proto, "pppoe") == 0)
return 0;
return FAULT_9001;
break;
case VALUESET:
dmuci_set_value_by_section(((struct uci_section *)data), "service", value);
break;
}
return 0;
}
/**************************************************************************
* LINKER
***************************************************************************/
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)));
return 0;
}
*linker = "";
return 0;
}
/*************************************************************
* ADD DEL OBJ
/*************************************************************/
int add_ppp_interface(char *refparam, struct dmctx *ctx, void *data, char **instance)
{
char name[16] = {0};
char *inst, *v;
struct uci_section *s = NULL;
struct uci_section *dmmap_ppp = NULL;
check_create_dmmap_package("dmmap_network");
inst = get_last_instance_lev2_icwmpd("network", "interface", "dmmap_network", "ppp_int_instance", "proto", "ppp");
sprintf(name, "ppp_%d", inst ? (atoi(inst)+1) : 1);
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_add_section_icwmpd("dmmap_network", "interface", &dmmap_ppp, &v);
dmuci_set_value_by_section(dmmap_ppp, "section_name", name);
*instance = update_instance_icwmpd(dmmap_ppp, inst, "ppp_int_instance");
return 0;
}
int delete_ppp_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action)
{
int found = 0;
struct uci_section *ppp_s = NULL;
struct uci_section *ss = NULL, *dmmap_section = NULL;
switch (del_action) {
case DEL_INST:
get_dmmap_section_of_config_section("dmmap_network", "interface", section_name(((struct uci_section *)data)), &dmmap_section);
if(dmmap_section != NULL)
dmuci_delete_by_section(dmmap_section, NULL, NULL);
dmuci_delete_by_section(((struct uci_section *)data), NULL, NULL);
break;
case DEL_ALL:
uci_foreach_option_eq("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 != NULL)
dmuci_delete_by_section(dmmap_section, NULL, NULL);
dmuci_delete_by_section(ss, NULL, NULL);
}
ss = ppp_s;
found++;
}
if (ss != NULL) {
get_dmmap_section_of_config_section("dmmap_network", "interface", section_name(ss), &dmmap_section);
if(dmmap_section != NULL)
dmuci_delete_by_section(dmmap_section, NULL, NULL);
dmuci_delete_by_section(ss, NULL, NULL);
}
return 0;
}
return 0;
}
/*************************************************************
* ENTRY METHOD
/*************************************************************/
/*#Device.PPP.Interface.{i}.!UCI:network/interface/dmmap_network*/
int browseInterfaceInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
struct uci_section *net_sec = NULL;
char *ppp_int = NULL, *ppp_int_last = NULL;
char *proto;
struct dmmap_dup *p;
LIST_HEAD(dup_list);
synchronize_specific_config_sections_with_dmmap("network", "interface", "dmmap_network", &dup_list);
list_for_each_entry(p, &dup_list, list) {
dmuci_get_value_by_section_string(p->config_section, "proto", &proto);
if (!strstr(proto, "ppp"))
continue;
ppp_int = handle_update_instance(1, dmctx, &ppp_int_last, update_instance_alias, 3, p->dmmap_section, "ppp_int_instance", "ppp_int_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, ppp_int) == DM_STOP)
break;
}
free_dmmap_config_dup_list(&dup_list);
return 0;
}

View file

@ -1,67 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2016 Inteno Broadband Technology AB
* Author: Anis Ellouze <anis.ellouze@pivasoftware.com>
*
*/
#ifndef __PPP_H
#define __PPP_H
extern DMLEAF tpppInterfaceParam[];
extern DMLEAF tStatsParam[];
extern DMOBJ tpppInterfaceObj[];
extern DMOBJ tpppObj[];
extern DMLEAF tPPPParams[];
DMLEAF tPPPInterfacePPPoEParams[];
int browseInterfaceInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int get_ppp_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_ppp_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_ppp_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_ppp_lower_layer(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_ppp_status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_ppp_username(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_ppp_eth_bytes_received(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_ppp_eth_bytes_sent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_ppp_eth_pack_received(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_ppp_eth_pack_sent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_PPPInterfaceStats_ErrorsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_PPPInterfaceStats_ErrorsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_PPPInterfaceStats_UnicastPacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_PPPInterfaceStats_UnicastPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_PPPInterfaceStats_DiscardPacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_PPPInterfaceStats_DiscardPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_PPPInterfaceStats_MulticastPacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_PPPInterfaceStats_MulticastPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_PPPInterfaceStats_BroadcastPacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_PPPInterfaceStats_BroadcastPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_PPPInterfaceStats_UnknownProtoPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_ppp_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_ppp_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_ppp_lower_layer(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_ppp_username(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int set_ppp_password(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_linker_ppp_interface(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker);
int get_PPP_InterfaceNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_PPPInterface_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_PPPInterface_LastChange(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_PPPInterface_Reset(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_PPPInterface_Reset(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int add_ppp_interface(char *refparam, struct dmctx *ctx, void *data, char **instance);
int delete_ppp_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
int get_PPPInterfacePPPoE_SessionID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_PPPInterfacePPPoE_ACName(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_PPPInterfacePPPoE_ACName(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_PPPInterfacePPPoE_ServiceName(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_PPPInterfacePPPoE_ServiceName(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
#endif

File diff suppressed because it is too large Load diff

View file

@ -1,403 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2019 iopsys Software Solutions AB
* Author: Omar Kallel <omar.kallel@pivasoftware.com>
*/
#ifndef __QOS_H
#define __QOS_H
extern DMOBJ tQoSObj[];
extern DMLEAF tQoSParams[];
extern DMLEAF tQoSClassificationParams[];
extern DMLEAF tQoSAppParams[];
extern DMLEAF tQoSFlowParams[];
extern DMLEAF tQoSPolicerParams[];
extern DMLEAF tQoSQueueParams[];
extern DMLEAF tQoSQueueStatsParams[];
extern DMLEAF tQoSShaperParams[];
#define queuessts1 "^qdisc noqueue [0-9]*: dev [[:alnum:]]* [[:alnum:]]* refcnt [0-9]*"
#define queuessts2 "^qdisc pfifo_fast [0-9]*: dev [[:alnum:]]* [[:alnum:]]* refcnt [0-9]*"
//#define queuessts3 "^[ ]*Sent [0-9]* bytes [0-9]* pkt (dropped [0-9]*, overlimits [0-9]* requeues [0-9]*)"
//#define queuessts4 "^[ ]*backlog [0-9]*b [0-9]*p requeues [0-9]*"
struct queuestats {
struct uci_section *dmsect;
char dev[50];
char user[50];
char priomap[50];
int noqueue;
int pfifo_fast;
int refcnt;
int bands;
int bytes_sent;
int pkt_sent;
int pkt_dropped;
int pkt_overlimits;
int pkt_requeues;
int backlog_b;
int backlog_p;
int backlog_requeues;
};
int get_linker_qos_queue(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker);
int browseQoSClassificationInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseQoSAppInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseQoSFlowInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseQoSPolicerInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseQoSQueueInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseQoSQueueStatsInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseQoSShaperInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int addObjQoSClassification(char *refparam, struct dmctx *ctx, void *data, char **instance);
int delObjQoSClassification(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
int addObjQoSApp(char *refparam, struct dmctx *ctx, void *data, char **instance);
int delObjQoSApp(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
int addObjQoSFlow(char *refparam, struct dmctx *ctx, void *data, char **instance);
int delObjQoSFlow(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
int addObjQoSPolicer(char *refparam, struct dmctx *ctx, void *data, char **instance);
int delObjQoSPolicer(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
int addObjQoSQueue(char *refparam, struct dmctx *ctx, void *data, char **instance);
int delObjQoSQueue(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
int addObjQoSQueueStats(char *refparam, struct dmctx *ctx, void *data, char **instance);
int delObjQoSQueueStats(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
int addObjQoSShaper(char *refparam, struct dmctx *ctx, void *data, char **instance);
int delObjQoSShaper(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action);
int get_QoS_MaxClassificationEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_QoS_ClassificationNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_QoS_MaxAppEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_QoS_AppNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_QoS_MaxFlowEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_QoS_FlowNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_QoS_MaxPolicerEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_QoS_PolicerNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_QoS_MaxQueueEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_QoS_QueueNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_QoS_QueueStatsNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_QoS_MaxShaperEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_QoS_ShaperNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_QoS_DefaultForwardingPolicy(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoS_DefaultForwardingPolicy(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoS_DefaultTrafficClass(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoS_DefaultTrafficClass(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoS_DefaultPolicer(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoS_DefaultPolicer(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoS_DefaultQueue(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoS_DefaultQueue(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoS_DefaultDSCPMark(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoS_DefaultDSCPMark(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoS_DefaultEthernetPriorityMark(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoS_DefaultEthernetPriorityMark(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoS_DefaultInnerEthernetPriorityMark(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoS_DefaultInnerEthernetPriorityMark(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoS_AvailableAppList(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_QoSClassification_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_QoSClassification_Order(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_Order(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_DHCPType(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_DHCPType(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_AllInterfaces(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_AllInterfaces(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_DestIP(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_DestIP(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_DestMask(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_DestMask(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_DestIPExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_DestIPExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_SourceIP(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_SourceIP(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_SourceMask(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_SourceMask(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_SourceIPExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_SourceIPExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_Protocol(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_Protocol(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_ProtocolExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_ProtocolExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_DestPort(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_DestPort(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_DestPortRangeMax(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_DestPortRangeMax(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_DestPortExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_DestPortExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_SourcePort(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_SourcePort(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_SourcePortRangeMax(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_SourcePortRangeMax(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_SourcePortExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_SourcePortExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_SourceMACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_SourceMACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_SourceMACMask(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_SourceMACMask(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_SourceMACExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_SourceMACExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_DestMACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_DestMACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_DestMACMask(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_DestMACMask(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_DestMACExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_DestMACExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_Ethertype(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_Ethertype(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_EthertypeExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_EthertypeExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_SSAP(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_SSAP(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_SSAPExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_SSAPExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_DSAP(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_DSAP(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_DSAPExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_DSAPExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_LLCControl(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_LLCControl(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_LLCControlExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_LLCControlExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_SNAPOUI(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_SNAPOUI(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_SNAPOUIExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_SNAPOUIExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_SourceVendorClassID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_SourceVendorClassID(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_SourceVendorClassIDv6(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_SourceVendorClassIDv6(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_SourceVendorClassIDExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_SourceVendorClassIDExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_SourceVendorClassIDMode(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_SourceVendorClassIDMode(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_DestVendorClassID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_DestVendorClassID(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_DestVendorClassIDv6(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_DestVendorClassIDv6(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_DestVendorClassIDExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_DestVendorClassIDExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_DestVendorClassIDMode(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_DestVendorClassIDMode(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_SourceClientID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_SourceClientID(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_SourceClientIDExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_SourceClientIDExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_DestClientID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_DestClientID(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_DestClientIDExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_DestClientIDExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_SourceUserClassID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_SourceUserClassID(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_SourceUserClassIDExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_SourceUserClassIDExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_DestUserClassID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_DestUserClassID(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_DestUserClassIDExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_DestUserClassIDExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_SourceVendorSpecificInfo(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_SourceVendorSpecificInfo(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_SourceVendorSpecificInfoExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_SourceVendorSpecificInfoExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_SourceVendorSpecificInfoEnterprise(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_SourceVendorSpecificInfoEnterprise(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_SourceVendorSpecificInfoSubOption(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_SourceVendorSpecificInfoSubOption(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_DestVendorSpecificInfo(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_DestVendorSpecificInfo(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_DestVendorSpecificInfoExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_DestVendorSpecificInfoExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_DestVendorSpecificInfoEnterprise(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_DestVendorSpecificInfoEnterprise(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_DestVendorSpecificInfoSubOption(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_DestVendorSpecificInfoSubOption(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_TCPACK(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_TCPACK(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_TCPACKExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_TCPACKExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_IPLengthMin(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_IPLengthMin(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_IPLengthMax(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_IPLengthMax(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_IPLengthExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_IPLengthExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_DSCPCheck(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_DSCPCheck(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_DSCPExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_DSCPExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_DSCPMark(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_DSCPMark(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_EthernetPriorityCheck(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_EthernetPriorityCheck(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_EthernetPriorityExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_EthernetPriorityExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_EthernetPriorityMark(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_EthernetPriorityMark(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_InnerEthernetPriorityCheck(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_InnerEthernetPriorityCheck(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_InnerEthernetPriorityExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_InnerEthernetPriorityExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_InnerEthernetPriorityMark(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_InnerEthernetPriorityMark(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_EthernetDEICheck(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_EthernetDEICheck(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_EthernetDEIExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_EthernetDEIExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_VLANIDCheck(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_VLANIDCheck(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_VLANIDExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_VLANIDExclude(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_OutOfBandInfo(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_OutOfBandInfo(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_ForwardingPolicy(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_ForwardingPolicy(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_TrafficClass(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_TrafficClass(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_Policer(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_Policer(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSClassification_App(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSClassification_App(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSApp_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSApp_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSApp_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_QoSApp_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSApp_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSApp_ProtocolIdentifier(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSApp_ProtocolIdentifier(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSApp_Name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSApp_Name(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSApp_DefaultForwardingPolicy(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSApp_DefaultForwardingPolicy(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSApp_DefaultTrafficClass(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSApp_DefaultTrafficClass(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSApp_DefaultPolicer(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSApp_DefaultPolicer(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSApp_DefaultDSCPMark(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSApp_DefaultDSCPMark(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSApp_DefaultEthernetPriorityMark(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSApp_DefaultEthernetPriorityMark(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSApp_DefaultInnerEthernetPriorityMark(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSApp_DefaultInnerEthernetPriorityMark(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSFlow_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSFlow_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSFlow_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_QoSFlow_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSFlow_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSFlow_Type(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSFlow_Type(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSFlow_TypeParameters(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSFlow_TypeParameters(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSFlow_Name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSFlow_Name(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSFlow_App(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSFlow_App(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSFlow_ForwardingPolicy(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSFlow_ForwardingPolicy(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSFlow_TrafficClass(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSFlow_TrafficClass(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSFlow_Policer(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSFlow_Policer(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSFlow_DSCPMark(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSFlow_DSCPMark(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSFlow_EthernetPriorityMark(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSFlow_EthernetPriorityMark(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSFlow_InnerEthernetPriorityMark(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSFlow_InnerEthernetPriorityMark(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSPolicer_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSPolicer_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSPolicer_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_QoSPolicer_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSPolicer_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSPolicer_CommittedRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSPolicer_CommittedRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSPolicer_CommittedBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSPolicer_CommittedBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSPolicer_ExcessBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSPolicer_ExcessBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSPolicer_PeakRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSPolicer_PeakRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSPolicer_PeakBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSPolicer_PeakBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSPolicer_MeterType(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSPolicer_MeterType(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSPolicer_PossibleMeterTypes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_QoSPolicer_ConformingAction(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSPolicer_ConformingAction(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSPolicer_PartialConformingAction(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSPolicer_PartialConformingAction(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSPolicer_NonConformingAction(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSPolicer_NonConformingAction(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSPolicer_TotalCountedPackets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_QoSPolicer_TotalCountedBytes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_QoSPolicer_ConformingCountedPackets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_QoSPolicer_ConformingCountedBytes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_QoSPolicer_PartiallyConformingCountedPackets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_QoSPolicer_PartiallyConformingCountedBytes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_QoSPolicer_NonConformingCountedPackets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_QoSPolicer_NonConformingCountedBytes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_QoSQueue_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSQueue_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSQueue_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_QoSQueue_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSQueue_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSQueue_TrafficClasses(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSQueue_TrafficClasses(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSQueue_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSQueue_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSQueue_AllInterfaces(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSQueue_AllInterfaces(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSQueue_HardwareAssisted(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_QoSQueue_BufferLength(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_QoSQueue_Weight(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSQueue_Weight(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSQueue_Precedence(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSQueue_Precedence(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSQueue_REDThreshold(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSQueue_REDThreshold(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSQueue_REDPercentage(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSQueue_REDPercentage(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSQueue_DropAlgorithm(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSQueue_DropAlgorithm(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSQueue_SchedulerAlgorithm(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSQueue_SchedulerAlgorithm(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSQueue_ShapingRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSQueue_ShapingRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSQueue_ShapingBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSQueue_ShapingBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSQueueStats_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSQueueStats_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSQueueStats_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_QoSQueueStats_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSQueueStats_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSQueueStats_Queue(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSQueueStats_Queue(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSQueueStats_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSQueueStats_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSQueueStats_OutputPackets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_QoSQueueStats_OutputBytes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_QoSQueueStats_DroppedPackets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_QoSQueueStats_DroppedBytes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_QoSQueueStats_QueueOccupancyPackets(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_QoSQueueStats_QueueOccupancyPercentage(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_QoSShaper_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSShaper_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSShaper_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_QoSShaper_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSShaper_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSShaper_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSShaper_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSShaper_ShapingRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSShaper_ShapingRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_QoSShaper_ShapingBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_QoSShaper_ShapingBurstSize(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
#endif //__QOS_H

Some files were not shown because too many files have changed in this diff Show more