applications/luci-olsr: rework ui
[project/luci.git] / applications / luci-olsr / luasrc / model / cbi / olsr / olsrdiface.lua
1 --[[
2 LuCI - Lua Configuration Interface
3
4 Copyright 2010 Jo-Philipp Wich <xm@subsignal.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
16 m = Map("olsrd", translate("OLSR Daemon - Interface"),
17         translate("The OLSR daemon is an implementation of the Optimized Link State Routing protocol. "..
18         "As such it allows mesh routing for any network equipment. "..
19         "It runs on any wifi card that supports ad-hoc mode and of course on any ethernet device. "..
20         "Visit <a href='http://www.olsr.org'>olsrd.org</a> for help and documentation."))
21
22 m.redirect = luci.dispatcher.build_url("admin/services/olsrd")
23
24 if not arg[1] or m.uci:get("olsrd", arg[1]) ~= "Interface" then
25         luci.http.redirect(m.redirect)
26         return
27 end
28
29 i = m:section(NamedSection, arg[1], "Interface", translate("Interface"))
30 i.anonymous = true
31 i.addremove = false
32
33 i:tab("general", translate("General Settings"))
34 i:tab("addrs",   translate("IP Addresses"))
35 i:tab("timing",  translate("Timing and Validity"))
36
37 ign = i:taboption("general", Flag, "ignore", translate("Enable"),
38         translate("Enable this interface."))
39 ign.enabled  = "0"
40 ign.disabled = "1"
41 ign.rmempty = false
42 function ign.cfgvalue(self, section)
43         return Flag.cfgvalue(self, section) or "0"
44 end
45
46 network = i:taboption("general", Value, "interface", translate("Network"),
47         translate("The interface OLSRd should serve."))
48
49 network.template = "cbi/network_netlist"
50 network.widget   = "radio"
51 network.nocreate = true
52
53 mode = i:taboption("general", ListValue, "Mode", translate("Mode"),
54         translate("Interface Mode is used to prevent unnecessary packet forwarding on switched ethernet interfaces. "..
55         "valid Modes are \"mesh\" and \"ether\". Default is \"mesh\"."))
56 mode:value("mesh")
57 mode:value("ether")
58 mode.optional = true
59 mode.rmempty = true
60
61
62 weight = i:taboption("general", Value, "Weight", translate("Weight"),
63         translate("When multiple links exist between hosts the weight of interface is used to determine the link to use. "..
64         "Normally the weight is automatically calculated by olsrd based on the characteristics of the interface, "..
65         "but here you can specify a fixed value. Olsrd will choose links with the lowest value.<br />"..
66         "<b>Note:</b> Interface weight is used only when LinkQualityLevel is set to 0. "..
67         "For any other value of LinkQualityLevel, the interface ETX value is used instead."))
68 weight.optional = true
69 weight.datatype = "uinteger"
70 weight.placeholder = "0"
71
72 lqmult = i:taboption("general", DynamicList, "LinkQualityMult", translate("LinkQuality Multiplicator"),
73         translate("Multiply routes with the factor given here. Allowed values are between 0.01 and 1. "..
74         "It is only used when LQ-Level is greater than 0. Examples:<br />"..
75         "reduce LQ to 192.168.0.1 by half: 192.168.0.1 0.5<br />"..
76         "reduce LQ to all nodes on this interface by 20%: default 0.8"))
77 lqmult.optional = true
78 lqmult.rmempty = true
79 lqmult.cast = "table"
80 lqmult.placeholder = "default 1.0"
81
82
83 ip4b = i:taboption("addrs", Value, "Ip4Broadcast", translate("IPv4 broadcast"),
84         translate("IPv4 broadcast address for outgoing OLSR packets. One useful example would be 255.255.255.255. "..
85         "Default is \"0.0.0.0\", which triggers the usage of the interface broadcast IP."))
86 ip4b.optional = true
87 ip4b.datatype = "ip4addr"
88 ip4b.placeholder = "0.0.0.0"
89
90 ip6m = i:taboption("addrs", Value, "IPv6Multicast", translate("IPv6 multicast"),
91         translate("IPv6 multicast address. Default is \"FF02::6D\", the manet-router linklocal multicast."))
92 ip6m.optional = true
93 ip6m.datatype = "ip6addr"
94 ip6m.placeholder = "FF02::6D"
95
96 ip4s = i:taboption("addrs", Value, "IPv4Src", translate("IPv4 source"),
97         translate("IPv4 src address for outgoing OLSR packages. Default is \"0.0.0.0\", which triggers usage of the interface IP."))
98 ip4s.optional = true
99 ip4s.datatype = "ip4addr"
100 ip4s.placeholder = "0.0.0.0"
101
102 ip6s = i:taboption("addrs", Value, "IPv6Src", translate("IPv6 source"),
103         translate("IPv6 src prefix. OLSRd will choose one of the interface IPs which matches the prefix of this parameter. "..
104         "Default is \"0::/0\", which triggers the usage of a not-linklocal interface IP."))
105 ip6s.optional = true
106 ip6s.datatype = "ip6addr"
107 ip6s.placeholder = "0::/0"
108
109
110 hi = i:taboption("timing", Value, "HelloInterval", translate("Hello interval"))
111 hi.optional = true
112 hi.datatype = "ufloat"
113 hi.placeholder = "5.0"
114
115 hv = i:taboption("timing", Value, "HelloValidityTime", translate("Hello validity time"))
116 hv.optional = true
117 hv.datatype = "ufloat"
118 hv.placeholder = "40.0"
119
120 ti = i:taboption("timing", Value, "TcInterval", translate("TC interval"))
121 ti.optional = true
122 ti.datatype = "ufloat"
123 ti.placeholder = "2.0"
124
125 tv = i:taboption("timing", Value, "TcValidityTime", translate("TC validity time"))
126 tv.optional = true
127 tv.datatype = "ufloat"
128 tv.placeholder = "256.0"
129
130 mi = i:taboption("timing", Value, "MidInterval", translate("MID interval"))
131 mi.optional = true
132 mi.datatype = "ufloat"
133 mi.placeholder = "18.0"
134
135 mv = i:taboption("timing", Value, "MidValidityTime", translate("MID validity time"))
136 mv.optional = true
137 mv.datatype = "ufloat"
138 mv.placeholder = "324.0"
139
140 ai = i:taboption("timing", Value, "HnaInterval", translate("HNA interval"))
141 ai.optional = true
142 ai.datatype = "ufloat"
143 ai.placeholder = "18.0"
144
145 av = i:taboption("timing", Value, "HnaValidityTime", translate("HNA validity time"))
146 av.optional = true
147 av.datatype = "ufloat"
148 av.placeholder = "108.0"
149
150
151 return m