root/luci/branches/luci-0.10/applications/luci-upnp/luasrc/model/cbi/upnp/upnp.lua @ 7038

Revision 7038, 3.9 KB (checked in by jow, 2 years ago)

luci-0.10: merge trunk

  • Property svn:keywords set to Id
RevLine 
[2606]1--[[
2LuCI - Lua Configuration Interface
3
4Copyright 2008 Steven Barth <steven@midlink.org>
[7038]5Copyright 2008-2011 Jo-Philipp Wich <xm@subsignal.org>
[2606]6
7Licensed under the Apache License, Version 2.0 (the "License");
8you may not use this file except in compliance with the License.
9You may obtain a copy of the License at
10
11    http://www.apache.org/licenses/LICENSE-2.0
12
13$Id$
14]]--
15
[6394]16m = Map("upnpd", translate("Universal Plug & Play"),
17    translate("UPnP allows clients in the local network to automatically configure the router."))
18
19m:section(SimpleSection).template  = "upnp_status"
20
[7038]21s = m:section(NamedSection, "config", "upnpd", translate("MiniUPnP settings"))
[5464]22s.addremove = false
[7038]23s:tab("general",  translate("General Settings"))
24s:tab("advanced", translate("Advanced Settings"))
[5464]25
[7038]26e = s:taboption("general", Flag, "_init", translate("Start UPnP and NAT-PMP service"))
[6394]27e.rmempty  = false
[4176]28
[7038]29function e.cfgvalue(self, section)
30    return luci.sys.init.enabled("miniupnpd") and self.enabled or self.disabled
31end
32
[6394]33function e.write(self, section, value)
34    if value == "1" then
[7038]35        luci.sys.call("/etc/init.d/miniupnpd enable >/dev/null")
36        luci.sys.call("/etc/init.d/miniupnpd start >/dev/null")
[6394]37    else
[7038]38        luci.sys.call("/etc/init.d/miniupnpd stop >/dev/null")
39        luci.sys.call("/etc/init.d/miniupnpd disable >/dev/null")
[6394]40    end
41end
42
[7038]43s:taboption("general", Flag, "enable_upnp", translate("Enable UPnP functionality")).default = "1"
44s:taboption("general", Flag, "enable_natpmp", translate("Enable NAT-PMP functionality")).default = "1"
[2606]45
[7038]46s:taboption("general", Flag, "secure_mode", translate("Enable secure mode"),
47    translate("Allow adding forwards only to requesting ip addresses")).default = "1"
48
49s:taboption("general", Flag, "log_output", translate("Enable additional logging"),
50    translate("Puts extra debugging information into the system log")).default = "1"
51
52s:taboption("general", Value, "download", translate("Downlink"), 
53    translate("Value in KByte/s, informational only")).rmempty = true
54
55s:taboption("general", Value, "upload", translate("Uplink"),
56    translate("Value in KByte/s, informational only")).rmempty = true
57
58port = s:taboption("general", Value, "port", translate("Port"))
59port.datatype = "port"
60port.default  = 5000
61
62
63s:taboption("advanced", Flag, "system_uptime", translate("Report system instead of daemon uptime")).default = "1"
64
65s:taboption("advanced", Value, "uuid", translate("Device UUID"))
66s:taboption("advanced", Value, "serial_number", translate("Announced serial number"))
67s:taboption("advanced", Value, "model_number", translate("Announced model number"))
68
69ni = s:taboption("advanced", Value, "notify_interval", translate("Notify interval"))
70ni.datatype    = "uinteger"
71ni.placeholder = 30
72
73ct = s:taboption("advanced", Value, "clean_ruleset_threshold", translate("Clean rules threshold"))
74ct.datatype    = "uinteger"
75ct.placeholder = 20
76
77ci = s:taboption("advanced", Value, "clean_ruleset_interval", translate("Clean rules interval"))
78ci.datatype    = "uinteger"
79ci.placeholder = 600
80
81pu = s:taboption("advanced", Value, "presentation_url", translate("Presentation URL"))
82pu.placeholder = "http://192.168.1.1/"
83
84lf = s:taboption("advanced", Value, "upnp_lease_file", translate("UPnP lease file"))
85lf.placeholder = "/var/log/upnp.leases"
86
87
88s2 = m:section(TypedSection, "perm_rule", translate("MiniUPnP ACLs"),
89    translate("ACLs specify which external ports may be redirected to which internal addresses and ports"))
90
91s2.template  = "cbi/tblsection"
92s2.sortable  = true
93s2.anonymous = true
94s2.addremove = true
95
96s2:option(Value, "comment", translate("Comment"))
97
98ep = s2:option(Value, "ext_ports", translate("External ports"))
99ep.datatype    = "portrange"
100ep.placeholder = "0-65535"
101
102ia = s2:option(Value, "int_addr", translate("Internal addresses"))
103ia.datatype    = "ip4addr"
104ia.placeholder = "0.0.0.0/0"
105
106ip = s2:option(Value, "int_ports", translate("Internal ports"))
107ip.datatype    = "portrange"
108ip.placeholder = "0-65535"
109
110ac = s2:option(ListValue, "action", translate("Action"))
111ac:value("allow")
112ac:value("deny")
113
[4121]114return m
Note: See TracBrowser for help on using the browser.