basic support for the cache flush bit
[project/mdnsd.git] / ubus.c
diff --git a/ubus.c b/ubus.c
index c5c8e04032a9bc6fb3e1fc37cc5aca14edcfe282..32e30876ed5c276ee4962e68679ef277b39316bf 100644 (file)
--- a/ubus.c
+++ b/ubus.c
@@ -34,7 +34,7 @@ mdns_reload(struct ubus_context *ctx, struct ubus_object *obj,
                struct ubus_request_data *req, const char *method,
                struct blob_attr *msg)
 {
-       service_init();
+       service_init(1);
        return 0;
 }
 
@@ -182,3 +182,16 @@ ubus_startup(void)
        conn.cb = ubus_connect_handler;
        ubus_auto_connect(&conn);
 }
+
+int ubus_service_list(ubus_data_handler_t cb)
+{
+       uint32_t id;
+       int ret;
+
+       blob_buf_init(&b, 0);
+       ret = ubus_lookup_id(&conn.ctx, "service", &id);
+       if (ret)
+               return ret;
+
+       return ubus_invoke(&conn.ctx, id, "list", b.head, cb, NULL, 5 * 1000);
+}