diff options
author | Steven Barth <steven@midlink.org> | 2009-06-14 08:51:43 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2009-06-14 08:51:43 +0000 |
commit | c47be2e727d1bb3e2e3aa415ec96be2a5f8a45b7 (patch) | |
tree | 40d9202363c5e81f9fe38b4d52a1cfa889792cda /libs/lucid-rpc/luasrc/lucid/rpc/ruci.lua | |
parent | f9263e00c1371eff6ace0252143236d6bf6f2ce2 (diff) |
GSoC: Documentation #2
Diffstat (limited to 'libs/lucid-rpc/luasrc/lucid/rpc/ruci.lua')
-rw-r--r-- | libs/lucid-rpc/luasrc/lucid/rpc/ruci.lua | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/libs/lucid-rpc/luasrc/lucid/rpc/ruci.lua b/libs/lucid-rpc/luasrc/lucid/rpc/ruci.lua index 38e57f3667..f0910c7f0b 100644 --- a/libs/lucid-rpc/luasrc/lucid/rpc/ruci.lua +++ b/libs/lucid-rpc/luasrc/lucid/rpc/ruci.lua @@ -16,8 +16,10 @@ local error, type = error, type local nixio = require "nixio" local srv = require "luci.lucid.rpc.server" +--- Remote UCI functions. module "luci.lucid.rpc.ruci" +-- Prepare the remote UCI functions. function _factory() local m = srv.Module("Remote UCI API") @@ -30,10 +32,12 @@ function _factory() return m end +-- Get the associate RUCI instance. local function getinst(session, name) return session.ruci and session.ruci[name] end +-- Set a new RUCI instance. local function setinst(session, obj) session.ruci = session.ruci or {} local name = tostring(obj):match("0x([a-z0-9]+)") @@ -41,6 +45,7 @@ local function setinst(session, obj) return name end + local Cursor = getmetatable(uci.cursor()) for name, func in pairs(Cursor) do @@ -50,14 +55,28 @@ for name, func in pairs(Cursor) do end end +--- Generate a new RUCI cursor. +-- @param session Session object +-- @param ... Parameters passed to the UCI constructor +-- @return RUCI instance function cursor(session, ...) return setinst(session, uci.cursor(...)) end +--- Generate a new RUCI state cursor. +-- @param session Session object +-- @param ... Parameters passed to the UCI constructor +-- @return RUCI instance function cursor_state(session, ...) return setinst(session, uci.cursor_state(...)) end +--- Custom foreach function. +-- @param session Session object +-- @param inst RUCI instance +-- @param config UCI config +-- @param sectiontype UCI sectiontype +-- @return section data function foreach(session, inst, config, sectiontype) local inst = getinst(session, inst) local secs = {} |