/*
* rpcd - UBUS RPC server
*
- * Copyright (C) 2013 Jo-Philipp Wich <jow@openwrt.org>
+ * Copyright (C) 2013-2014 Jo-Philipp Wich <jow@openwrt.org>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include "plugin.h"
+#include <rpcd/plugin.h>
static struct blob_buf buf;
{
if (c->obj)
{
- if (json_object_get_type(c->obj) == json_type_object ||
- json_object_get_type(c->obj) == json_type_array)
- {
- blobmsg_add_json_element(blob, NULL, c->obj);
+ if (json_object_get_type(c->obj) == json_type_object &&
+ blobmsg_add_object(blob, c->obj))
rv = UBUS_STATUS_OK;
- }
json_object_put(c->obj);
}
struct blob_attr *attr;
struct blobmsg_policy *policy = NULL;
- if (!sig || blob_id(sig) != BLOBMSG_TYPE_TABLE)
+ if (!sig || blobmsg_type(sig) != BLOBMSG_TYPE_TABLE)
return false;
n_attr = 0;
blobmsg_for_each_attr(attr, sig, rem)
{
- type = blob_id(attr);
+ type = blobmsg_type(attr);
if (type == BLOBMSG_TYPE_INT32)
{
if (!obj_type)
return NULL;
- asprintf((char **)&obj_type->name, "luci-rpc-plugin-%s", name);
+ if (asprintf((char **)&obj_type->name, "luci-rpc-plugin-%s", name) < 0)
+ return NULL;
+
obj_type->methods = methods;
obj_type->n_methods = n_method;
.session_create_cb = rpc_session_create_cb,
.session_destroy_cb = rpc_session_destroy_cb,
.exec = rpc_exec,
+ .exec_timeout = &rpc_exec_timeout,
};
static int
struct rpc_plugin *p;
void *dlh;
- dlh = dlopen(path, RTLD_LAZY | RTLD_GLOBAL);
+ dlh = dlopen(path, RTLD_LAZY | RTLD_LOCAL);
if (!dlh)
return UBUS_STATUS_UNKNOWN_ERROR;