Merge pull request #315 from poranje/proto-ipv6+aiccu
[project/luci.git] / protocols / luci-proto-ipv6 / luasrc / model / network / proto_aiccu.lua
1 -- Copyright 2015 Paul Oranje <por@xs4all.nl>
2 -- Licensed to the public under GPLv2
3
4 local netmod = luci.model.network
5 local interface = luci.model.network.interface
6
7 local proto = netmod:register_protocol("aiccu")
8
9 function proto.get_i18n(self)
10         return luci.i18n.translate("AICCU (SIXXS)")
11 end
12
13 function proto.ifname(self)
14         return "aiccu-" .. self.sid
15 end
16
17 function proto.get_interface(self)
18         return interface(self:ifname(), self)
19 end
20
21 function proto.is_installed(self)
22         return nixio.fs.access("/lib/netifd/proto/aiccu.sh")
23 end
24
25 function proto.opkg_package(self)
26         return "aiccu"
27 end
28
29 function proto.is_floating(self)
30         return true
31 end
32
33 function proto.is_virtual(self)
34         return true
35 end
36
37 function proto.get_interfaces(self)
38         return nil
39 end
40
41 function proto.contains_interface(self, ifname)
42         if self:is_floating() then
43                 return (netmod:ifnameof(ifc) == self:ifname())
44         else
45                 return netmod.protocol.contains_interface(self, ifc)
46         end
47 end
48
49 netmod:register_pattern_virtual("^aiccu-%%w")