Developing lightweight computation at the DSG edge

Commit 50af5ad2 authored by p4u's avatar p4u
Browse files

New functionalities for web interface

parent 03d3e7a3
......@@ -17,6 +17,7 @@
#
# The full GNU General Public License is included in this distribution in
# the file called "COPYING".
SOURCE_COMMON=1
#######################
# UCI related commands
......
......@@ -22,7 +22,7 @@ QMP_PATH="/etc/qmp"
. $QMP_PATH/qmp_common.sh
. $QMP_PATH/qmp_functions.sh
. $QMP_PATH/qmp_gw.sh
. $QMP_PATH/qmp_wireless.sh
offer_default_gw() {
qmp_gw_offer_default
......@@ -34,6 +34,20 @@ search_default_gw() {
qmp_gw_apply
}
apply_wifi() {
qmp_configure_wifi >/dev/null
wifi
}
apply_network() {
qmp_configure
/etc/init.d/network restart
/etc/init.d/olsrd restart
/etc/init.d/bmx6 restart
ifup -a
}
help() {
echo "Use: $0 <function> [params]"
......@@ -41,6 +55,8 @@ help() {
echo "Available functions:"
echo " offer_default_gw : Offers default gw to the network"
echo " search_default_gw : Search for a default gw in the network"
echo " apply_wifi : Apply current wifi configuration"
echo " apply_network : Apply current network configuration"
echo ""
}
......
#!/bin/sh /etc/rc.common
#!/bin/sh
#/etc/rc.common
# Copyright (C) 2011 Fundacio Privada per a la Xarxa Oberta, Lliure i Neutral guifi.net
#
# This program is free software; you can redistribute it and/or modify
......@@ -18,12 +19,13 @@
# The full GNU General Public License is included in this distribution in
# the file called "COPYING".
#START=91
QMP_PATH="/etc/qmp"
SOURCE_NETWORK=1
[ -z "$SOURCE_GW" ] && . $QMP_PATH/qmp_gw.sh
# requires ip ipv6calc awk sed grep
qmp_uci_test() {
option=$1
......@@ -848,10 +850,13 @@ qmp_configure_system() {
}
qmp_check_force_internet() {
[ "$(uci get qmp.interfaces.force_internet)" == "1" ] && qmp_gw_offer_default
[ "$(uci get qmp.interfaces.force_internet)" == "0" ] && qmp_gw_search_default
}
qmp_configure() {
qmp_check_force_internet
qmp_configure_network
qmp_configure_bmx6
qmp_configure_olsr6
......@@ -859,5 +864,3 @@ qmp_configure() {
}
......@@ -19,9 +19,10 @@
# the file called "COPYING".
QMP_PATH="/etc/qmp"
SOURCE_GW=1
. $QMP_PATH/qmp_common.sh
. $QMP_PATH/qmp_functions.sh
[ -z "$SOURCE_COMMON" ] && . $QMP_PATH/qmp_common.sh
[ -z "$SOURCE_NETWORK" ] &&. $QMP_PATH/qmp_functions.sh
qmp_gw_search_default() {
qmp_uci_set tunnels qmp
......
......@@ -32,6 +32,7 @@ QMPINFO="/etc/qmp/qmpinfo"
#######################
# Importing files
######################
SOURCE_WIRELESS=1
. $QMP_PATH/qmp_common.sh
......
......@@ -77,19 +77,16 @@ for i,l in ipairs(eth_int) do
mesh:value(l,l)
end
-- Option force_internet
fint = eth_section:option(ListValue, "force_internet", "Force internet")
fint:value("","disabled")
fint:value("1","yes")
fint:value("0","no")
-- Wireless devices
--for i,v in ipairs(wl_int) do
-- mode = wl_section:option(ListValue, ""
-- end
--int:option(Value, "lan_devices", "LAN devices", "LAN devices")
--int:option(Value, "wan_device", "WAN device", "WAN devices")
--int:option(Value, "mesh_devices", "Mesh devices", "MESH devices")
function m.on_commit(self,map)
luci.sys.call('/etc/qmp/qmp_control.sh apply_network > /tmp/qmp_control_network.log')
end
return m
......
......@@ -94,5 +94,10 @@ for _,wdev in ipairs(wdevs) do
end
function m.on_commit(self,map)
luci.sys.call('/etc/qmp/qmp_control.sh apply_wifi > /tmp/qmp_control_wifi.log')
end
return m
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment