0bb559edebed5991b7ebb1871c381b093a89e1eb
[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 m = Map("qos")
15
16 s = m:section(TypedSection, "interface", translate("interfaces"))
17 s.addremove = true
18
19 s:option(Flag, "enabled", translate("enable"))
20
21 c = s:option(ListValue, "classgroup")
22 c:value("Default", "standard")
23 c.default = "Default"
24
25 s:option(Flag, "overhead")
26
27 s:option(Value, "download", nil, "kb/s")
28
29 s:option(Value, "upload", nil, "kb/s")
30
31 s = m:section(TypedSection, "classify")
32
33 s.anonymous = true
34 s.addremove = true
35
36 t = s:option(ListValue, "target")
37 t:value("Priority", translate("qos_priority"))
38 t:value("Express", translate("qos_express"))
39 t:value("Normal", translate("qos_normal"))
40 t:value("Bulk", translate("qos_bulk"))
41 t.default = "Normal"
42
43 s:option(Value, "srchost").optional = true
44 s:option(Value, "dsthost").optional = true
45
46 l7 = s:option(ListValue, "layer7", translate("service"))
47 l7.optional = true
48 l7:value("")
49 local pats = luci.fs.dir("/etc/l7-protocols")
50 if pats then
51         for i,f in ipairs(pats) do
52                 if f:sub(-4) == ".pat" then
53                         l7:value(f:sub(1, #f-4))
54                 end
55         end
56 end
57
58 p2p = s:option(ListValue, "ipp2p", "P2P")
59 p2p:value("")
60 p2p:value("all", translate("all"))
61 p2p:value("bit", "BitTorrent")
62 p2p:value("dc", "DirectConnect")
63 p2p:value("edk", "eDonkey")
64 p2p:value("gnu", "Gnutella")
65 p2p:value("kazaa", "Kazaa")
66 p2p.optional = true
67
68 p = s:option(ListValue, "proto", translate("protocol"))
69 p:value("")
70 p:value("tcp", "TCP")
71 p:value("udp", "UDP")
72 p:value("icmp", "ICMP")
73 p.optional = true
74
75 s:option(Value, "ports", translate("port")).optional = true
76 s:option(Value, "portrange").optional = true
77
78 return m