freecwmp
[Top] [All Lists]

[PATCH v2 07/10] Adapt the scripts in order to support get parameter na

Subject: [PATCH v2 07/10] Adapt the scripts in order to support get parameter names
From: Mohamed <mohamed.kallel@pivasoftware.com>
Date: Thu, 27 Dec 2012 18:35:11 +0100
 Add the common function and adapt the scripts in order to support get 
parameter names Contributed by Inteno Broadband Technology AB
 Contributed by Inteno Broadband Technology AB

Signed-off-by: Mohamed Kallel <mohamed.kallel@pivasoftware.com>
Signed-off-by: Ahmed Zribi <ahmed.zribi@pivasoftware.com>
---
 ext/openwrt/scripts/freecwmp.sh                 |   46 +++
 ext/openwrt/scripts/functions/common            |    3 +
 ext/openwrt/scripts/functions/device_hosts      |    2 +
 ext/openwrt/scripts/functions/device_info       |  224 ++++++++++++--
 ext/openwrt/scripts/functions/device_ip         |    2 +
 ext/openwrt/scripts/functions/device_routing    |    2 +
 ext/openwrt/scripts/functions/device_users      |    2 +
 ext/openwrt/scripts/functions/lan_device        |  114 ++++++-
 ext/openwrt/scripts/functions/management_server |  383 ++++++++++++++++++++---
 ext/openwrt/scripts/functions/misc              |    2 +
 ext/openwrt/scripts/functions/wan_device        |  239 +++++++++++++--
 11 files changed, 923 insertions(+), 96 deletions(-)

diff --git a/ext/openwrt/scripts/freecwmp.sh b/ext/openwrt/scripts/freecwmp.sh
index b6ff68a..b2a2e40 100644
--- a/ext/openwrt/scripts/freecwmp.sh
+++ b/ext/openwrt/scripts/freecwmp.sh
@@ -1,5 +1,6 @@
 #!/bin/sh
 # Copyright (C) 2011-2012 Luka Perkov <freecwmp@lukaperkov.net>
+# Copyright (C) 2012 Ahmed Zribi <ahmed.zribi@pivasoftware.com>
 
 . /lib/functions.sh
 . /usr/share/libubox/jshn.sh
@@ -69,6 +70,10 @@ case "$1" in
                elif [ "$2" = "value" ]; then
                        __arg1="$3"
                        action="get_value"
+               elif [ "$2" = "name" ]; then
+                       __arg1="$3"
+                       __arg2="$4"
+                       action="get_name"
                elif [ "$2" = "all" ]; then
                        __arg1="$3"
                        action="get_all"
@@ -99,6 +104,7 @@ fi
 
 get_value_functions=""
 set_value_functions=""
+get_name_functions=""
 
 load_script() {
        . $1 
@@ -107,6 +113,7 @@ load_script() {
 load_function() {
        get_value_functions="$get_value_functions get_$1"
        set_value_functions="$set_value_functions set_$1"
+       get_name_functions="$get_name_functions get_$1_name"
 }
 
 handle_scripts() {
@@ -171,6 +178,45 @@ if [ "$action" = "get_value" -o "$action" = "get_all" ]; 
then
        fi
 fi
 
+if [ "$action" = "get_name" -o "$action" = "get_all" ]; then
+       if [ ${FLAGS_force} -eq ${FLAGS_FALSE} ]; then
+               __tmp_arg="Device."
+               # TODO: don't check only string length ; but this is only used
+               #       for getting correct prefix of CWMP parameter anyway and 
accepting empty string
+               if [  ${#__arg1} -lt ${#__tmp_arg} -a ${#__arg1} -ne 0 ]; then
+                       echo "CWMP parameters usualy begin with 
'InternetGatewayDevice.' or 'Device.' or ''     "
+                       echo "if you want to force script execution with 
provided parameter use '-f' flag."
+                       exit -1
+               fi
+       fi
+       freecwmp_check_fault "$__arg1"
+       fault_code="$?"
+       if [ "$fault_code" = "0" ]; then
+               if [ "$__arg2" != "0" -a "$__arg2" != "1" ]; then
+                       fault_code="$E_INVALID_ARGUMENTS"
+               fi
+               if [ "$fault_code" = "0" ]; then
+                       # TODO: don't return only 'InternetGatewayDevice.' when 
getting an empty string; but we should both
+                       #       parameters with prefix 'InternetGatewayDevice.' 
and 'Device.'
+                       if [ "$__arg1" = "InternetGatewayDevice." -o "$__arg1" 
= "" ]; then
+                               freecwmp_output "InternetGatewayDevice." "" "0"
+                               if [ "$__arg1" = "" -a "$__arg2" = "1" ]; then
+                                       exit 0
+                               fi
+                               __parm="InternetGatewayDevice."
+                       else
+                               __parm="$__arg1"
+                       fi
+                       freecwmp_execute_functions "$get_name_functions" 
"$__parm" "$__arg2"
+                       fault_code="$?"
+               fi
+       fi
+       if [ "$fault_code" != "0" ]; then
+               let fault_code=$fault_code+9000
+               freecwmp_output "$__arg1" "" "" "" "$fault_code"
+       fi
+fi
+
 if [ "$action" = "set_value" ]; then
        for function_name in $set_value_functions
        do
diff --git a/ext/openwrt/scripts/functions/common 
b/ext/openwrt/scripts/functions/common
index 7a52dc8..5cd02b3 100644
--- a/ext/openwrt/scripts/functions/common
+++ b/ext/openwrt/scripts/functions/common
@@ -61,6 +61,9 @@ freecwmp_ubus_output() {
                get_value)
                ubus ${UBUS_SOCKET:+-s $UBUS_SOCKET}  call tr069 
get_parameter_values '{ "parameter": "'$parameter'", "value": "'$value'", 
"type": "'$type'", "fault_code":"'$fault_code'" }' 2> /dev/null
                ;;
+               get_name)
+               ubus ${UBUS_SOCKET:+-s $UBUS_SOCKET}  call tr069 
get_parameter_names '{ "parameter": "'$parameter'", "writable": 
"'$permissions'", "fault_code": "'$fault_code'" }' 2> /dev/null
+               ;;
        esac
 }
 freecwmp_value_output() {
diff --git a/ext/openwrt/scripts/functions/device_hosts 
b/ext/openwrt/scripts/functions/device_hosts
index 27bfeb3..5f63c38 100644
--- a/ext/openwrt/scripts/functions/device_hosts
+++ b/ext/openwrt/scripts/functions/device_hosts
@@ -190,4 +190,6 @@ fi
 return $E_INVALID_PARAMETER_NAME
 }
 
+get_device_hosts_name() { return $E_INVALID_PARAMETER_NAME; }
+
 set_device_hosts() { return; }
diff --git a/ext/openwrt/scripts/functions/device_info 
b/ext/openwrt/scripts/functions/device_info
index 2f13cc9..3509d9d 100644
--- a/ext/openwrt/scripts/functions/device_info
+++ b/ext/openwrt/scripts/functions/device_info
@@ -1,9 +1,19 @@
 #!/bin/sh
 # Copyright (C) 2011-2012 Luka Perkov <freecwmp@lukaperkov.net>
+# Copyright (C) 2012 Ahmed Zribi <ahmed.zribi@pivasoftware.com>
 
 get_device_info_manufacturer() {
-local val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get 
freecwmp.@device[0].manufacturer 2> /dev/null`
-freecwmp_output "InternetGatewayDevice.DeviceInfo.Manufacturer" "$val"
+local val=""
+local permissions=""
+case "$action" in
+       get_value)
+       val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get 
freecwmp.@device[0].manufacturer 2> /dev/null`
+       ;;
+       get_name)
+       permissions="0"
+       ;;
+esac
+freecwmp_output "InternetGatewayDevice.DeviceInfo.Manufacturer" "$val" 
"$permissions"
 }
 
 set_device_info_manufacturer() {
@@ -11,8 +21,17 @@ set_device_info_manufacturer() {
 }
 
 get_device_info_oui() {
-local val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get 
freecwmp.@device[0].oui 2> /dev/null`
-freecwmp_output "InternetGatewayDevice.DeviceInfo.ManufacturerOUI" "$val"
+local val=""
+local permissions=""
+case "$action" in
+       get_value)
+       val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get 
freecwmp.@device[0].oui 2> /dev/null`
+       ;;
+       get_name)
+       permissions="0"
+       ;;
+esac
+freecwmp_output "InternetGatewayDevice.DeviceInfo.ManufacturerOUI" "$val" 
"$permissions"
 }
 
 set_device_info_oui() {
@@ -20,8 +39,16 @@ set_device_info_oui() {
 }
 
 get_device_info_product_class() {
-local val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get 
freecwmp.@device[0].product_class 2> /dev/null`
-freecwmp_output "InternetGatewayDevice.DeviceInfo.ProductClass" "$val"
+local val=""
+case "$action" in
+       get_value)
+       val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get 
freecwmp.@device[0].product_class 2> /dev/null`
+       ;;
+       get_name)
+       permissions="0"
+       ;;
+esac
+freecwmp_output "InternetGatewayDevice.DeviceInfo.ProductClass" "$val" 
"$permissions"
 }
 
 set_device_info_product_class() {
@@ -29,8 +56,17 @@ set_device_info_product_class() {
 }
 
 get_device_info_serial_number() {
-local val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get 
freecwmp.@device[0].serial_number 2> /dev/null`
-freecwmp_output "InternetGatewayDevice.DeviceInfo.SerialNumber" "$val"
+local val=""
+local permissions=""
+case "$action" in
+       get_value)
+       local val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get 
freecwmp.@device[0].serial_number 2> /dev/null`
+       ;;
+       get_name)
+       permissions="0"
+       ;;
+esac
+freecwmp_output "InternetGatewayDevice.DeviceInfo.SerialNumber" "$val" 
"$permissions"
 }
 
 set_device_info_serial_number() {
@@ -38,8 +74,17 @@ set_device_info_serial_number() {
 }
 
 get_device_info_hardware_version() {
-local val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get 
freecwmp.@device[0].hardware_version 2> /dev/null`
-freecwmp_output "InternetGatewayDevice.DeviceInfo.HardwareVersion" "$val"
+local val=""
+local permissions=""
+case "$action" in
+       get_value)
+       val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get 
freecwmp.@device[0].hardware_version 2> /dev/null`
+       ;;
+       get_name)
+       permissions="0"
+       ;;
+esac
+freecwmp_output "InternetGatewayDevice.DeviceInfo.HardwareVersion" "$val" 
"$permissions"
 }
 
 set_device_info_hardware_version() {
@@ -47,8 +92,17 @@ set_device_info_hardware_version() {
 }
 
 get_device_info_software_version() {
-local val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get 
freecwmp.@device[0].software_version 2> /dev/null`
-freecwmp_output "InternetGatewayDevice.DeviceInfo.SoftwareVersion" "$val"
+local val=""
+local permissions=""
+case "$action" in
+       get_value)
+       val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get 
freecwmp.@device[0].software_version 2> /dev/null`
+       ;;
+       get_name)
+       permissions="0"
+       ;;
+esac
+freecwmp_output "InternetGatewayDevice.DeviceInfo.SoftwareVersion" "$val" 
"$permissions"
 }
 
 set_device_info_software_version() {
@@ -56,18 +110,35 @@ set_device_info_software_version() {
 }
 
 get_device_info_uptime() {
-local val=`cat /proc/uptime | awk -F "." '{ print $1 }'`
-freecwmp_output "InternetGatewayDevice.DeviceInfo.UpTime" "$val"
+local val=""
+local permissions=""
+case "$action" in
+       get_value)
+       val=`cat /proc/uptime | awk -F "." '{ print $1 }'`
+       ;;
+       get_name)
+       permissions="0"
+       ;;
+esac
+freecwmp_output "InternetGatewayDevice.DeviceInfo.UpTime" "$val" "$permissions"
 }
 
 get_device_info_device_log() {
 local val=""
-if [ ${FLAGS_last} -eq ${FLAGS_TRUE} ]; then
-       val=`dmesg | tail -n1`
-else
-       val=`dmesg | tail -n10`
-fi
-freecwmp_output "InternetGatewayDevice.DeviceInfo.DeviceLog" "$val"
+local permissions=""
+case "$action" in
+       get_value)
+       if [ ${FLAGS_last} -eq ${FLAGS_TRUE} ]; then
+               val=`dmesg | tail -n1`
+       else
+               val=`dmesg | tail -n10`
+       fi
+       ;;
+       get_name)
+       permissions="0"
+       ;;
+esac
+freecwmp_output "InternetGatewayDevice.DeviceInfo.DeviceLog" "$val" 
"$permissions"
 }
 
 get_device_info() {
@@ -130,6 +201,94 @@ esac
 return $E_INVALID_PARAMETER_NAME
 }
 
+get_device_info_name() {
+case "$1" in
+       InternetGatewayDevice.)
+       freecwmp_output "InternetGatewayDevice.DeviceInfo." "" "0"
+       if [ "$2" = "0" ]; then
+               get_device_info_manufacturer
+               get_device_info_oui
+               get_device_info_product_class
+               get_device_info_serial_number
+               get_device_info_hardware_version
+               get_device_info_software_version
+               get_device_info_uptime
+               get_device_info_device_log
+       fi
+       return 0
+       ;;
+       InternetGatewayDevice.DeviceInfo.)
+       freecwmp_output "InternetGatewayDevice.DeviceInfo." "" "0"
+       get_device_info_manufacturer
+       get_device_info_oui
+       get_device_info_product_class
+       get_device_info_serial_number
+       get_device_info_hardware_version
+       get_device_info_software_version
+       get_device_info_uptime
+       get_device_info_device_log
+       return 0
+       ;;
+       InternetGatewayDevice.DeviceInfo.Manufacturer)
+       if [ "$2" = "1" ]; then
+               return $E_INVALID_ARGUMENTS
+       fi
+       get_device_info_manufacturer
+       return 0
+       ;;
+       InternetGatewayDevice.DeviceInfo.ManufacturerOUI)
+       if [ "$2" = "1" ]; then
+               return $E_INVALID_ARGUMENTS
+       fi
+       get_device_info_oui
+       return 0
+       ;;
+       InternetGatewayDevice.DeviceInfo.ProductClass)
+       if [ "$2" = "1" ]; then
+               return $E_INVALID_ARGUMENTS
+       fi
+       get_device_info_product_class
+       return 0
+       ;;
+       InternetGatewayDevice.DeviceInfo.SerialNumber)
+       if [ "$2" = "1" ]; then
+               return $E_INVALID_ARGUMENTS
+       fi
+       get_device_info_serial_number
+       return 0
+       ;;
+       InternetGatewayDevice.DeviceInfo.HardwareVersion)
+       if [ "$2" = "1" ]; then
+               return $E_INVALID_ARGUMENTS
+       fi
+       get_device_info_hardware_version
+       return 0
+       ;;
+       InternetGatewayDevice.DeviceInfo.SoftwareVersion)
+       if [ "$2" = "1" ]; then
+               return $E_INVALID_ARGUMENTS
+       fi
+       get_device_info_software_version
+       return 0
+       ;;
+       InternetGatewayDevice.DeviceInfo.UpTime)
+       if [ "$2" = "1" ]; then
+               return $E_INVALID_ARGUMENTS
+       fi
+       get_device_info_uptime
+       return 0
+       ;;
+       InternetGatewayDevice.DeviceInfo.DeviceLog)
+       if [ "$2" = "1" ]; then
+               return $E_INVALID_ARGUMENTS
+       fi
+       get_device_info_device_log
+       return 0
+       ;;
+esac
+return $E_INVALID_PARAMETER_NAME
+}
+
 set_device_info() {
 case "$1" in
        InternetGatewayDevice.DeviceInfo.Manufacturer)
@@ -179,6 +338,31 @@ get_device_info_generic() {
        return 0
 }
 
+get_device_info_generic_name() {
+       local val=""
+       local permissions=""
+       case "$1" in
+       InternetGatewayDevice.DeviceInfo.ModelName|\
+       InternetGatewayDevice.DeviceInfo.Description|\
+       InternetGatewayDevice.DeviceInfo.ModemFirmwareVersion|\
+       InternetGatewayDevice.DeviceInfo.EnabledOptions|\
+       InternetGatewayDevice.DeviceInfo.AdditionalHardwareVersion|\
+       InternetGatewayDevice.DeviceInfo.AdditionalSoftwareVersion|\
+       InternetGatewayDevice.DeviceInfo.SpecVersion|\
+       InternetGatewayDevice.DeviceInfo.FirstUseDate)
+       permissions="0"
+       freecwmp_output "$1" "" "$permissions"
+       return 0
+       ;;
+       InternetGatewayDevice.DeviceInfo.ProvisioningCode)
+       permissions="1"
+       freecwmp_output "$1" "" "$permissions"
+       return 0
+       ;;
+       esac
+return $E_INVALID_PARAMETER_NAME
+}
+
 set_device_info_generic() {
        check_parameter_device_info_generic "$1" ; _tmp=$? ; if [ "$_tmp" -eq 1 
]; then return 0; fi
 
diff --git a/ext/openwrt/scripts/functions/device_ip 
b/ext/openwrt/scripts/functions/device_ip
index ef1a368..c4fbab6 100644
--- a/ext/openwrt/scripts/functions/device_ip
+++ b/ext/openwrt/scripts/functions/device_ip
@@ -123,4 +123,6 @@ fi
 return $E_INVALID_PARAMETER_NAME;
 }
 
+get_device_ip_name() { return $E_INVALID_PARAMETER_NAME; }
+
 set_device_ip() { return; }
diff --git a/ext/openwrt/scripts/functions/device_routing 
b/ext/openwrt/scripts/functions/device_routing
index da58b1b..7e76be3 100644
--- a/ext/openwrt/scripts/functions/device_routing
+++ b/ext/openwrt/scripts/functions/device_routing
@@ -353,4 +353,6 @@ fi
 return $E_INVALID_PARAMETER_NAME
 }
 
+get_device_routing_name() { return $E_INVALID_PARAMETER_NAME; }
+
 set_device_routing() { return; }
diff --git a/ext/openwrt/scripts/functions/device_users 
b/ext/openwrt/scripts/functions/device_users
index 58e527d..1926208 100644
--- a/ext/openwrt/scripts/functions/device_users
+++ b/ext/openwrt/scripts/functions/device_users
@@ -127,4 +127,6 @@ fi
 # TODO: Device.Users.User.{i}.Language (why? look at the get value function 
for this parameter)
 }
 
+get_device_users_name() { return $E_INVALID_PARAMETER_NAME; }
+
 set_device_users() { return; }
diff --git a/ext/openwrt/scripts/functions/lan_device 
b/ext/openwrt/scripts/functions/lan_device
index 2faa3b5..1d00558 100644
--- a/ext/openwrt/scripts/functions/lan_device
+++ b/ext/openwrt/scripts/functions/lan_device
@@ -1,17 +1,29 @@
 #!/bin/sh
 # Copyright (C) 2012 Luka Perkov <freecwmp@lukaperkov.net>
+# Copyright (C) 2012 Ahmed Zribi <ahmed.zribi@pivasoftware.com>
 
 get_wlan_enable() {
 local num="$1"
 local type="xsd:boolean"
-local val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get 
wireless.@wifi-device[$num].disabled 2> /dev/null`
-let num=$num+1
-if [ "$val" = "1" ]; then
-       val="0"
-else
-       val="1"
-fi
-freecwmp_output 
"InternetGatewayDevice.LANDevice.1.WLANConfiguration.$num.Enable" "$val" "" 
"$type"
+local val=""
+local permissions=""
+case "$action" in
+       get_value)
+       val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get 
wireless.@wifi-device[$num].disabled 2> /dev/null`
+       let num=$num+1
+       if [ "$val" = "1" ]; then
+               val="0"
+       else
+               val="1"
+       fi
+       freecwmp_output 
"InternetGatewayDevice.LANDevice.1.WLANConfiguration.$num.Enable" "$val" 
"$permissions" "$type"
+       ;;
+       get_name)
+       permissions="1"
+       let num=$num+1
+       freecwmp_output 
"InternetGatewayDevice.LANDevice.1.WLANConfiguration.$num.Enable" "$val" 
"$permissions"
+       ;;
+esac
 }
 
 set_wlan_enable() {
@@ -28,9 +40,20 @@ delay_command "wifi" "wifi" "45"
 
 get_wlan_ssid() {
 local num="$1"
-local val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get 
wireless.@wifi-iface[$num].ssid 2> /dev/null`
-let num=$num+1
-freecwmp_output 
"InternetGatewayDevice.LANDevice.1.WLANConfiguration.$num.SSID" "$val"
+local val=""
+local permissions=""
+case "$action" in
+       get_value)
+       val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get 
wireless.@wifi-iface[$num].ssid 2> /dev/null`
+       let num=$num+1
+       freecwmp_output 
"InternetGatewayDevice.LANDevice.1.WLANConfiguration.$num.SSID" "$val"
+       ;;
+       get_name)
+       permissions="1"
+       let num=$num+1
+       freecwmp_output 
"InternetGatewayDevice.LANDevice.1.WLANConfiguration.$num.SSID" "$val" 
"$permissions"
+       ;;
+esac
 }
 
 set_wlan_ssid() {
@@ -79,6 +102,75 @@ esac
 return $E_INVALID_PARAMETER_NAME
 }
 
+get_lan_device_name() {
+case "$1" in
+       InternetGatewayDevice.)
+       freecwmp_output "InternetGatewayDevice.LANDevice." "" "1"
+       if [ "$2" = "0" ]; then
+               freecwmp_output "InternetGatewayDevice.LANDevice.1." "" "1"
+               freecwmp_output 
"InternetGatewayDevice.LANDevice.1.WLANConfiguration." "" "1"
+               freecwmp_output 
"InternetGatewayDevice.LANDevice.1.WLANConfiguration.1." "" "1"
+               get_wlan_enable 0
+               get_wlan_ssid 0
+       fi
+       return 0
+       ;;
+       InternetGatewayDevice.LANDevice.)
+       freecwmp_output "InternetGatewayDevice.LANDevice." "" "1"
+       freecwmp_output "InternetGatewayDevice.LANDevice.1." "" "1"
+       if [ "$2" = "0" ]; then
+               freecwmp_output 
"InternetGatewayDevice.LANDevice.1.WLANConfiguration." "" "1"
+               freecwmp_output 
"InternetGatewayDevice.LANDevice.1.WLANConfiguration.1." "" "1"
+               get_wlan_enable 0
+               get_wlan_ssid 0
+       fi
+       return 0
+       ;;
+       InternetGatewayDevice.LANDevice.1.)
+       freecwmp_output "InternetGatewayDevice.LANDevice.1." "" "1"
+       freecwmp_output "InternetGatewayDevice.LANDevice.1.WLANConfiguration." 
"" "1"
+       if [ "$2" = "0" ]; then
+               freecwmp_output 
"InternetGatewayDevice.LANDevice.1.WLANConfiguration.1." "" "1"
+               get_wlan_enable 0
+               get_wlan_ssid 0
+       fi
+       return 0
+       ;;
+       InternetGatewayDevice.LANDevice.1.WLANConfiguration.)
+       freecwmp_output "InternetGatewayDevice.LANDevice.1.WLANConfiguration." 
"" "1"
+       freecwmp_output 
"InternetGatewayDevice.LANDevice.1.WLANConfiguration.1." "" "1"
+       if [ "$2" = "0" ]; then
+               get_wlan_enable 0
+               get_wlan_ssid 0
+       fi
+       return 0
+       ;;
+       InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.)
+       freecwmp_output 
"InternetGatewayDevice.LANDevice.1.WLANConfiguration.1." "" "1"
+       if [ "$2" = "0" ]; then
+               get_wlan_enable 0
+               get_wlan_ssid 0
+       fi
+       return 0
+       ;;
+       InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.Enable)
+       if [ "$2" = "1" ]; then
+               return $E_INVALID_ARGUMENTS
+       fi
+       get_wlan_enable 0
+       return 0
+       ;;
+       InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.SSID)
+       if [ "$2" = "1" ]; then
+               return $E_INVALID_ARGUMENTS
+       fi
+       get_wlan_ssid 0
+       return 0
+       ;;
+esac
+return $E_INVALID_PARAMETER_NAME
+}
+
 set_lan_device() {
 case "$1" in
        InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.Enable)
diff --git a/ext/openwrt/scripts/functions/management_server 
b/ext/openwrt/scripts/functions/management_server
index 37a90f1..0ecdf26 100644
--- a/ext/openwrt/scripts/functions/management_server
+++ b/ext/openwrt/scripts/functions/management_server
@@ -1,16 +1,30 @@
 #!/bin/sh
 # Copyright (C) 2011-2012 Luka Perkov <freecwmp@lukaperkov.net>
+# Copyright (C) 2012 Ahmed Zribi <ahmed.zribi@pivasoftware.com>
 
 get_management_server_url() {
-local tmp=${FLAGS_value}
+local val=""
+local permissions=""
+local tmp_value=${FLAGS_value}
 FLAGS_value=${FLAGS_TRUE}
+local tmp_ubus=${FLAGS_ubus}
+FLAGS_ubus=${FLAGS_FALSE}
 local scheme=`get_management_server_x_freecwmp_org__acs_scheme`
 local hostname=`get_management_server_x_freecwmp_org__acs_hostname`
 local port=`get_management_server_x_freecwmp_org__acs_port`
 local path=`get_management_server_x_freecwmp_org__acs_path`
-FLAGS_value=$tmp
-local val=`echo $scheme://$hostname:$port$path`
-freecwmp_output "InternetGatewayDevice.ManagementServer.URL" "$val"
+FLAGS_value=$tmp_value
+FLAGS_ubus=$tmp_ubus
+local parm="InternetGatewayDevice.ManagementServer.URL"
+case "$action" in
+       get_value)
+       val=`echo $scheme://$hostname:$port$path`
+       ;;
+       get_name)
+       permissions="0"
+       ;;
+esac
+freecwmp_output "$parm" "$val" "$permissions"
 }
 
 set_management_server_url() {
@@ -44,8 +58,18 @@ ubus ${UBUS_SOCKET:+-s $UBUS_SOCKET} call tr069 inform '{ 
"event": "value_change
 }
 
 get_management_server_username() {
-local val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get 
freecwmp.@acs[0].username 2> /dev/null`
-freecwmp_output "InternetGatewayDevice.ManagementServer.Username" "$val"
+local val=""
+local permissions=""
+local parm="InternetGatewayDevice.ManagementServer.Username"
+case "$action" in
+       get_value)
+       val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get 
freecwmp.@acs[0].username 2> /dev/null`
+       ;;
+       get_name)
+       permissions="0"
+       ;;
+esac
+freecwmp_output "$parm" "$val" "$permissions"
 }
 
 set_management_server_username() {
@@ -53,8 +77,18 @@ set_management_server_username() {
 }
 
 get_management_server_password() {
-local val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get 
freecwmp.@acs[0].password 2> /dev/null`
-freecwmp_output "InternetGatewayDevice.ManagementServer.Password" "$val"
+local val=""
+local permissions=""
+local parm="InternetGatewayDevice.ManagementServer.Password"
+case "$action" in
+       get_value)
+       val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get 
freecwmp.@acs[0].password 2> /dev/null`
+       ;;
+       get_name)
+       permissions="0"
+       ;;
+esac
+freecwmp_output "$parm" "$val" "$permissions"
 }
 
 set_management_server_password() {
@@ -62,9 +96,19 @@ set_management_server_password() {
 }
 
 get_management_server_periodic_inform_enable() {
+local val=""
+local type="xsd:boolean"
 local parm="InternetGatewayDevice.ManagementServer.PeriodicInformEnable"
-freecwmp_get_parameter_value "val" "$parm"
-freecwmp_output "$parm" "$val"
+local permissions=""
+case "$action" in
+       get_value)
+       freecwmp_get_parameter_value "val" "$parm"
+       ;;
+       get_name)
+       permissions="1"
+       ;;
+esac
+freecwmp_output "$parm" "$val" "$permissions" "$type"
 }
 
 set_management_server_periodic_inform_enable() {
@@ -73,9 +117,19 @@ freecwmp_set_parameter_value "$parm" "$1"
 }
 
 get_management_server_periodic_inform_interval() {
+local val=""
+local type="xsd:unsignedInt"
 local parm="InternetGatewayDevice.ManagementServer.PeriodicInformInterval"
-freecwmp_get_parameter_value "val" "$parm"
-freecwmp_output "$parm" "$val"
+local permissions=""
+case "$action" in
+       get_value)
+       freecwmp_get_parameter_value "val" "$parm"
+       ;;
+       get_name)
+       permissions="1"
+       ;;
+esac
+freecwmp_output "$parm" "$val" "$permissions" "$type"
 }
 
 set_management_server_periodic_inform_interval() {
@@ -85,26 +139,47 @@ freecwmp_set_parameter_value "$parm" "$1"
 
 get_management_server_connection_request_url() {
 local val
-if [ -z "$default_management_server_connection_request_url" ]; then
-       local tmp=${FLAGS_value}
-       FLAGS_value=${FLAGS_TRUE}
-       local ip=`get_wan_device_mng_interface_ip`
-       local 
port=`get_management_server_x_freecwmp_org__connection_request_port`
-       FLAGS_value=$tmp
-
-       if [ -n "$ip" -a -n "$port" ]; then
-               val="http://$ip:$port/";
+local parm="InternetGatewayDevice.ManagementServer.ConnectionRequestURL"
+local permissions=""
+case "$action" in
+       get_value)
+       if [ -z "$default_management_server_connection_request_url" ]; then
+               local tmp_value=${FLAGS_value}
+               FLAGS_value=${FLAGS_TRUE}
+               local tmp_ubus=${FLAGS_ubus}
+               FLAGS_ubus=${FLAGS_FALSE}
+               local ip=`get_wan_device_mng_interface_ip`
+               local 
port=`get_management_server_x_freecwmp_org__connection_request_port`
+               FLAGS_value=$tmp_value
+               FLAGS_ubus=$tmp_ubus
+       
+               if [ -n "$ip" -a -n "$port" ]; then
+                       val="http://$ip:$port/";
+               fi
+       else
+               val=$default_management_server_connection_request_url
        fi
-else
-       val=$default_management_server_connection_request_url
-fi
-
-freecwmp_output "InternetGatewayDevice.ManagementServer.ConnectionRequestURL" 
"$val"
+       ;;
+       get_name)
+       permissions="0"
+       ;;
+esac
+freecwmp_output "$parm" "$val" "$permissions"
 }
 
 get_management_server_connection_request_username() {
-local val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get 
freecwmp.@local[0].username 2> /dev/null`
-freecwmp_value_output 
"InternetGatewayDevice.ManagementServer.ConnectionRequestUsername" "$val"
+local val=""
+local parm="InternetGatewayDevice.ManagementServer.ConnectionRequestUsername"
+local permissions=""
+case "$action" in
+       get_value)
+       val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get 
freecwmp.@local[0].username 2> /dev/null`
+       ;;
+       get_name)
+       permissions="0"
+       ;;
+esac
+freecwmp_output "$parm" "$val" "$permissions"
 }
 
 set_management_server_connection_request_username() {
@@ -112,8 +187,18 @@ set_management_server_connection_request_username() {
 }
 
 get_management_server_connection_request_password() {
-local val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get 
freecwmp.@local[0].password 2> /dev/null`
-freecwmp_value_output 
"InternetGatewayDevice.ManagementServer.ConnectionRequestPassword" "$val"
+local val=""
+local parm="InternetGatewayDevice.ManagementServer.ConnectionRequestPassword"
+local permissions=""
+case "$action" in
+       get_value)
+       val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get 
freecwmp.@local[0].password 2> /dev/null`
+       ;;
+       get_name)
+       permissions="0"
+       ;;
+esac
+freecwmp_output "$parm" "$val" "$permissions"
 }
 
 set_management_server_connection_request_password() {
@@ -123,8 +208,17 @@ set_management_server_connection_request_password() {
 # TODO: InternetGatewayDevice.ManagementServer.PeriodicInformTime
 
 get_management_server_x_freecwmp_org__acs_scheme() {
-local val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get 
freecwmp.@acs[0].scheme 2> /dev/null`
-freecwmp_output 
"InternetGatewayDevice.ManagementServer.X_freecwmp_org__ACS_Scheme" "$val"
+local val=""
+local parm="InternetGatewayDevice.ManagementServer.X_freecwmp_org__ACS_Scheme"
+case "$action" in
+       get_value)
+       val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get 
freecwmp.@acs[0].scheme 2> /dev/null`
+       ;;
+       get_name)
+       permissions="1"
+       ;;
+esac
+freecwmp_output "$parm" "$val" "$permissions"
 }
 
 set_management_server_x_freecwmp_org__acs_scheme() {
@@ -132,8 +226,18 @@ set_management_server_x_freecwmp_org__acs_scheme() {
 }
 
 get_management_server_x_freecwmp_org__acs_hostname() {
-local val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get 
freecwmp.@acs[0].hostname 2> /dev/null`
-freecwmp_output 
"InternetGatewayDevice.ManagementServer.X_freecwmp_org__ACS_Hostname" "$val"
+local val=""
+local 
parm="InternetGatewayDevice.ManagementServer.X_freecwmp_org__ACS_Hostname"
+local permissions=""
+case "$action" in
+       get_value)
+       val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get 
freecwmp.@acs[0].hostname 2> /dev/null`
+       ;;
+       get_name)
+       permissions="1"
+       ;;
+esac
+freecwmp_output "$parm" "$val" "$permissions"
 }
 
 set_management_server_x_freecwmp_org__acs_hostname() {
@@ -145,8 +249,18 @@ fi
 }
 
 get_management_server_x_freecwmp_org__acs_port() {
-local val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get 
freecwmp.@acs[0].port 2> /dev/null`
-freecwmp_output 
"InternetGatewayDevice.ManagementServer.X_freecwmp_org__ACS_Port" "$val"
+local val=""
+local parm="InternetGatewayDevice.ManagementServer.X_freecwmp_org__ACS_Port"
+local permissions=""
+case "$action" in
+       get_value)
+       val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get 
freecwmp.@acs[0].port 2> /dev/null`
+       ;;
+       get_name)
+       permissions="1"
+       ;;
+esac
+freecwmp_output "$parm" "$val" "$permissions"
 }
 
 set_management_server_x_freecwmp_org__acs_port() {
@@ -154,8 +268,18 @@ set_management_server_x_freecwmp_org__acs_port() {
 }
 
 get_management_server_x_freecwmp_org__acs_path() {
-local val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get 
freecwmp.@acs[0].path 2> /dev/null`
-freecwmp_output 
"InternetGatewayDevice.ManagementServer.X_freecwmp_org__ACS_Path" "$val"
+local val=""
+local parm="InternetGatewayDevice.ManagementServer.X_freecwmp_org__ACS_Path"
+local permissions=""
+case "$action" in
+       get_value)
+       val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get 
freecwmp.@acs[0].path 2> /dev/null`
+       ;;
+       get_name)
+       permissions="1"
+       ;;
+esac
+freecwmp_output "$parm" "$val" "$permissions"
 }
 
 set_management_server_x_freecwmp_org__acs_path() {
@@ -163,8 +287,18 @@ set_management_server_x_freecwmp_org__acs_path() {
 }
 
 get_management_server_x_freecwmp_org__connection_request_port() {
-local val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get 
freecwmp.@local[0].port 2> /dev/null`
-freecwmp_output 
"InternetGatewayDevice.ManagementServer.X_freecwmp_org__Connection_Request_Port"
 "$val"
+local val=""
+local 
parm="InternetGatewayDevice.ManagementServer.X_freecwmp_org__Connection_Request_Port"
+local permissions=""
+case "$action" in
+       get_value)
+       val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get 
freecwmp.@local[0].port 2> /dev/null`
+       ;;
+       get_name)
+       permissions="1"
+       ;;
+esac
+freecwmp_output "$parm" "$val" "$permissions"
 }
 
 set_management_server_x_freecwmp_org__connection_request_port() {
@@ -187,6 +321,7 @@ case "$1" in
        get_management_server_x_freecwmp_org__acs_port
        get_management_server_x_freecwmp_org__acs_path
        get_management_server_x_freecwmp_org__connection_request_port
+       return 0
        ;;
        InternetGatewayDevice.ManagementServer.)
        get_management_server_url
@@ -202,47 +337,202 @@ case "$1" in
        get_management_server_x_freecwmp_org__acs_port
        get_management_server_x_freecwmp_org__acs_path
        get_management_server_x_freecwmp_org__connection_request_port
+       return 0
        ;;
        InternetGatewayDevice.ManagementServer.URL)
        get_management_server_url
+       return 0
        ;;
        InternetGatewayDevice.ManagementServer.Username)
        get_management_server_username
+       return 0
        ;;
        InternetGatewayDevice.ManagementServer.Password)
        get_management_server_password
+       return 0
        ;;
        InternetGatewayDevice.ManagementServer.PeriodicInformEnable)
        get_management_server_periodic_inform_enable
+       return 0
        ;;
        InternetGatewayDevice.ManagementServer.PeriodicInformInterval)
        get_management_server_periodic_inform_interval
+       return 0
        ;;
        InternetGatewayDevice.ManagementServer.ConnectionRequestURL)
        get_management_server_connection_request_url
+       return 0
        ;;
        InternetGatewayDevice.ManagementServer.ConnectionRequestUsername)
        get_management_server_connection_request_username
+       return 0
        ;;
        InternetGatewayDevice.ManagementServer.ConnectionRequestPassword)
        get_management_server_connection_request_password
+       return 0
        ;;
        InternetGatewayDevice.ManagementServer.X_freecwmp_org__ACS_Scheme)
        get_management_server_x_freecwmp_org__acs_scheme
+       return 0
        ;;
        InternetGatewayDevice.ManagementServer.X_freecwmp_org__ACS_Hostname)
        get_management_server_x_freecwmp_org__acs_hostname
+       return 0
        ;;
        InternetGatewayDevice.ManagementServer.X_freecwmp_org__ACS_Port)
        get_management_server_x_freecwmp_org__acs_port
+       return 0
        ;;
        InternetGatewayDevice.ManagementServer.X_freecwmp_org__ACS_Path)
        get_management_server_x_freecwmp_org__acs_path
+       return 0
        ;;
        
InternetGatewayDevice.ManagementServer.X_freecwmp_org__Connection_Request_Port)
        get_management_server_x_freecwmp_org__connection_request_port
+       return 0
        ;;
 esac
+return $E_INVALID_PARAMETER_NAME
+}
+
+get_management_server_name() {
+case "$1" in
+       InternetGatewayDevice.)
+       freecwmp_output "InternetGatewayDevice.ManagementServer." "" "0"
+       if [ "$2" = "0" ]; then
+               get_management_server_url
+               get_management_server_username
+               get_management_server_password
+               get_management_server_periodic_inform_enable
+               get_management_server_periodic_inform_interval
+               get_management_server_connection_request_url
+               get_management_server_connection_request_username
+               get_management_server_connection_request_password
+               get_management_server_x_freecwmp_org__acs_scheme
+               get_management_server_x_freecwmp_org__acs_hostname
+               get_management_server_x_freecwmp_org__acs_port
+               get_management_server_x_freecwmp_org__acs_path
+               get_management_server_x_freecwmp_org__connection_request_port
+       fi
+       return 0
+       ;;
+       InternetGatewayDevice.ManagementServer.)
+       freecwmp_output "InternetGatewayDevice.ManagementServer." "" "0"
+       get_management_server_url
+       get_management_server_username
+       get_management_server_password
+       get_management_server_periodic_inform_enable
+       get_management_server_periodic_inform_interval
+       get_management_server_connection_request_url
+       get_management_server_connection_request_username
+       get_management_server_connection_request_password
+       get_management_server_x_freecwmp_org__acs_scheme
+       get_management_server_x_freecwmp_org__acs_hostname
+       get_management_server_x_freecwmp_org__acs_port
+       get_management_server_x_freecwmp_org__acs_path
+       get_management_server_x_freecwmp_org__connection_request_port
+       return 0
+       ;;
+       InternetGatewayDevice.ManagementServer.URL)
+       if [ "$2" = "1" ]; then
+               return $E_INVALID_ARGUMENTS
+       fi
+       get_management_server_url
+       return 0
+       ;;
+       InternetGatewayDevice.ManagementServer.Username)
+       if [ "$2" = "1" ]; then
+               return $E_INVALID_ARGUMENTS
+       fi
+       get_management_server_username
+       return 0
+       ;;
+       InternetGatewayDevice.ManagementServer.Password)
+       if [ "$2" = "1" ]; then
+               return $E_INVALID_ARGUMENTS
+       fi
+       get_management_server_password
+       return 0
+       ;;
+       InternetGatewayDevice.ManagementServer.PeriodicInformEnable)
+       if [ "$2" = "1" ]; then
+               return $E_INVALID_ARGUMENTS
+       fi
+       get_management_server_periodic_inform_enable
+       return 0
+       ;;
+       InternetGatewayDevice.ManagementServer.PeriodicInformInterval)
+       if [ "$2" = "1" ]; then
+               return $E_INVALID_ARGUMENTS
+       fi
+       get_management_server_periodic_inform_interval
+       return 0
+       ;;
+       InternetGatewayDevice.ManagementServer.ConnectionRequestURL)
+       if [ "$2" = "1" ]; then
+               return $E_INVALID_ARGUMENTS
+       fi
+       get_management_server_connection_request_url
+       return 0
+       ;;
+       InternetGatewayDevice.ManagementServer.ConnectionRequestUsername)
+       if [ "$2" = "1" ]; then
+               return $E_INVALID_ARGUMENTS
+       fi
+       get_management_server_connection_request_username
+       return 0
+       ;;
+       InternetGatewayDevice.ManagementServer.ConnectionRequestPassword)
+       if [ "$2" = "1" ]; then
+               return $E_INVALID_ARGUMENTS
+       fi
+       get_management_server_connection_request_password
+       return 0
+       ;;
+       InternetGatewayDevice.ManagementServer.X_freecwmp_org__ACS_Scheme)
+       if [ "$2" = "1" ]; then
+               return $E_INVALID_ARGUMENTS
+       fi
+       get_management_server_x_freecwmp_org__acs_scheme
+       return 0
+       ;;
+       InternetGatewayDevice.ManagementServer.X_freecwmp_org__ACS_Hostname)
+       if [ "$2" = "1" ]; then
+               return $E_INVALID_ARGUMENTS
+       fi
+       get_management_server_x_freecwmp_org__acs_hostname
+       return 0
+       ;;
+       InternetGatewayDevice.ManagementServer.X_freecwmp_org__ACS_Port)
+       if [ "$2" = "1" ]; then
+               return $E_INVALID_ARGUMENTS
+       fi
+       get_management_server_x_freecwmp_org__acs_port
+       return 0
+       ;;
+       InternetGatewayDevice.ManagementServer.X_freecwmp_org__ACS_Path)
+       if [ "$2" = "1" ]; then
+               return $E_INVALID_ARGUMENTS
+       fi
+       get_management_server_x_freecwmp_org__acs_path
+       return 0
+       ;;
+       
InternetGatewayDevice.ManagementServer.X_freecwmp_org__Connection_Request_Port)
+       if [ "$2" = "1" ]; then
+               return $E_INVALID_ARGUMENTS
+       fi
+       get_management_server_x_freecwmp_org__connection_request_port
+       return 0
+       ;;
+       InternetGatewayDevice.ManagementServer.ParameterKey)
+       if [ "$2" = "1" ]; then
+               return $E_INVALID_ARGUMENTS
+       fi
+       get_management_server_parameter_key
+       return 0
+       ;;
+esac
+return $E_INVALID_PARAMETER_NAME
 }
 
 set_management_server() {
@@ -300,10 +590,19 @@ return 1
 }
 
 get_management_server_generic() {
-       check_parameter_management_server_generic "$1" ; _tmp=$? ; if [ "$_tmp" 
-eq 1 ]; then return 0; fi
+       check_parameter_management_server_generic "$1" ; _tmp=$? ; if [ "$_tmp" 
-eq 1 ]; then return $E_INVALID_PARAMETER_NAME; fi
 
        freecwmp_get_parameter_value "val" "$1"
-       freecwmp_value_output "$1" "$val"
+       freecwmp_output "$1" "$val"
+       return 0
+}
+
+get_management_server_generic_name() {
+       check_parameter_management_server_generic "$1" ; _tmp=$? ; if [ "$_tmp" 
-eq 1 ]; then return $E_INVALID_PARAMETER_NAME; fi
+
+       local permissions="1"
+       freecwmp_output "$1" "" "$permissions"
+       return 0
 }
 
 set_management_server_generic() {
diff --git a/ext/openwrt/scripts/functions/misc 
b/ext/openwrt/scripts/functions/misc
index 5c923ec..bf48308 100644
--- a/ext/openwrt/scripts/functions/misc
+++ b/ext/openwrt/scripts/functions/misc
@@ -27,4 +27,6 @@ esac
 return $E_INVALID_PARAMETER_NAME
 }
 
+get_misc_name () { return $E_INVALID_PARAMETER_NAME; }
+
 set_misc() { return; }
diff --git a/ext/openwrt/scripts/functions/wan_device 
b/ext/openwrt/scripts/functions/wan_device
index 12d36e2..b3b456b 100644
--- a/ext/openwrt/scripts/functions/wan_device
+++ b/ext/openwrt/scripts/functions/wan_device
@@ -1,39 +1,82 @@
 #!/bin/sh
 # Copyright (C) 2011-2012 Luka Perkov <freecwmp@lukaperkov.net>
+# Copyright (C) 2012 Ahmed Zribi <ahmed.zribi@pivasoftware.com>
 
 get_wan_device_mng_status() {
 # TODO: Unconfigured ; Connecting ; Connected ; PendingDisconnect ; 
Disconneting ; Disconnected 
-local val="Connected"
+local val=""
 local type="xsd:boolean"
-freecwmp_output 
"InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.ConnectionStatus"
 "$val" "" "$type"
+local 
parm="InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.ConnectionStatus"
+local permissions=""
+case "$action" in
+       get_value)
+       val="Connected"
+       ;;
+       get_name)
+       permissions="0"
+       ;;
+esac
+freecwmp_output "$parm" "$val" "$permissions" "$type"
 }
 
 get_wan_device_mng_interface_ip() {
-local val
-if [ -z "$default_wan_device_mng_interface_ip" ]; then
-       network_get_ipaddr val mng
-else
-       val=$default_wan_device_mng_interface_ip
-fi
-freecwmp_output 
"InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.ExternalIPAddress"
 "$val"
+local val=""
+local 
parm="InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.ExternalIPAddress"
+local permissions=""
+case "$action" in
+       get_value)
+       if [ -z "$default_wan_device_mng_interface_ip" ]; then
+               network_get_ipaddr val mng
+       else
+               val=$default_wan_device_mng_interface_ip
+       fi
+       ;;
+       get_name)
+       permissions="0"
+       ;;
+esac
+freecwmp_output "$parm" "$val" "$permissions"
 }
 
 get_wan_device_mng_interface_mac() {
-if [ -z "$default_wan_device_mng_interface_mac" ]; then
-       val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get 
network.mng.macaddr`
-else
-       val=$default_wan_device_mng_interface_mac
-fi
-freecwmp_output 
"InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.MACAddress"
 "$val"
+local val=""
+local 
parm="InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.MACAddress"
+local permissions=""
+case "$action" in
+       get_value)
+       if [ -z "$default_wan_device_mng_interface_mac" ]; then
+               val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get 
network.mng.macaddr`
+       else
+               val=$default_wan_device_mng_interface_mac
+       fi
+       ;;
+       get_name)
+       permissions="0"
+       ;;
+esac
+freecwmp_output "$parm" "$val" "$permissions"
 }
 
 get_wan_device_wan_ppp_enable() {
-local val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get 
network.wan.auto 2> /dev/null`
+local val=""
 local type="xsd:boolean"
-if [ -z $val ]; then
-       val="1"
-fi
-freecwmp_output 
"InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANPPPConnection.1.Enable"
 "$val" "" "$type"
+local 
parm="InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANPPPConnection.1.Enable"
+local permissions=""
+case "$action" in
+       get_value)
+       val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get 
network.wan.auto 2> /dev/null`
+       if [ -z $val ]; then
+               val="1"
+       fi
+       ;;
+       get_name)
+       permissions="1"
+       ;;
+       get_notification)
+       freecwmp_get_parameter_notification "val" "$parm"
+       ;;
+esac
+freecwmp_output "$parm" "$val" "$permissions" "$type"
 }
 
 set_wan_device_wan_ppp_enable() {
@@ -48,8 +91,18 @@ fi
 }
 
 get_wan_device_wan_ppp_username() {
-local val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get 
network.wan.username 2> /dev/null`
-freecwmp_output 
"InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANPPPConnection.1.Username"
 "$val"
+local val=""
+local 
parm="InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANPPPConnection.1.Username"
+local permissions=""
+case "$action" in
+       get_value)
+       val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get 
network.wan.username 2> /dev/null`
+       ;;
+       get_name)
+       permissions="1"
+       ;;
+esac
+freecwmp_output "$parm" "$val" "$permissions"
 }
 
 set_wan_device_wan_ppp_username() {
@@ -57,7 +110,18 @@ set_wan_device_wan_ppp_username() {
 }
 
 get_wan_device_wan_ppp_password() {
-freecwmp_output 
"InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANPPPConnection.1.Password"
 ""
+local val=""
+local 
parm="InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANPPPConnection.1.Password"
+local permissions=""
+case "$action" in
+       get_value)
+       val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get 
network.wan.password 2> /dev/null`
+       ;;
+       get_name)
+       permissions="1"
+       ;;
+esac
+freecwmp_output "$parm" "$val" "$permissions"
 }
 
 set_wan_device_wan_ppp_password() {
@@ -151,6 +215,135 @@ esac
 return $E_INVALID_PARAMETER_NAME
 }
 
+get_wan_device_name() {
+case "$1" in
+       InternetGatewayDevice.)
+       freecwmp_output "InternetGatewayDevice.WANDevice." "" "1"
+       if [ "$2" = "0" ]; then
+               get_wan_device_mng_status
+               get_wan_device_mng_interface_ip
+               get_wan_device_mng_interface_mac
+               get_wan_device_wan_ppp_enable
+               get_wan_device_wan_ppp_username
+               get_wan_device_wan_ppp_password
+       fi
+       return 0
+       ;;
+       InternetGatewayDevice.WANDevice.)
+       freecwmp_output "InternetGatewayDevice.WANDevice." "" "1"
+       freecwmp_output "InternetGatewayDevice.WANDevice.1." "" "1"
+       if [ "$2" = "0" ]; then
+       get_wan_device_mng_status
+       get_wan_device_mng_interface_ip
+       get_wan_device_mng_interface_mac
+       get_wan_device_wan_ppp_enable
+       get_wan_device_wan_ppp_username
+       get_wan_device_wan_ppp_password
+       fi
+       return 0
+       ;;
+       InternetGatewayDevice.WANDevice.1.)
+       freecwmp_output "InternetGatewayDevice.WANDevice.1." "" "1"
+       freecwmp_output 
"InternetGatewayDevice.WANDevice.1.WANConnectionDevice." "" "1"
+       if [ "$2" = "0" ]; then
+       get_wan_device_mng_status
+       get_wan_device_mng_interface_ip
+       get_wan_device_mng_interface_mac
+       get_wan_device_wan_ppp_enable
+       get_wan_device_wan_ppp_username
+       get_wan_device_wan_ppp_password
+       fi
+       return 0
+       ;;
+       InternetGatewayDevice.WANDevice.1.WANConnectionDevice.)
+       freecwmp_output 
"InternetGatewayDevice.WANDevice.1.WANConnectionDevice." "" "1"
+       freecwmp_output 
"InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1." "" "1"
+       if [ "$2" = "0" ]; then
+       get_wan_device_mng_status
+       get_wan_device_mng_interface_ip
+       get_wan_device_mng_interface_mac
+       get_wan_device_wan_ppp_enable
+       get_wan_device_wan_ppp_username
+       get_wan_device_wan_ppp_password
+       fi
+       return 0
+       ;;
+       InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.)
+       freecwmp_output 
"InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1." "1"
+       freecwmp_output 
"InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection." "" 
"1"
+       if [ "$2" = "0" ]; then
+       get_wan_device_mng_status
+       get_wan_device_mng_interface_ip
+       get_wan_device_mng_interface_mac
+       get_wan_device_wan_ppp_enable
+       get_wan_device_wan_ppp_username
+       get_wan_device_wan_ppp_password
+       fi
+       return 0
+       ;;
+       
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.)
+       freecwmp_output 
"InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection." "" 
"1"
+       freecwmp_output 
"InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1." "" 
"1"
+       if [ "$2" = "0" ]; then
+       get_wan_device_mng_status
+       get_wan_device_mng_interface_ip
+       get_wan_device_mng_interface_mac
+       fi
+       return 0
+       ;;
+       
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.)
+       freecwmp_output 
"InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1." "" 
"1"
+       get_wan_device_mng_status
+       get_wan_device_mng_interface_ip
+       get_wan_device_mng_interface_mac
+       return 0
+       ;;
+       
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.ConnectionStatus)
+       if [ "$2" = "1" ]; then
+               return $E_INVALID_ARGUMENTS
+       fi
+       get_wan_device_mng_status
+       return 0
+       ;;
+       
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.ExternalIPAddress)
+       if [ "$2" = "1" ]; then
+               return $E_INVALID_ARGUMENTS
+       fi
+       get_wan_device_mng_interface_ip
+       return 0
+       ;;
+       
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.MACAddress)
+       if [ "$2" = "1" ]; then
+               return $E_INVALID_ARGUMENTS
+       fi
+       get_wan_device_mng_interface_mac
+       return 0
+       ;;
+       
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANPPPConnection.1.Enable)
+       if [ "$2" = "1" ]; then
+               return $E_INVALID_ARGUMENTS
+       fi
+       get_wan_device_wan_ppp_enable
+       return 0
+       ;;
+       
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANPPPConnection.1.Username)
+       if [ "$2" = "1" ]; then
+               return $E_INVALID_ARGUMENTS
+       fi
+       get_wan_device_wan_ppp_username
+       return 0
+       ;;
+       
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANPPPConnection.1.Password)
+       if [ "$2" = "1" ]; then
+               return $E_INVALID_ARGUMENTS
+       fi
+       get_wan_device_wan_ppp_password
+       return 0
+       ;;
+esac
+return $E_INVALID_PARAMETER_NAME
+}
+
 set_wan_device() {
 case "$1" in
        
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANPPPConnection.1.Enable)
-- 
1.7.4.1


--------------050008050603080005000105--

<Prev in Thread] Current Thread [Next in Thread>
  • [PATCH v2 07/10] Adapt the scripts in order to support get parameter names, Mohamed <=