chiark / gitweb /
bus: demarshal gvariant
[elogind.git] / src / libsystemd-bus / bus-message.h
index b862cb9443b60cde358d2b7d91faab032ee22585..75a560b3c0f5f4336ee93f47bf28cb26f958e67f 100644 (file)
 
 struct bus_container {
         char enclosing;
+        bool need_offsets:1;
 
+        /* Indexes into the signature  string */
         unsigned index, saved_index;
-
         char *signature;
 
-        uint32_t *array_size;
-        size_t before, begin;
+        size_t before, begin, end;
 
-        size_t *offsets;
-        size_t n_offsets, n_allocated;
+        /* dbus1: pointer to the array size value, if this is a value */
+        uint32_t *array_size;
 
-        bool need_offsets;
+        /* gvariant: list of offsets to end of children if this is struct/dict entry/array */
+        size_t *offsets, n_offsets, n_offsets_allocated, offset_index;
+        size_t item_size;
 };
 
 struct bus_header {
@@ -98,7 +100,6 @@ struct sd_bus_message {
         bool free_fds:1;
         bool release_kdbus:1;
         bool poisoned:1;
-        bool is_gvariant:1;
 
         struct bus_header *header;
         struct bus_body_part body;
@@ -180,6 +181,10 @@ static inline void* BUS_MESSAGE_FIELDS(sd_bus_message *m) {
         return (uint8_t*) m->header + sizeof(struct bus_header);
 }
 
+static inline bool BUS_MESSAGE_IS_GVARIANT(sd_bus_message *m) {
+        return m->header->version == 2;
+}
+
 int bus_message_seal(sd_bus_message *m, uint64_t serial);
 int bus_message_get_blob(sd_bus_message *m, void **buffer, size_t *sz);
 int bus_message_read_strv_extend(sd_bus_message *m, char ***l);