blobmsg: allow data/length iterator/accessor functions to work on non-blobmsg elements
[project/libubox.git] / blob.h
diff --git a/blob.h b/blob.h
index fa430a8..37a572b 100644 (file)
--- a/blob.h
+++ b/blob.h
@@ -42,10 +42,11 @@ enum {
        BLOB_ATTR_LAST
 };
 
-#define BLOB_ATTR_ID_MASK  0xff000000
+#define BLOB_ATTR_ID_MASK  0x7f000000
 #define BLOB_ATTR_ID_SHIFT 24
 #define BLOB_ATTR_LEN_MASK 0x00ffffff
 #define BLOB_ATTR_ALIGN    4
+#define BLOB_ATTR_EXTENDED 0x80000000
 
 struct blob_attr {
        uint32_t id_len;
@@ -85,6 +86,12 @@ blob_id(const struct blob_attr *attr)
        return id;
 }
 
+static inline bool
+blob_is_extended(const struct blob_attr *attr)
+{
+       return !!(attr->id_len & cpu_to_be32(BLOB_ATTR_EXTENDED));
+}
+
 /*
  * blob_len: returns the length of the attribute's payload
  */