Пример #1
0
void
procd_bcast_event(char *event, struct blob_attr *msg)
{
	int ret;

	if (!notify)
		return;

	ret = ubus_notify(_ctx, &system_object, event, msg, -1);
	if (ret)
		fprintf(stderr, "Failed to notify log: %s\n", ubus_strerror(ret));
}
Пример #2
0
void ubus_event_bcast(const char *type, const char *mac, const char *ip, const char *name, const char *interface)
{
  struct ubus_context *ubus = (struct ubus_context *)daemon->ubus;
  int ret;

  if (!ubus || !notify)
    return;

  blob_buf_init(&b, BLOBMSG_TYPE_TABLE);
  if (mac)
    blobmsg_add_string(&b, "mac", mac);
  if (ip)
    blobmsg_add_string(&b, "ip", ip);
  if (name)
    blobmsg_add_string(&b, "name", name);
  if (interface)
    blobmsg_add_string(&b, "interface", interface);
  
  ret = ubus_notify(ubus, &ubus_object, type, b.head, -1);
  if (!ret)
    my_syslog(LOG_ERR, _("Failed to send UBus event: %s"), ubus_strerror(ret));
}
static void event_broadcast(char *event)
{
    //prepare event argument if necessary
    // N6.  Broadcast the event notification to bus
    ubus_notify(ctx,  &test_object, event, NULL, -1);
}