1
0

proto_aiccu.lua 981 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. -- Copyright 2015 Paul Oranje <por@xs4all.nl>
  2. -- Licensed to the public under GPLv2
  3. local netmod = luci.model.network
  4. local interface = luci.model.network.interface
  5. local proto = netmod:register_protocol("aiccu")
  6. function proto.get_i18n(self)
  7. return luci.i18n.translate("AICCU (SIXXS)")
  8. end
  9. function proto.ifname(self)
  10. return "aiccu-" .. self.sid
  11. end
  12. function proto.get_interface(self)
  13. return interface(self:ifname(), self)
  14. end
  15. function proto.is_installed(self)
  16. return nixio.fs.access("/lib/netifd/proto/aiccu.sh")
  17. end
  18. function proto.opkg_package(self)
  19. return "aiccu"
  20. end
  21. function proto.is_floating(self)
  22. return true
  23. end
  24. function proto.is_virtual(self)
  25. return true
  26. end
  27. function proto.get_interfaces(self)
  28. return nil
  29. end
  30. function proto.contains_interface(self, ifname)
  31. if self:is_floating() then
  32. return (netmod:ifnameof(ifc) == self:ifname())
  33. else
  34. return netmod.protocol.contains_interface(self, ifc)
  35. end
  36. end
  37. netmod:register_pattern_virtual("^aiccu-%%w")