- if (hdr->version != 0)
- return false;
-
- if (blob_raw_len(hdr->data) < sizeof(*hdr->data))
- return false;
-
- if (blob_raw_len(hdr->data) + sizeof(*hdr) > UBUS_MAX_MSGLEN)
- return false;
-
- return true;
-}
-
-static bool get_next_msg(struct ubus_context *ctx, bool wait)
-{
- struct iovec iov = STATIC_IOV(ctx->msgbuf.hdr);
-
- /* receive header + start attribute */
- iov.iov_len += sizeof(struct blob_attr);
- if (!recv_retry(ctx->sock.fd, &iov, wait))
- return false;
-
- iov.iov_len = blob_len(ctx->msgbuf.hdr.data);
- if (iov.iov_len > 0 && !recv_retry(ctx->sock.fd, &iov, true))
- return false;
-
- return ubus_validate_hdr(&ctx->msgbuf.hdr);
-}
-
-static bool ubus_get_status(struct ubus_msghdr *hdr, int *ret)
-{
- ubus_parse_msg(hdr->data);
-
- if (!attrbuf[UBUS_ATTR_STATUS])
- return false;
-
- *ret = blob_get_int32(attrbuf[UBUS_ATTR_STATUS]);
- return true;
-}