From f14921c58a9b23cc359e21b851ad76e1db67e1c4 Mon Sep 17 00:00:00 2001 From: Carey Sonsino Date: Tue, 15 Oct 2019 20:47:13 +0000 Subject: [PATCH] luci-app-dcwapd: Add Dual Channel Wi-Fi AP Daemon Pages Signed-off-by: Carey Sonsino Signed-off-by: Carey Sonsino --- applications/luci-app-dcwapd/Makefile | 15 ++ .../luasrc/controller/dcwapd.lua | 13 ++ .../luasrc/model/cbi/dcwapd/dcwapd.lua | 218 ++++++++++++++++++ applications/luci-app-dcwapd/po/es/dcwapd.po | 131 +++++++++++ .../luci-app-dcwapd/po/templates/dcwapd.pot | 112 +++++++++ .../root/etc/uci-defaults/60_luci-dcwapd | 11 + 6 files changed, 500 insertions(+) create mode 100644 applications/luci-app-dcwapd/Makefile create mode 100644 applications/luci-app-dcwapd/luasrc/controller/dcwapd.lua create mode 100644 applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua create mode 100644 applications/luci-app-dcwapd/po/es/dcwapd.po create mode 100644 applications/luci-app-dcwapd/po/templates/dcwapd.pot create mode 100644 applications/luci-app-dcwapd/root/etc/uci-defaults/60_luci-dcwapd diff --git a/applications/luci-app-dcwapd/Makefile b/applications/luci-app-dcwapd/Makefile new file mode 100644 index 000000000..3396bcd29 --- /dev/null +++ b/applications/luci-app-dcwapd/Makefile @@ -0,0 +1,15 @@ +# +# Copyright (C) 2019 EWSI +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=Dual Channel Wi-Fi AP Daemon configuration module +LUCI_DEPENDS:=+dcwapd + +include ../../luci.mk + +# call BuildPackage - OpenWrt buildroot signature diff --git a/applications/luci-app-dcwapd/luasrc/controller/dcwapd.lua b/applications/luci-app-dcwapd/luasrc/controller/dcwapd.lua new file mode 100644 index 000000000..f13c42200 --- /dev/null +++ b/applications/luci-app-dcwapd/luasrc/controller/dcwapd.lua @@ -0,0 +1,13 @@ +-- Copyright 2019 EWSI +-- Licensed to the public under the Apache License 2.0. + +module("luci.controller.dcwapd", package.seeall) + +function index() + if not nixio.fs.access("/etc/config/dcwapd") then + return + end + local page + page = entry({"admin", "network", "dcwapd"}, cbi("dcwapd/dcwapd"), _("Dual Channel WiFi")) + page.dependent = true +end diff --git a/applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua b/applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua new file mode 100644 index 000000000..956121184 --- /dev/null +++ b/applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua @@ -0,0 +1,218 @@ +-- Copyright 2019 EWSI +-- Licensed to the public under the Apache License 2.0. + +local wa = require "luci.tools.webadmin" +local fs = require "nixio.fs" +local ntm = require "luci.model.network" +local uc = require "luci.model.uci".cursor() + +local sys = require "luci.sys" + +local devices = sys.net.devices() + +local m, s +local i, v +local enable, tmpdir +local pri_ssid, pri_bridge, data_channels +local dat_ssid, dat_bridge, ifaces +local mac, filters +local packetsize, srcip, srcport, proto, dstport + +m = Map("dcwapd", translate("Dual Channel Wi-Fi AP Daemon"), + translate("With Dual Channel WiFi you " .. + "can use two simultaneous Wi-Fi connections to decrease wireless traffic " .. + "congestion and increase throughput.")) + +-- General section +s = m:section(NamedSection, "general", translate("General"), translate("General Settings")) +s.addremove = false +s.dynamic = false +s.optional = false +s.anonymous = true + +-- Enabled state option +enable = s:option(Flag, "enabled", translate("Enable")) +enable.default = false +enable.optional = false +enable.rmempty = false + +-- Temp dir option +tmpdir = s:option(Value, "tmpdir", translate("Temp Directory"), translate("Specify the temporary directory for dcwapd file storage.")) +tmpdir.optional = false +tmpdir.rmempty = false + +-- Channel sets section +s = m:section(TypedSection, "channel-set", translate("Channel Sets"), translate("Define primary channels and their corresponding data channels.")) +s.addremove= true +s.dynamic = false +s.optional = false +s.anonymous = false + +-- Enabled state option +enable = s:option(Flag, "enabled", translate("Enable")) +enable.default = false +enable.optional = false +enable.rmempty = false + +-- SSID option +pri_ssid = s:option(Value, "ssid", translate("SSID")) +pri_ssid.optional = false +pri_ssid.rmempty = false +pri_ssid.size = 0 +for i, v in ipairs(devices) do + ntm.init() + local net = ntm:get_wifinet(v) + if net then + pri_ssid:value(net:ssid()) + pri_ssid.size = pri_ssid.size + 1 + end +end + +-- Primary bridge option +pri_bridge = s:option(Value, "bridge", translate("Bridge")) +pri_bridge.optional = false +pri_bridge.rmempty = false +pri_bridge.size = 0 +for i, v in ipairs(devices) do + ntm.init() + local net = ntm:get_wifinet(v) + if net then + local nw = net:get_network() + if nw then + pri_bridge:value("br-" .. nw:name()) + pri_bridge.size = pri_bridge.size + 1 + end + end +end + +-- Data channels list +data_channels = s:option(MultiValue, "data_channels", translate("Data Channels")) +data_channels.widget = "checkbox" +data_channels.optional = false +data_channels.rmempty = false +data_channels.size = 0 +uc:foreach("dcwapd", "datachannel", function(s) + if s['.name'] then + data_channels:value(s['.name']) + data_channels.size = data_channels.size + 1 + end +end) + +-- Data channels section +s = m:section(TypedSection, "datachannel", translate("Data Channels"), translate("Define data channels over which outbound filtered packets will flow.")) +s.anonymous = false +s.addremove = true + +-- SSID option +dat_ssid = s:option(Value, "ssid", translate("SSID")) +dat_ssid.optional = false +dat_ssid.rmempty = false +dat_ssid.size = 0 +for i, v in ipairs(devices) do + ntm.init() + local net = ntm:get_wifinet(v) + if net then + dat_ssid:value(net:ssid()) + dat_ssid.size = dat_ssid.size + 1 + end +end + +-- Data bridge option +dat_bridge = s:option(Value, "bridge", translate("Bridge")) +dat_bridge.optional = false +dat_bridge.rmempty = false +dat_bridge.size = 0 +for i, v in ipairs(devices) do + ntm.init() + local net = ntm:get_wifinet(v) + if net then + local nw = net:get_network() + if nw then + dat_bridge:value("br-" .. nw:name()) + dat_bridge.size = dat_bridge.size + 1 + end + end +end + +-- Data interfaces list +ifaces = s:option(MultiValue, "interfaces", translate("Interfaces")) +ifaces.widget = "checkbox" +ifaces.optional = true +ifaces.rmempty = false +ifaces.size = 0 +table.sort(devices) +for i, v in ipairs(devices) do + ntm.init() + local net = ntm:get_wifinet(v) + if net then + ifaces:value(v) + ifaces.size = ifaces.size + 1 + end +end + +-- Filter sets section +s = m:section(TypedSection, "filter-set", translate("Filter Sets"), translate("Select filters to apply to matching MAC addresses.")) +s.addremove = true +s.dynamic = false +s.anonymous = false +s.optional = false + +-- MAC address option +mac = s:option(Value, "mac", translate("MAC Address")) +mac.optional = false +mac.rmempty = false + +-- Filters list +filters = s:option(MultiValue, "filters", translate("Filters")) +filters.widget = "checkbox" +filters.optional = false +filters.rmempty = false +filters.size = 0 +uc:foreach("dcwapd", "filter", function(s) + if s['.name'] then + filters:value(s['.name']) + filters.size = filters.size + 1 + end +end) + +-- Filters section +s = m:section(TypedSection, "filter", translate("Filters"), translate("Define filter rules to apply to outbound packets. Matching packets will flow over the data channel.")) +s.template = "cbi/tblsection" +s.anonymous = false +s.addremove = true +s.sortable = true + +-- Packet Size +packetsize = s:option(Value, "packet_size", translate("Packet size")) +packetsize.rmempty = false +packetsize:value("*", "*") +packetsize.default = "*" + +-- Source IP +srcip = s:option(Value, "source_ip", translate("Source IP")) +srcip.rmempty = false +srcip:value("*", "*") +srcip.default = "*" + +-- Source Port +srcport = s:option(Value, "source_port", translate("Source port")) +srcport.rmempty = false +srcport:value("*", "*") +srcport.default = "*" + +-- Protocol +proto = s:option(Value, "protocol", translate("Protocol")) +proto:value("*", "*") +proto:value("tcp", "TCP") +proto:value("udp", "UDP") +proto:value("icmp", "ICMP") +proto.rmempty = false +proto.default = "*" + +-- Destination Port +dstport = s:option(Value, "dest_port", translate("Destination port")) +dstport.rmempty = false +dstport:value("*", "*") +dstport.default = "*" + +return m diff --git a/applications/luci-app-dcwapd/po/es/dcwapd.po b/applications/luci-app-dcwapd/po/es/dcwapd.po new file mode 100644 index 000000000..7ae91530d --- /dev/null +++ b/applications/luci-app-dcwapd/po/es/dcwapd.po @@ -0,0 +1,131 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" +"Project-Id-Version: \n" +"POT-Creation-Date: 2019-10-10 18:41-0300\n" +"POT-Creation-Date: 2019-10-10 18:48-0300\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 2.2.4\n" +"Last-Translator: Franco Castillo \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: es\n" + +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:72 +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:121 +msgid "Bridge" +msgstr "Puente" + +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:45 +msgid "Channel Sets" +msgstr "Conjuntos de canales" + +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:89 +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:102 +msgid "Data Channels" +msgstr "Canales de datos" + +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:102 +msgid "Define data channels over which outbound filtered packets will flow." +msgstr "" +"Defina canales de datos sobre los cuales fluirán los paquetes filtrados " +"salientes." + +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:179 +msgid "" +"Define filter rules to apply to outbound packets. Matching packets will flow " +"over the data channel." +msgstr "" +"Defina reglas de filtro para aplicar a los paquetes salientes. Los paquetes " +"coincidentes fluirán sobre el canal de datos." + +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:45 +msgid "Define primary channels and their corresponding data channels." +msgstr "Definir canales primarios y sus canales de datos correspondientes." + +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:213 +msgid "Destination port" +msgstr "Puerto de destino" + +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:21 +msgid "Dual Channel Wi-Fi AP Daemon" +msgstr "Demonio AP de WiFi de doble canal" + +#: applications/luci-app-dcwapd/luasrc/controller/dcwapd.lua:11 +msgid "Dual Channel WiFi" +msgstr "WiFi de doble canal" + +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:34 +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:52 +msgid "Enable" +msgstr "Habilitar" + +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:154 +msgid "Filter Sets" +msgstr "Conjuntos de filtros" + +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:166 +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:179 +msgid "Filters" +msgstr "Filtros" + +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:27 +msgid "General" +msgstr "General" + +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:27 +msgid "General Settings" +msgstr "Configuración general" + +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:138 +msgid "Interfaces" +msgstr "Interfaces" + +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:161 +msgid "MAC Address" +msgstr "Dirección MAC" + +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:186 +msgid "Packet size" +msgstr "Tamaño del paquete" + +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:204 +msgid "Protocol" +msgstr "Protocolo" + +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:58 +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:107 +msgid "SSID" +msgstr "SSID" + +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:154 +msgid "Select filters to apply to matching MAC addresses." +msgstr "Seleccione filtros para aplicar a las direcciones MAC coincidentes." + +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:192 +msgid "Source IP" +msgstr "IP de origen" + +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:198 +msgid "Source port" +msgstr "Puerto de origen" + +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:40 +msgid "Specify the temporary directory for dcwapd file storage." +msgstr "" +"Especifique el directorio temporal para el almacenamiento de archivos dcwapd." + +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:40 +msgid "Temp Directory" +msgstr "Directorio temporal" + +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:22 +msgid "" +"With Dual Channel WiFi " +"you can use two simultaneous Wi-Fi connections to decrease wireless traffic " +"congestion and increase throughput." +msgstr "" +"Con Dual Channel WiFi " +"puede usar dos conexiones WiFi simultáneas para disminuir la congestión del " +"tráfico inalámbrico y aumentar el rendimiento." diff --git a/applications/luci-app-dcwapd/po/templates/dcwapd.pot b/applications/luci-app-dcwapd/po/templates/dcwapd.pot new file mode 100644 index 000000000..616ead654 --- /dev/null +++ b/applications/luci-app-dcwapd/po/templates/dcwapd.pot @@ -0,0 +1,112 @@ +msgid "" +msgstr "Content-Type: text/plain; charset=UTF-8" + +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:72 +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:121 +msgid "Bridge" +msgstr "" + +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:45 +msgid "Channel Sets" +msgstr "" + +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:89 +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:102 +msgid "Data Channels" +msgstr "" + +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:102 +msgid "Define data channels over which outbound filtered packets will flow." +msgstr "" + +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:179 +msgid "" +"Define filter rules to apply to outbound packets. Matching packets will flow " +"over the data channel." +msgstr "" + +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:45 +msgid "Define primary channels and their corresponding data channels." +msgstr "" + +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:213 +msgid "Destination port" +msgstr "" + +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:21 +msgid "Dual Channel Wi-Fi AP Daemon" +msgstr "" + +#: applications/luci-app-dcwapd/luasrc/controller/dcwapd.lua:11 +msgid "Dual Channel WiFi" +msgstr "" + +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:34 +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:52 +msgid "Enable" +msgstr "" + +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:154 +msgid "Filter Sets" +msgstr "" + +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:166 +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:179 +msgid "Filters" +msgstr "" + +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:27 +msgid "General" +msgstr "" + +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:27 +msgid "General Settings" +msgstr "" + +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:138 +msgid "Interfaces" +msgstr "" + +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:161 +msgid "MAC Address" +msgstr "" + +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:186 +msgid "Packet size" +msgstr "" + +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:204 +msgid "Protocol" +msgstr "" + +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:58 +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:107 +msgid "SSID" +msgstr "" + +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:154 +msgid "Select filters to apply to matching MAC addresses." +msgstr "" + +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:192 +msgid "Source IP" +msgstr "" + +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:198 +msgid "Source port" +msgstr "" + +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:40 +msgid "Specify the temporary directory for dcwapd file storage." +msgstr "" + +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:40 +msgid "Temp Directory" +msgstr "" + +#: applications/luci-app-dcwapd/luasrc/model/cbi/dcwapd/dcwapd.lua:22 +msgid "" +"With Dual Channel WiFi " +"you can use two simultaneous Wi-Fi connections to decrease wireless traffic " +"congestion and increase throughput." +msgstr "" diff --git a/applications/luci-app-dcwapd/root/etc/uci-defaults/60_luci-dcwapd b/applications/luci-app-dcwapd/root/etc/uci-defaults/60_luci-dcwapd new file mode 100644 index 000000000..36455f834 --- /dev/null +++ b/applications/luci-app-dcwapd/root/etc/uci-defaults/60_luci-dcwapd @@ -0,0 +1,11 @@ +#!/bin/sh + +# register commit handler +uci -q batch <<-EOF >/dev/null + delete ucitrack.@dcwapd[-1] + add ucitrack dcwapd + set ucitrack.@dcwapd[-1].init=dcwapd + commit ucitrack +EOF + +exit 0 -- 2.25.1