diff options
author | Felix Fietkau <nbd@openwrt.org> | 2012-05-31 18:18:52 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2012-05-31 18:18:52 +0200 |
commit | 9cabaeb8a525ba050fb2dcf1204b6cb56a65a330 (patch) | |
tree | a14e5d65d41ae5c9608d5c365892800e815b024a /ubus.c | |
parent | b7abfa09bd4c3ecb8936244dcfe0fc720a0e03ee (diff) |
add an ubus method for dumping available protocol handlers
Diffstat (limited to 'ubus.c')
-rw-r--r-- | ubus.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -92,10 +92,23 @@ netifd_add_host_route(struct ubus_context *ctx, struct ubus_object *obj, return 0; } +static int +netifd_get_proto_handlers(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *req, const char *method, + struct blob_attr *msg) +{ + blob_buf_init(&b, 0); + proto_dump_handlers(&b); + ubus_send_reply(ctx, req, b.head); + + return 0; +} + static struct ubus_method main_object_methods[] = { { .name = "restart", .handler = netifd_handle_restart }, { .name = "reload", .handler = netifd_handle_reload }, UBUS_METHOD("add_host_route", netifd_add_host_route, route_policy), + { .name = "get_proto_handlers", .handler = netifd_get_proto_handlers }, }; static struct ubus_object_type main_object_type = |