X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fubus.git;a=blobdiff_plain;f=libubus.h;h=33a99aafd317c8d4680324a62e6566c5630412b2;hp=6c560b4fe5b380f324356ba129499b4b788b5f27;hb=7e746e5a850b1c5ef87b8d8538e921f2051f5471;hpb=3869e0ca0774e8f17597db5b60bee97d21b5b1fa;ds=sidebyside diff --git a/libubus.h b/libubus.h index 6c560b4..33a99aa 100644 --- a/libubus.h +++ b/libubus.h @@ -34,10 +34,16 @@ struct ubus_event_handler; struct ubus_subscriber; struct ubus_notify_request; +struct ubus_msghdr_buf { + struct ubus_msghdr hdr; + struct blob_attr *data; +}; + static inline struct blob_attr * ubus_msghdr_data(struct ubus_msghdr *hdr) { - return (struct blob_attr *) (hdr + 1); + struct ubus_msghdr_buf *hdrbuf = container_of(hdr, typeof(*hdrbuf), hdr); + return hdrbuf->data; } typedef void (*ubus_lookup_handler_t)(struct ubus_context *ctx, @@ -148,10 +154,7 @@ struct ubus_context { void (*connection_lost)(struct ubus_context *ctx); - struct { - struct ubus_msghdr hdr; - char data[UBUS_MAX_MSGLEN]; - } msgbuf; + struct ubus_msghdr_buf msgbuf; }; struct ubus_object_data {