icwmp/scripts/functions/upnp
Imen Bhiri 8d2e42416e * Bugg #6034: Optimization of the build of the cache - Part1 (add change_key to json attribute)
Signed-off-by: Imen Bhiri <imen.bhiri@pivasoftware.com>
2015-05-27 16:10:30 +01:00

52 lines
1.4 KiB
Bash

#!/bin/sh
# Copyright (C) 2014 Inteno Broadband Technology AB
# Author Mohamed Kallel <mohamed.kallel@pivasoftware.com>
prefix_list="$prefix_list InternetGatewayDevice.UPnP."
get_upnp_enable() {
local val=`$UCI_GET upnpd.config.enabled`
echo ${val:-1}
}
set_upnp_enable() {
local val="$1"
val=`echo $val|tr '[A-Z]' '[a-z]'`
if [ "$val" = "true" -o "$val" = "1" ]; then
$UCI_SET upnpd.config.enabled=1
elif [ "$val" = "false" -o "$val" = "0" ]; then
$UCI_SET upnpd.config.enabled=
else
return
fi
delay_service restart "miniupnpd" "1"
}
get_upnp_status() {
local val=`pidof miniupnpd`
[ "$val" = "" ] && echo "Down" || echo "Up"
}
get_cache_InternetGatewayDevice_UPnP() {
get_object_cache_generic "InternetGatewayDevice.UPnP." "0"
get_object_cache_generic "InternetGatewayDevice.UPnP.Device." "0"
get_param_cache_generic "InternetGatewayDevice.UPnP.Device.Enable" "1" "get_upnp_enable" "set_upnp_enable \$val" "" "upnpd.config.enable_upnp" "xsd:boolean"
get_param_cache_generic "InternetGatewayDevice.UPnP.Device.X_INTENO_SE_Status" "0" "get_upnp_status" "" "1"
}
get_dynamic_InternetGatewayDevice_UPnP() {
return $FAULT_CPE_NO_FAULT
}
get_dynamic_linker_InternetGatewayDevice_UPnP() {
return $FAULT_CPE_NO_FAULT
}
add_object_InternetGatewayDevice_UPnP() {
return $FAULT_CPE_INVALID_PARAMETER_NAME
}
delete_object_InternetGatewayDevice_UPnP() {
return $FAULT_CPE_INVALID_PARAMETER_NAME
}