proto_3g.lua 989 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. -- Copyright 2018 Florian Eckert <fe@dev.tdt.de>
  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("3g")
  6. function proto.get_i18n(self)
  7. return luci.i18n.translate("UMTS/GPRS/EV-DO")
  8. end
  9. function proto.ifname(self)
  10. return "3g-" .. 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/3g.sh")
  17. end
  18. function proto.opkg_package(self)
  19. return "comgt"
  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. 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("^3g%-%w")