Rework LuCI build system
[project/luci.git] / protocols / luci-proto-ipv6 / luasrc / model / network / proto_4x6.lua
1 --[[
2 LuCI - Network model - 6to4, 6in4 & 6rd protocol extensions
3
4 Copyright 2011 Jo-Philipp Wich <xm@subsignal.org>
5 Copyright 2013 Steven Barth <steven@midlink.org>
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 Unless required by applicable law or agreed to in writing, software
14 distributed under the License is distributed on an "AS IS" BASIS,
15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 See the License for the specific language governing permissions and
17 limitations under the License.
18
19 ]]--
20
21 local netmod = luci.model.network
22
23 local _, p
24 for _, p in ipairs({"dslite"}) do
25
26 local proto = netmod:register_protocol(p)
27
28 function proto.get_i18n(self)
29 if p == "dslite" then
30 return luci.i18n.translate("Dual-Stack Lite (RFC6333)")
31 end
32 end
33
34 function proto.ifname(self)
35 return p .. "-" .. self.sid
36 end
37
38 function proto.opkg_package(self)
39 if p == "dslite" then
40 return "ds-lite"
41 end
42 end
43
44 function proto.is_installed(self)
45 return nixio.fs.access("/lib/netifd/proto/" .. p .. ".sh")
46 end
47
48 function proto.is_floating(self)
49 return true
50 end
51
52 function proto.is_virtual(self)
53 return true
54 end
55
56 function proto.get_interfaces(self)
57 return nil
58 end
59
60 function proto.contains_interface(self, ifname)
61 return (netmod:ifnameof(ifc) == self:ifname())
62 end
63
64 netmod:register_pattern_virtual("^%s-%%w" % p)
65 end