+/* ----------- rpc ----------- */
+
+/* invoke a method on a specific object */
+int ubus_invoke(struct ubus_context *ctx, uint32_t obj, const char *method,
+ struct blob_attr *msg, ubus_data_handler_t cb, void *priv,
+ int timeout);
+
+/* asynchronous version of ubus_invoke() */
+int ubus_invoke_async(struct ubus_context *ctx, uint32_t obj, const char *method,
+ struct blob_attr *msg, struct ubus_request *req);
+
+/* send a reply to an incoming object method call */
+int ubus_send_reply(struct ubus_context *ctx, struct ubus_request_data *req,
+ struct blob_attr *msg);
+
+static inline void ubus_defer_request(struct ubus_context *ctx,
+ struct ubus_request_data *req,
+ struct ubus_request_data *new_req)
+{
+ memcpy(new_req, req, sizeof(*req));
+ req->deferred = true;
+}
+
+static inline void ubus_request_set_fd(struct ubus_context *ctx,
+ struct ubus_request_data *req, int fd)
+{
+ req->fd = fd;
+}
+
+void ubus_complete_deferred_request(struct ubus_context *ctx,
+ struct ubus_request_data *req, int ret);
+
+/*
+ * send a notification to all subscribers of an object
+ * if timeout < 0, no reply is expected from subscribers
+ */
+int ubus_notify(struct ubus_context *ctx, struct ubus_object *obj,
+ const char *type, struct blob_attr *msg, int timeout);
+
+int ubus_notify_async(struct ubus_context *ctx, struct ubus_object *obj,
+ const char *type, struct blob_attr *msg,
+ struct ubus_notify_request *req);
+
+
+/* ----------- events ----------- */
+
+int ubus_send_event(struct ubus_context *ctx, const char *id,
+ struct blob_attr *data);
+
+int ubus_register_event_handler(struct ubus_context *ctx,
+ struct ubus_event_handler *ev,
+ const char *pattern);
+
+static inline int ubus_unregister_event_handler(struct ubus_context *ctx,
+ struct ubus_event_handler *ev)
+{
+ return ubus_remove_object(ctx, &ev->obj);
+}
+
+#endif