[PATCH 1/2] qos: add description strings (from BenoƮt Knecht)
[project/luci.git] / applications / luci-qos / luasrc / model / cbi / qos / qos.lua
1 --[[
2 LuCI - Lua Configuration Interface
3
4 Copyright 2008 Steven Barth <steven@midlink.org>
5
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9
10         http://www.apache.org/licenses/LICENSE-2.0
11
12 $Id$
13 ]]--
14
15 local wa = require "luci.tools.webadmin"
16 local fs = require "nixio.fs"
17
18 m = Map("qos", translate("Quality of Service"),
19         translate("With <abbr title=\"Quality of Service\">QoS</abbr> you " ..
20                 "can prioritize network traffic selected by addresses, " ..
21                 "ports or services."))
22
23 s = m:section(TypedSection, "interface", translate("Interfaces"))
24 s.addremove = true
25 s.anonymous = false
26
27 s:option(Flag, "enabled", translate("Enable"))
28
29 c = s:option(ListValue, "classgroup", translate("Classification group"))
30 c:value("Default", translate("default"))
31 c.default = "Default"
32
33 s:option(Flag, "overhead", translate("Calculate overhead"))
34
35 s:option(Flag, "halfduplex", translate("Half-duplex"))
36
37 s:option(Value, "download", translate("Download speed (kb/s)"))
38
39 s:option(Value, "upload", translate("Upload speed (kb/s)"))
40
41 s = m:section(TypedSection, "classify", translate("Classification Rules"))
42 s.template = "cbi/tblsection"
43 s.anonymous = true
44 s.addremove = true
45
46 t = s:option(ListValue, "target", translate("Target"))
47 t:value("Priority", translate("priority"))
48 t:value("Express", translate("express"))
49 t:value("Normal", translate("normal"))
50 t:value("Bulk", translate("low"))
51 t.default = "Normal"
52
53 srch = s:option(Value, "srchost", translate("Source host"))
54 srch.rmempty = true
55 srch:value("", translate("all"))
56 wa.cbi_add_knownips(srch)
57
58 dsth = s:option(Value, "dsthost", translate("Destination host"))
59 dsth.rmempty = true
60 dsth:value("", translate("all"))
61 wa.cbi_add_knownips(dsth)
62
63 l7 = s:option(ListValue, "layer7", translate("Service"))
64 l7.rmempty = true
65 l7:value("", translate("all"))
66 local pats = fs.dir("/etc/l7-protocols")
67 if pats then
68         for f in pats do
69                 if f:sub(-4) == ".pat" then
70                         l7:value(f:sub(1, #f-4))
71                 end
72         end
73 end
74
75 p = s:option(Value, "proto", translate("Protocol"))
76 p:value("", translate("all"))
77 p:value("tcp", "TCP")
78 p:value("udp", "UDP")
79 p:value("icmp", "ICMP")
80 p.rmempty = true
81
82 ports = s:option(Value, "ports", translate("Ports"))
83 ports.rmempty = true
84 ports:value("", translate("all"))
85
86 bytes = s:option(Value, "connbytes", translate("Number of bytes"))
87
88 return m