Hello.
I'm using ubus_subscribe this way:
uloop_init();
/* Network callback */
sub.cb = dashboard_network_cb;
ubus_register_subscriber( ctx, &sub );
rc = ubus_lookup_id( ctx, "network.interface.lan", &id );
if( !rc )
rc = ubus_subscribe( ctx, &sub, id );
if( rc )
{
fprintf( stderr, "Error while registering for network event: %s\n",
ubus_strerror(rc) );
goto _fin;
}
ubus_add_uloop(ctx);
uloop_run();
uloop_done();
The prototype of sub.cb callback is
typedef int (*ubus_handler_t)(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req,
const char *method, struct blob_attr *msg);
meaning that it should return int and I assume it is a return code. But I can't see what is the purpose of this code. If my callback returns non zero value what will happen?