コード例 #1
0
ファイル: rrdns.c プロジェクト: jow-/luci-ng
static int
rpc_rrdns_api_init(const struct rpc_daemon_ops *o, struct ubus_context *ctx)
{
    static const struct ubus_method rrdns_methods[] = {
        UBUS_METHOD("lookup", rpc_rrdns_lookup, rpc_lookup_policy),
    };

    static struct ubus_object_type rrdns_type =
        UBUS_OBJECT_TYPE("luci-rpc-rrdns", rrdns_methods);

    static struct ubus_object obj = {
        .name = "luci2.network.rrdns",
        .type = &rrdns_type,
        .methods = rrdns_methods,
        .n_methods = ARRAY_SIZE(rrdns_methods),
    };

    return ubus_add_object(ctx, &obj);
}

struct rpc_plugin rpc_plugin = {
    .init = rpc_rrdns_api_init
};
コード例 #2
0
	blobmsg_add_string(&b, "info", info);
	free(info);

	ubus_send_reply(ctx, req, b.head);

	blob_buf_free(&b);
	return 0;

error:
	blob_buf_free(&b);
	return -1;

}

static const struct ubus_method easycwmp_methods[] = {
	UBUS_METHOD("notify", easycwmpd_handle_notify, notify_policy),
	UBUS_METHOD("inform", easycwmpd_handle_inform, inform_policy),
	UBUS_METHOD("command", easycwmpd_handle_command, command_policy),
};

static struct ubus_object_type main_object_type =
	UBUS_OBJECT_TYPE("easycwmpd", easycwmp_methods);

static struct ubus_object main_object = {
	.name = "tr069",
	.type = &main_object_type,
	.methods = easycwmp_methods,
	.n_methods = ARRAY_SIZE(easycwmp_methods),
};

int
コード例 #3
0
ファイル: ubus.c プロジェクト: KanjiMonster/freecwmp
	return 0;
}

static int
freecwmpd_handle_reload(struct ubus_context *ctx, struct ubus_object *obj,
			struct ubus_request_data *req, const char *method,
			struct blob_attr *msg)
{
	freecwmp_log_message(NAME, L_NOTICE, "triggered ubus reload\n");
	freecwmp_reload();

	return 0;
}

static const struct ubus_method freecwmp_methods[] = {
	UBUS_METHOD("notify", freecwmpd_handle_notify, notify_policy),
	UBUS_METHOD("inform", freecwmpd_handle_inform, inform_policy),
	{ .name = "reload", .handler = freecwmpd_handle_reload },
};

static struct ubus_object_type main_object_type =
	UBUS_OBJECT_TYPE("freecwmpd", freecwmp_methods);

static struct ubus_object main_object = {
	.name = "tr069",
	.type = &main_object_type,
	.methods = freecwmp_methods,
	.n_methods = ARRAY_SIZE(freecwmp_methods),
};

int
コード例 #4
0
ファイル: vlan.c プロジェクト: sevennothing/lros
	

returnMsg:
	blob_buf_init(&b, 0);
	blobmsg_add_string(&b, "msg",pmsg);
	blobmsg_add_u16(&b,"resCode", resCode);

	req->deferred = false;
	ubus_send_reply(ctx, req, b.head);

	return UBUS_STATUS_OK;

}

static struct ubus_method vlan_methods[] = {
	UBUS_METHOD("new", vlan_new, vlan_new_policy),
	UBUS_METHOD("find", vlan_find, vlan_find_policy),
	UBUS_METHOD("delete", vlan_delete, vlan_delete_policy),
	UBUS_METHOD("port", vlan_port, vlan_port_policy), //* vlan 中的端口属性 */

	UBUS_METHOD("mstp", vlan_mstp, vlan_mstp_policy),/* 802.1q 13章 增加MSTP*/

};


static struct ubus_object_type vlan_object_type = 
	UBUS_OBJECT_TYPE("vlan", vlan_methods);


static struct ubus_object vlan_object = {
	.name = "bridge.swVlan",
コード例 #5
0
ファイル: ubus.c プロジェクト: gaojing2016/backup
enum
{
    LOGLEVEL,
    __LOGLEVEL_MAX
};

struct ubus_context *cloudc_ctx;

static const struct blobmsg_policy handle_loglevel_policy[] = {
    [LOGLEVEL] = { .name = "loglevel", .type = BLOBMSG_TYPE_STRING },
};

static const struct ubus_method cloudc_object_methods[] = {
    //{.name = "disable", .handler = handle_cloudc_feature_down},
    UBUS_METHOD("loglevel", handle_loglevel_update, handle_loglevel_policy),
};

static struct ubus_object_type cloudc_object_type =
UBUS_OBJECT_TYPE("cloudc", cloudc_object_methods);

static struct ubus_object cloudc_object = {
    .name = "cloudc",
    .type = &cloudc_object_type,
    .methods = cloudc_object_methods,
    .n_methods = ARRAY_SIZE(cloudc_object_methods),
};

static int handle_loglevel_update(struct ubus_context *ctx, struct ubus_object *obj,
        struct ubus_request_data *req, const char *method,
        struct blob_attr *msg)
コード例 #6
0
        sleep(1);
    }
    if (wait_count == -1) {
        blobmsg_add_string(&buf, "result", "failed");
    }

    ubus_send_reply(ctx, req, buf.head);
    return UBUS_STATUS_OK;
}




static const struct ubus_method apClient_methods[] = {
   // UBUS_METHOD("scan", apClient_scan, scan_policy),
    UBUS_METHOD("connect", apClient_connect, connect_policy),
};

static struct ubus_object_type apClient_object_type =
UBUS_OBJECT_TYPE("rewifi", apClient_methods);

static struct ubus_object apClient_object = {
    .name = "rewifi",
    .type = &apClient_object_type,
    .methods = apClient_methods,
    .n_methods = ARRAY_SIZE(apClient_methods),
};

static void server_main(void)
{
    int ret;
コード例 #7
0
ファイル: system.c プロジェクト: dresong/openwrt-procd
	fprintf(stderr, "Yikees, something went wrong. no /sbin/upgraded ?\n");
	return 0;
}

static void
procd_subscribe_cb(struct ubus_context *ctx, struct ubus_object *obj)
{
	notify = obj->has_subscribers;
}


static const struct ubus_method system_methods[] = {
	UBUS_METHOD_NOARG("board", system_board),
	UBUS_METHOD_NOARG("info",  system_info),
	UBUS_METHOD_NOARG("upgrade", system_upgrade),
	UBUS_METHOD("watchdog", watchdog_set, watchdog_policy),
	UBUS_METHOD("signal", proc_signal, signal_policy),

	/* must remain at the end as it ia not always loaded */
	UBUS_METHOD("nandupgrade", nand_set, nand_policy),
};

static struct ubus_object_type system_object_type =
	UBUS_OBJECT_TYPE("system", system_methods);

static struct ubus_object system_object = {
	.name = "system",
	.type = &system_object_type,
	.methods = system_methods,
	.n_methods = ARRAY_SIZE(system_methods),
	.subscribe_cb = procd_subscribe_cb,
コード例 #8
0
ファイル: lowLevel.c プロジェクト: sevennothing/lros
		
	//pmsg= getJsonMsg(resCode);

returnMsg:
	blob_buf_init(&b, 0);
	blobmsg_add_string(&b, "msg",pmsg);
	blobmsg_add_u16(&b,"resCode", resCode);

	req->deferred = false;
	ubus_send_reply(ctx, req, b.head);

	return UBUS_STATUS_OK;
}

static struct ubus_method lowlevel_methods[] = {
	UBUS_METHOD("swRegRD",  sw_reg_read, sw_reg_read_policy),
	UBUS_METHOD("swRegWR",  sw_reg_write, sw_reg_write_policy),
};


static struct ubus_object_type lowlevel_object_type = 
	UBUS_OBJECT_TYPE("lowlevel", lowlevel_methods);


static struct ubus_object lowlevel_object = {
	.name = "lowlevel",
	.type = &lowlevel_object_type,
	.methods = lowlevel_methods,
	.n_methods = ARRAY_SIZE(lowlevel_methods),
};