applications/luci-qos: clarify kb/s vs. kbit/s
[project/luci.git] / applications / luci-qos / luasrc / model / cbi / qos / qosmini.lua
1 --[[
2 LuCI - Lua Configuration Interface
3
4 Copyright 2008 Steven Barth <steven@midlink.org>
5 Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
6
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
10
11 http://www.apache.org/licenses/LICENSE-2.0
12
13 $Id$
14 ]]--
15
16 local wa = require "luci.tools.webadmin"
17 local fs = require "nixio.fs"
18
19 m = Map("qos")
20
21 s = m:section(NamedSection, "wan", "interface", translate("Internet Connection"))
22
23 s:option(Flag, "enabled", translate("Quality of Service"))
24 s:option(Value, "download", translate("Downlink"), "kbit/s")
25 s:option(Value, "upload", translate("Uplink"), "kbit/s")
26
27 s = m:section(TypedSection, "classify")
28 s.template = "cbi/tblsection"
29
30 s.anonymous = true
31 s.addremove = true
32
33 t = s:option(ListValue, "target")
34 t:value("Priority", translate("priority"))
35 t:value("Express", translate("express"))
36 t:value("Normal", translate("normal"))
37 t:value("Bulk", translate("low"))
38 t.default = "Normal"
39
40 srch = s:option(Value, "srchost")
41 srch.rmempty = true
42 srch:value("", translate("all"))
43 wa.cbi_add_knownips(srch)
44
45 dsth = s:option(Value, "dsthost")
46 dsth.rmempty = true
47 dsth:value("", translate("all"))
48 wa.cbi_add_knownips(dsth)
49
50 l7 = s:option(ListValue, "layer7", translate("Service"))
51 l7.rmempty = true
52 l7:value("", translate("all"))
53 local pats = fs.glob("/etc/l7-protocols/*/*.pat")
54 if pats then
55 for f in pats do
56 f = f:match("([^/]+)%.pat$")
57 if f then
58 l7:value(f)
59 end
60 end
61 end
62
63 p = s:option(ListValue, "proto", translate("Protocol"))
64 p:value("", translate("all"))
65 p:value("tcp", "TCP")
66 p:value("udp", "UDP")
67 p:value("icmp", "ICMP")
68 p.rmempty = true
69
70 ports = s:option(Value, "ports", translate("Ports"))
71 ports.rmempty = true
72 ports:value("", translate("allf", translate("all")))
73
74 bytes = s:option(Value, "connbytes", translate("qos_connbytes"))
75
76 return m