build: split into luci and luci-addons packages
[project/luci.git] / modules / niu / luasrc / controller / niu / traffic.lua
1 --[[
2 LuCI - Lua Development Framework
3
4 Copyright 2009 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
15 local require = require
16 module "luci.controller.niu.traffic"
17
18 function index()
19         local toniu = {on_success_to={"niu"}}
20         
21         local e = entry({"niu", "traffic"}, alias("niu"), "Network Traffic", 30)
22         e.niu_dbtemplate = "niu/traffic"
23         e.niu_dbtasks = true
24         e.niu_dbicon = "icons32/preferences-system-network.png"
25         
26         if fs.access("/etc/config/firewall") then
27                 entry({"niu", "traffic", "portfw"}, cbi("niu/traffic/portfw",
28                  toniu), "Manage Port Forwarding", 1)
29         end
30         
31         if fs.access("/etc/config/qos") then
32                 entry({"niu", "traffic", "qos"}, cbi("niu/traffic/qos",
33                  toniu), "Manage Prioritization (QoS)", 2)
34         end
35         
36         entry({"niu", "traffic", "routes"},  cbi("niu/traffic/routes",
37          toniu), "Manage Traffic Routing", 30)
38          
39         entry({"niu", "traffic", "conntrack"},  call("cnntrck"),
40          "Display Local Network Activity", 50)
41 end
42
43 function cnntrck()
44         require "luci.template".render("niu/traffic/conntrack")
45 end