1 -- Copyright 2009 Steven Barth <steven@midlink.org>
2 -- Licensed to the public under the Apache License 2.0.
4 local util = require "luci.util"
5 local rawget, setmetatable = rawget, setmetatable
8 --- Transparent UCI over RPC client.
10 module "luci.rpcc.ruci"
13 local Proxy = util.class()
15 --- Create a new UCI over RPC proxy.
16 -- @param rpccl RPC client
17 -- @return Network transparent UCI module
18 function factory(rpccl)
20 cursor = function(...)
21 return Proxy(rpccl, rpccl:request("ruci.cursor", {...}))
23 cursor_state = function(...)
24 return Proxy(rpccl, rpccl:request("ruci.cursor_state", {...}))
29 function Proxy.__init__(self, rpccl, objid)
34 __index = function(self, key)
35 return rawget(self, key) or Proxy[key] or function(self, ...)
36 local argv = {self.__objid, ...}
37 return self.__rpccl:request("ruci."..key, argv)
43 function Proxy.foreach(self, config, section, callback)
44 local sections = self.__rpccl:request("ruci.foreach", {self.__objid, config, section})
46 for _, s in ipairs(sections) do