luci/applications/luci-qos/luasrc/model/cbi/qos/qos.lua

85 lines
1.9 KiB
Lua
Raw Normal View History

--[[
LuCI - Lua Configuration Interface
Copyright 2008 Steven Barth <steven@midlink.org>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
$Id$
]]--
2009-07-19 00:24:58 +00:00
local wa = require "luci.tools.webadmin"
local fs = require "nixio.fs"
2008-06-08 17:12:47 +00:00
m = Map("qos")
2008-04-14 17:15:49 +00:00
s = m:section(TypedSection, "interface", translate("Interfaces"))
2008-04-14 17:15:49 +00:00
s.addremove = true
2008-06-09 10:10:29 +00:00
s:option(Flag, "enabled", translate("enable"))
2008-04-14 17:15:49 +00:00
2008-06-08 17:12:47 +00:00
c = s:option(ListValue, "classgroup")
2008-04-14 17:15:49 +00:00
c:value("Default", "standard")
c.default = "Default"
2008-06-08 17:12:47 +00:00
s:option(Flag, "overhead")
2008-04-14 17:15:49 +00:00
s:option(Flag, "halfduplex")
2008-06-08 17:12:47 +00:00
s:option(Value, "download", nil, "kb/s")
2008-04-14 17:15:49 +00:00
2008-06-08 17:12:47 +00:00
s:option(Value, "upload", nil, "kb/s")
2008-04-14 17:15:49 +00:00
2008-06-08 17:12:47 +00:00
s = m:section(TypedSection, "classify")
2008-08-13 16:18:39 +00:00
s.template = "cbi/tblsection"
2008-04-14 17:15:49 +00:00
s.anonymous = true
s.addremove = true
2008-06-08 17:12:47 +00:00
t = s:option(ListValue, "target")
t:value("Priority", translate("priority"))
t:value("Express", translate("express"))
t:value("Normal", translate("normal"))
t:value("Bulk", translate("low"))
2008-04-14 17:15:49 +00:00
t.default = "Normal"
2008-08-13 16:18:39 +00:00
srch = s:option(Value, "srchost")
srch.rmempty = true
srch:value("", translate("all"))
2009-07-19 00:24:58 +00:00
wa.cbi_add_knownips(srch)
2008-08-13 16:18:39 +00:00
dsth = s:option(Value, "dsthost")
dsth.rmempty = true
dsth:value("", translate("all"))
2009-07-19 00:24:58 +00:00
wa.cbi_add_knownips(dsth)
l7 = s:option(ListValue, "layer7", translate("Service"))
2008-08-13 16:18:39 +00:00
l7.rmempty = true
l7:value("", translate("all"))
2009-07-19 00:24:58 +00:00
local pats = fs.dir("/etc/l7-protocols")
if pats then
2009-07-19 00:24:58 +00:00
for f in pats do
if f:sub(-4) == ".pat" then
l7:value(f:sub(1, #f-4))
end
end
end
2008-04-14 17:15:49 +00:00
p = s:option(Value, "proto", translate("Protocol"))
2008-08-13 16:18:39 +00:00
p:value("", translate("all"))
2008-04-14 17:15:49 +00:00
p:value("tcp", "TCP")
p:value("udp", "UDP")
p:value("icmp", "ICMP")
2008-08-13 16:18:39 +00:00
p.rmempty = true
2008-04-14 17:15:49 +00:00
ports = s:option(Value, "ports", translate("Ports"))
2008-08-13 16:18:39 +00:00
ports.rmempty = true
ports:value("", translate("allf", translate("all")))
2008-04-14 17:15:49 +00:00
2009-01-17 16:19:43 +00:00
bytes = s:option(Value, "connbytes", translate("qos_connbytes"))
return m