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