diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2013-01-25 20:10:45 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2013-01-25 21:12:06 +0100 |
commit | 2787be7a7d916e6368ab3492f7a942cb2a4464b3 (patch) | |
tree | d3cb3f73b1f1e64bfdaab4e1e207b4dd0475e402 /ubus.c | |
parent | 3f17deb1c41a6352f28b3e9f665a17b9231768e1 (diff) |
ubus: pass json rpc arguments to called ubus functions
Diffstat (limited to 'ubus.c')
-rw-r--r-- | ubus.c | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -233,15 +233,21 @@ static void uh_ubus_single_error(struct client *cl, enum rpc_error type) ops->request_done(cl); } -static void uh_ubus_send_request(struct client *cl, json_object *obj) +static void uh_ubus_send_request(struct client *cl, json_object *obj, struct blob_attr *args) { struct dispatch *d = &cl->dispatch; struct dispatch_ubus *du = &d->ubus; - int ret; + struct blob_attr *cur; + static struct blob_buf req; + int ret, rem; + + blob_buf_init(&req, 0); + blobmsg_for_each_attr(cur, args, rem) + blobmsg_add_blob(&req, cur); blob_buf_init(&du->buf, 0); memset(&du->req, 0, sizeof(du->req)); - ret = ubus_invoke_async(ctx, du->obj, du->func, buf.head, &du->req); + ret = ubus_invoke_async(ctx, du->obj, du->func, req.head, &du->req); if (ret) return uh_ubus_json_error(cl, ERROR_INTERNAL); @@ -376,7 +382,7 @@ static void uh_ubus_handle_request_object(struct client *cl, struct json_object goto error; } - uh_ubus_send_request(cl, obj); + uh_ubus_send_request(cl, obj, data.data); return; error: |