proto_vpnc.lua 937 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. -- Copyright 2015 Daniel Dickinson <openwrt@daniel.thecshore.com>
  2. -- Licensed to the public under the Apache License 2.0.
  3. local netmod = luci.model.network
  4. local interface = luci.model.network.interface
  5. local proto = netmod:register_protocol("vpnc")
  6. function proto.get_i18n(self)
  7. return luci.i18n.translate("VPNC (CISCO 3000 (and others) VPN)")
  8. end
  9. function proto.ifname(self)
  10. return "vpn-" .. self.sid
  11. end
  12. function proto.get_interface(self)
  13. return interface(self:ifname(), self)
  14. end
  15. function proto.opkg_package(self)
  16. return "vpnc"
  17. end
  18. function proto.is_installed(self)
  19. return nixio.fs.access("/lib/netifd/proto/vpnc.sh")
  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, ifc)
  31. return (netmod:ifnameof(ifc) == self:ifname())
  32. end
  33. netmod:register_pattern_virtual("^vpn%-%w")