3 (c) 2009 Steven Barth <steven@midlink.org>
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
9 http://www.apache.org/licenses/LICENSE-2.0
14 local util = require "luci.util"
15 local rawget, setmetatable = rawget, setmetatable
18 --- Transparent UCI over RPC client.
20 module "luci.rpcc.ruci"
23 local Proxy = util.class()
25 --- Create a new UCI over RPC proxy.
26 -- @param rpccl RPC client
27 -- @return Network transparent UCI module
28 function factory(rpccl)
30 cursor = function(...)
31 return Proxy(rpccl, rpccl:request("ruci.cursor", {...}))
33 cursor_state = function(...)
34 return Proxy(rpccl, rpccl:request("ruci.cursor_state", {...}))
39 function Proxy.__init__(self, rpccl, objid)
44 __index = function(self, key)
45 return rawget(self, key) or Proxy[key] or function(self, ...)
46 local argv = {self.__objid, ...}
47 return self.__rpccl:request("ruci."..key, argv)
53 function Proxy.foreach(self, config, section, callback)
54 local sections = self.__rpccl:request("ruci.foreach", {self.__objid, config, section})
56 for _, s in ipairs(sections) do