qos.lua 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. -- Copyright 2008 Steven Barth <steven@midlink.org>
  2. -- Licensed to the public under the Apache License 2.0.
  3. local wa = require "luci.tools.webadmin"
  4. local fs = require "nixio.fs"
  5. m = Map("qos", translate("Quality of Service"),
  6. translate("With <abbr title=\"Quality of Service\">QoS</abbr> you " ..
  7. "can prioritize network traffic selected by addresses, " ..
  8. "ports or services."))
  9. s = m:section(TypedSection, "interface", translate("Interfaces"))
  10. s.addremove = true
  11. s.anonymous = false
  12. e = s:option(Flag, "enabled", translate("Enable"))
  13. e.rmempty = false
  14. c = s:option(ListValue, "classgroup", translate("Classification group"))
  15. c:value("Default", translate("default"))
  16. c.default = "Default"
  17. s:option(Flag, "overhead", translate("Calculate overhead"))
  18. s:option(Flag, "halfduplex", translate("Half-duplex"))
  19. dl = s:option(Value, "download", translate("Download speed (kbit/s)"))
  20. dl.datatype = "and(uinteger,min(1))"
  21. ul = s:option(Value, "upload", translate("Upload speed (kbit/s)"))
  22. ul.datatype = "and(uinteger,min(1))"
  23. s = m:section(TypedSection, "classify", translate("Classification Rules"))
  24. s.template = "cbi/tblsection"
  25. s.anonymous = true
  26. s.addremove = true
  27. s.sortable = true
  28. t = s:option(ListValue, "target", translate("Target"))
  29. t:value("Priority", translate("priority"))
  30. t:value("Express", translate("express"))
  31. t:value("Normal", translate("normal"))
  32. t:value("Bulk", translate("low"))
  33. t.default = "Normal"
  34. srch = s:option(Value, "srchost", translate("Source host"))
  35. srch.rmempty = true
  36. srch:value("", translate("all"))
  37. wa.cbi_add_knownips(srch)
  38. dsth = s:option(Value, "dsthost", translate("Destination host"))
  39. dsth.rmempty = true
  40. dsth:value("", translate("all"))
  41. wa.cbi_add_knownips(dsth)
  42. p = s:option(Value, "proto", translate("Protocol"))
  43. p:value("", translate("all"))
  44. p:value("tcp", "TCP")
  45. p:value("udp", "UDP")
  46. p:value("icmp", "ICMP")
  47. p.rmempty = true
  48. ports = s:option(Value, "ports", translate("Ports"))
  49. ports.rmempty = true
  50. ports:value("", translate("all"))
  51. bytes = s:option(Value, "connbytes", translate("Number of bytes"))
  52. comment = s:option(Value, "comment", translate("Comment"))
  53. return m