Skip to content

v4.0.0

Choose a tag to compare

@github-actions github-actions released this 27 Jun 01:37
· 4 commits to main since this release
Release v4.0.0

Update the json_cpp submodule to v5.0.0 and substantially extend the wrapper.

Fixes:
- Use a local blob_buf in the request handler and in call() instead of a shared
  global, removing a reentrancy hazard when a call() pumps the loop while a
  request arrives (or a handler issues a call).
- Free the blobmsg_format_json() result (previously leaked on every request).
- Map JSON int to BLOBMSG_TYPE_INT64 (was INT32) in method argument policy.
- Drop the unnecessary -luci link (the code uses no uci; OpenWrt and Alpine both
  link fine without it).
- Link order: pass libraries after the objects, so it links on modern
  --as-needed toolchains (e.g. Alpine), not only on OpenWrt's lenient ld.

New capabilities:
- Deferred replies: a method may set dcb and reply later via a copyable
  ubus::request handle (request.reply()/valid()) - slow work no longer blocks
  the event loop.
- Asynchronous calls: call_async(obj, cmd, args, cb) with cb(result, ok).
- Events: send_event() to broadcast and add_event_handler(pattern, cb) to listen.
- Auto-reconnect (on by default): survive a ubusd restart, re-registering all
  objects and event handlers; also makes construction safe when ubusd is down.

The synchronous cb and call() API is unchanged, so existing code keeps working.

Docs/CI:
- README rewritten as a full API reference with examples.
- build.yml: CI build on push/pull_request in an Alpine (edge/testing) container
  that provides libubox/ubus; release workflow bumped to checkout@v5 and @v2 actions.

Verified on a live ubus: sync + deferred (500ms defer) methods, async call,
event send/receive, all working.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Oskari Rauta <oskari.rauta@gmail.com>