1 -- Copyright 2008 Steven Barth <steven@midlink.org>
2 -- Licensed to the public under the Apache License 2.0.
4 local wa = require "luci.tools.webadmin"
5 local fs = require "nixio.fs"
7 m = Map("qos", translate("Quality of Service"),
8 translate("With <abbr title=\"Quality of Service\">QoS</abbr> you " ..
9 "can prioritize network traffic selected by addresses, " ..
10 "ports or services."))
12 s = m:section(TypedSection, "interface", translate("Interfaces"))
16 e = s:option(Flag, "enabled", translate("Enable"))
19 c = s:option(ListValue, "classgroup", translate("Classification group"))
20 c:value("Default", translate("default"))
23 s:option(Flag, "overhead", translate("Calculate overhead"))
25 s:option(Flag, "halfduplex", translate("Half-duplex"))
27 dl = s:option(Value, "download", translate("Download speed (kbit/s)"))
28 dl.datatype = "and(uinteger,min(1))"
30 ul = s:option(Value, "upload", translate("Upload speed (kbit/s)"))
31 ul.datatype = "and(uinteger,min(1))"
33 s = m:section(TypedSection, "classify", translate("Classification Rules"))
34 s.template = "cbi/tblsection"
39 t = s:option(ListValue, "target", translate("Target"))
40 t:value("Priority", translate("priority"))
41 t:value("Express", translate("express"))
42 t:value("Normal", translate("normal"))
43 t:value("Bulk", translate("low"))
45 local uci = require "luci.model.uci"
46 uci.cursor():foreach("qos", "class",
48 local n = section[".name"]
49 if string.sub(n,-string.len("_down"))~="_down" then
56 srch = s:option(Value, "srchost", translate("Source host"))
58 srch:value("", translate("all"))
59 wa.cbi_add_knownips(srch)
61 dsth = s:option(Value, "dsthost", translate("Destination host"))
63 dsth:value("", translate("all"))
64 wa.cbi_add_knownips(dsth)
66 p = s:option(Value, "proto", translate("Protocol"))
67 p:value("", translate("all"))
70 p:value("icmp", "ICMP")
73 ports = s:option(Value, "ports", translate("Ports"))
75 ports:value("", translate("all"))
77 bytes = s:option(Value, "connbytes", translate("Number of bytes"))
79 comment = s:option(Value, "comment", translate("Comment"))