summaryrefslogtreecommitdiffhomepage
path: root/modules/rpc/luasrc/controller
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-08-22 20:04:04 +0000
committerSteven Barth <steven@midlink.org>2008-08-22 20:04:04 +0000
commit4eead17501584a09679841d75d451b19a7c234d0 (patch)
tree351625bc0972a76f5f3987253adf13cdd438c6c6 /modules/rpc/luasrc/controller
parent9c6a852939c4f16f5d82299ff7b3a10f15ac3db0 (diff)
RPC part #2
Diffstat (limited to 'modules/rpc/luasrc/controller')
-rw-r--r--modules/rpc/luasrc/controller/rpc.lua37
1 files changed, 25 insertions, 12 deletions
diff --git a/modules/rpc/luasrc/controller/rpc.lua b/modules/rpc/luasrc/controller/rpc.lua
index 41d4c59f0..dd00f63c3 100644
--- a/modules/rpc/luasrc/controller/rpc.lua
+++ b/modules/rpc/luasrc/controller/rpc.lua
@@ -14,18 +14,31 @@ $Id$
]]--
module("luci.controller.rpc", package.seeall)
-function index()
- entry({"rpc", "uci"}, call("rpc_uci")).sysauth = "root"
- entry({"rpc", "auth"}, call("rpc_auth"))
+function index()
+ local authenticator = function(validator)
+ require "luci.jsonrpc"
+ require "luci.http"
+ luci.http.setfilehandler()
+
+ local loginstat
+
+ local server = {}
+ server.login = function(...)
+ loginstat = validator(...)
+ return loginstat
+ end
+
+ luci.http.prepare_content("application/json")
+ luci.http.write(luci.jsonrpc.handle(server, luci.http.content()))
+
+ return loginstat
+ end
+
+ uci = entry({"rpc", "uci"}, call("rpc_uci"))
+ uci.sysauth = "root"
+ uci.sysauth_authenticator = authenticator
end
-function rpc_proxy(tbl, jsonrpc, method, params, id)
- local res = {luci.util.copcall(tbl[function], ...)}
- local stat = table.remove(res, 1)
-
- if not stat then
- return nil, {code=-32602, message="Invalid params.", data=table.remove(res, 1)}
- else
- return res, nil
- end
+function rpc_uci()
+ luci.http.write("HELLO THAR!")
end \ No newline at end of file