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"))
46 srch = s:option(Value, "srchost", translate("Source host"))
48 srch:value("", translate("all"))
49 wa.cbi_add_knownips(srch)
51 dsth = s:option(Value, "dsthost", translate("Destination host"))
53 dsth:value("", translate("all"))
54 wa.cbi_add_knownips(dsth)
56 l7 = s:option(ListValue, "layer7", translate("Service"))
58 l7:value("", translate("all"))
60 local pats = io.popen("find /etc/l7-protocols/ -type f -name '*.pat'")
65 if not l then break end
67 l = l:match("([^/]+)%.pat$")
75 p = s:option(Value, "proto", translate("Protocol"))
76 p:value("", translate("all"))
79 p:value("icmp", "ICMP")
82 ports = s:option(Value, "ports", translate("Ports"))
84 ports:value("", translate("all"))
86 bytes = s:option(Value, "connbytes", translate("Number of bytes"))
88 comment = s:option(Value, "comment", translate("Comment"))