19 struct list_head
list;
21 struct blob_attr
data[];
26 struct blob_attr **attr;
46 list_del(&
data->list);
54 struct blob_attr *msg,
int cmd, uint32_t
peer)
57 if (msg && blob_pad_len(msg) > UBUS_MAX_MSGLEN)
60 INIT_LIST_HEAD(&req->
list);
70 struct blob_attr *msg,
int cmd, uint32_t
peer)
72 memset(req, 0,
sizeof(*req));
82 if (list_empty(&req->
list))
87 list_del_init(&req->
list);
92 if (!list_empty(&req->
list))
113 if (!list_empty(&req->
list))
114 list_del_init(&req->
list);
134 clock_gettime(CLOCK_MONOTONIC, &ts);
135 val = (int64_t) ts.tv_sec * 1000LL;
136 val += ts.tv_nsec / 1000000LL;
145 int64_t
timeout = 0, time_end = 0;
191 blob_buf_init(&
b, 0);
206 struct blob_attr *msg)
210 blob_buf_init(&
b, 0);
221 const char *method,
struct blob_attr *msg,
224 blob_buf_init(&
b, 0);
229 memset(req, 0,
sizeof(*req));
278 const char *
type,
struct blob_attr *msg,
281 memset(
req, 0,
sizeof(*
req));
283 blob_buf_init(&
b, 0);
297 req->id[0] = obj->
id;
305 const char *
type,
struct blob_attr *msg,
312 const char *
type,
struct blob_attr *msg,
int timeout)
370 len = blob_raw_len(buf->
data);
371 data = calloc(1,
sizeof(*
data) + len);
386 for (i = 0; pending; i++, pending >>= 1) {
390 if (n->
id[i] == objid)
427 struct blob_attr **tb;
428 struct blob_attr *cur;
441 if (!blob_check_type(blob_data(cur), blob_len(cur), BLOB_ATTR_INT32))
445 nreq->
id[idx] = blob_get_int32(cur);
497 blob_buf_init(&
b, 0);
int(* cb)(struct ubus_context *ctx, int argc, char **argv)
static struct ubus_context * ctx
int ubus_send_msg(struct ubus_context *ctx, uint32_t seq, struct blob_attr *msg, int cmd, uint32_t peer, int fd)
void __hidden ubus_poll_data(struct ubus_context *ctx, int timeout)
struct blob_attr ** ubus_parse_msg(struct blob_attr *msg, size_t len)
static struct blob_attr * attrbuf[UBUS_ATTR_MAX]
void ubus_complete_deferred_request(struct ubus_context *ctx, struct ubus_request_data *req, int ret)
static void ubus_process_req_data(struct ubus_request *req, struct ubus_msghdr_buf *buf)
static void ubus_put_data(struct blob_buf *buf, struct blob_attr *msg)
int ubus_notify(struct ubus_context *ctx, struct ubus_object *obj, const char *type, struct blob_attr *msg, int timeout)
static int ubus_process_req_status(struct ubus_request *req, struct ubus_msghdr_buf *buf)
static void req_data_cb(struct ubus_request *req, int type, struct blob_attr *data)
int ubus_complete_request(struct ubus_context *ctx, struct ubus_request *req, int req_timeout)
int __hidden ubus_start_request(struct ubus_context *ctx, struct ubus_request *req, struct blob_attr *msg, int cmd, uint32_t peer)
int ubus_invoke_async_fd(struct ubus_context *ctx, uint32_t obj, const char *method, struct blob_attr *msg, struct ubus_request *req, int fd)
int ubus_invoke_fd(struct ubus_context *ctx, uint32_t obj, const char *method, struct blob_attr *msg, ubus_data_handler_t cb, void *priv, int timeout, int fd)
static bool ubus_get_status(struct ubus_msghdr_buf *buf, int *ret)
void __hidden ubus_process_req_msg(struct ubus_context *ctx, struct ubus_msghdr_buf *buf, int fd)
static int64_t get_time_msec(void)
int __hidden __ubus_start_request(struct ubus_context *ctx, struct ubus_request *req, struct blob_attr *msg, int cmd, uint32_t peer)
void ubus_abort_request(struct ubus_context *ctx, struct ubus_request *req)
static void ubus_set_req_status(struct ubus_request *req, int ret)
static void __ubus_process_req_data(struct ubus_request *req)
static void ubus_req_complete_cb(struct ubus_request *req)
int ubus_send_reply(struct ubus_context *ctx, struct ubus_request_data *req, struct blob_attr *msg)
static void ubus_notify_complete_cb(struct ubus_request *req, int ret)
static void ubus_sync_req_cb(struct ubus_request *req, int ret)
int ubus_notify_async(struct ubus_context *ctx, struct ubus_object *obj, const char *type, struct blob_attr *msg, struct ubus_notify_request *req)
static int __ubus_notify_async(struct ubus_context *ctx, struct ubus_object *obj, const char *type, struct blob_attr *msg, struct ubus_notify_request *req, bool reply)
void ubus_complete_request_async(struct ubus_context *ctx, struct ubus_request *req)
static void ubus_process_notify_status(struct ubus_request *req, int id, struct ubus_msghdr_buf *buf)
int __ubus_monitor(struct ubus_context *ctx, const char *type)
static struct ubus_request * ubus_find_request(struct ubus_context *ctx, uint32_t seq, uint32_t peer, int *id)
static int ubus_find_notify_id(struct ubus_notify_request *n, uint32_t objid)
static void ubus_notify_data_cb(struct ubus_request *req, int type, struct blob_attr *msg)
const struct ubus_method watch_method __hidden
void(* ubus_complete_handler_t)(struct ubus_request *req, int ret)
#define UBUS_MAX_NOTIFY_PEERS
void(* ubus_data_handler_t)(struct ubus_request *req, int type, struct blob_attr *msg)
static 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)
struct uloop_timeout pending_timer
struct list_head requests
ubus_notify_complete_handler_t complete_cb
ubus_notify_complete_handler_t status_cb
ubus_notify_data_handler_t data_cb
ubus_data_handler_t raw_data_cb
ubus_complete_handler_t complete_cb
ubus_data_handler_t data_cb
struct ubus_context * ctx
#define UBUS_SYSTEM_OBJECT_MONITOR
@ UBUS_STATUS_INVALID_ARGUMENT
@ UBUS_STATUS_CONNECTION_FAILED