034c1ee18694be6e4c589dbcca3ae4b9f0c37d15
[project/luci.git] / protocols / luci-proto-ipv6 / luasrc / model / network / proto_4x6.lua
1 -- Copyright 2011 Jo-Philipp Wich <xm@subsignal.org>
2 -- Copyright 2013 Steven Barth <steven@midlink.org>
3 -- Licensed to the public under the Apache License 2.0.
4
5 local netmod = luci.model.network
6
7 local _, p
8 for _, p in ipairs({"dslite"}) do
9
10         local proto = netmod:register_protocol(p)
11
12         function proto.get_i18n(self)
13                 if p == "dslite" then
14                         return luci.i18n.translate("Dual-Stack Lite (RFC6333)")
15                 end
16         end
17
18         function proto.ifname(self)
19                 return p .. "-" .. self.sid
20         end
21
22         function proto.opkg_package(self)
23                 if p == "dslite" then
24                         return "ds-lite"
25                 end
26         end
27
28         function proto.is_installed(self)
29                 return nixio.fs.access("/lib/netifd/proto/" .. p .. ".sh")
30         end
31
32         function proto.is_floating(self)
33                 return true
34         end
35
36         function proto.is_virtual(self)
37                 return true
38         end
39
40         function proto.get_interfaces(self)
41                 return nil
42         end
43
44         function proto.contains_interface(self, ifname)
45                 return (netmod:ifnameof(ifc) == self:ifname())
46         end
47
48         netmod:register_pattern_virtual("^%s-%%w" % p)
49 end