b5da4e71dd878df034e9b9c7bf72a4d68769512c
[project/luci.git] / applications / luci-olsr / luasrc / model / cbi / olsr / olsrd.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 require("luci.tools.webadmin")
15 require("luci.fs")
16
17 m = Map("olsr", "OLSR")
18
19 s = m:section(NamedSection, "general", "olsr")
20 s.dynamic = true
21
22 debug = s:option(ListValue, "DebugLevel")
23 for i=0, 9 do
24         debug:value(i)
25 end
26
27 ipv = s:option(ListValue, "IpVersion")
28 ipv:value("4", "IPv4")
29 ipv:value("6", "IPv6")
30
31
32 i = m:section(TypedSection, "Interface", translate("interfaces"))
33 i.anonymous = true
34 i.addremove = true
35 i.dynamic = true
36
37 network = i:option(ListValue, "Interface", translate("network"))
38 luci.tools.webadmin.cbi_add_networks(network)
39
40 i:option(Value, "Ip4Broadcast")
41 i:option(Value, "HelloInterval")
42 i:option(Value, "HelloValidityTime")
43 i:option(Value, "TcInterval")
44 i:option(Value, "TcValidityTime")
45 i:option(Value, "MidInterval")
46 i:option(Value, "MidValidityTime")
47 i:option(Value, "HnaInterval")
48 i:option(Value, "HnaValidityTime")
49
50
51 p = m:section(TypedSection, "LoadPlugin")
52 p.addremove = true
53 p.dynamic = true
54
55 lib = p:option(ListValue, "Library", translate("library"))
56 lib:value("")
57 for k, v in pairs(luci.fs.dir("/usr/lib")) do
58         if v:sub(1, 6) == "olsrd_" then
59                 lib:value(v)
60         end
61 end
62
63
64 for i, sect in ipairs({ "Hna4", "Hna6" }) do
65         hna = m:section(TypedSection, sect)
66         hna.addremove = true
67         hna.anonymous = true
68         hna.template  = "cbi/tblsection"
69
70         net = hna:option(Value, "NetAddr")
71         msk = hna:option(Value, "Prefix")
72 end
73
74
75 ipc = m:section(NamedSection, "IpcConnect")
76 conns = ipc:option(Value, "MaxConnections")
77 conns.isInteger = true
78
79 nets  = ipc:option(Value, "Net")
80 nets.optional = true
81
82 hosts = ipc:option(Value, "Host")
83 hosts.optional = true
84
85
86 return m