+ r = type_system_get_type_system(m->container_type_system[m->n_containers],
+ &m->container_type_system[m->n_containers + 1],
+ type);
+ if (r < 0)
+ return r;
+
+ r = add_rtattr(m, type | NLA_F_NESTED, NULL, size);
+ if (r < 0)
+ return r;
+
+ m->container_offsets[m->n_containers ++] = r;
+
+ return 0;
+}
+
+int sd_rtnl_message_open_container_union(sd_rtnl_message *m, unsigned short type, const char *key) {
+ const NLTypeSystemUnion *type_system_union;
+ int r;
+
+ assert_return(m, -EINVAL);
+ assert_return(!m->sealed, -EPERM);
+
+ r = type_system_get_type_system_union(m->container_type_system[m->n_containers], &type_system_union, type);
+ if (r < 0)
+ return r;
+
+ r = type_system_union_get_type_system(type_system_union,
+ &m->container_type_system[m->n_containers + 1],
+ key);
+ if (r < 0)
+ return r;
+
+ r = sd_rtnl_message_append_string(m, type_system_union->match, key);
+ if (r < 0)
+ return r;
+
+ /* do we evere need non-null size */
+ r = add_rtattr(m, type, NULL, 0);
+ if (r < 0)
+ return r;
+
+ m->container_offsets[m->n_containers ++] = r;
+
+ return 0;
+}
+
+
+int sd_rtnl_message_close_container(sd_rtnl_message *m) {
+ assert_return(m, -EINVAL);
+ assert_return(!m->sealed, -EPERM);
+ assert_return(m->n_containers > 0, -EINVAL);
+
+ m->container_type_system[m->n_containers] = NULL;
+ m->n_containers --;
+
+ return 0;
+}
+
+int rtnl_message_read_internal(sd_rtnl_message *m, unsigned short type, void **data) {
+ struct rtattr *rta;
+
+ assert_return(m, -EINVAL);
+ assert_return(m->sealed, -EPERM);
+ assert_return(data, -EINVAL);
+ assert(m->n_containers <= RTNL_CONTAINER_DEPTH);
+ assert(m->rta_offset_tb[m->n_containers]);
+ assert(type < m->rta_tb_size[m->n_containers]);
+
+ if(!m->rta_offset_tb[m->n_containers][type])
+ return -ENODATA;
+
+ rta = (struct rtattr*)((uint8_t *) m->hdr + m->rta_offset_tb[m->n_containers][type]);
+
+ *data = RTA_DATA(rta);
+
+ return RTA_PAYLOAD(rta);
+}
+
+int sd_rtnl_message_read_string(sd_rtnl_message *m, unsigned short type, const char **data) {
+ int r;
+ void *attr_data;
+
+ assert_return(m, -EINVAL);
+
+ r = message_attribute_has_type(m, type, NLA_STRING);
+ if (r < 0)
+ return r;
+
+ r = rtnl_message_read_internal(m, type, &attr_data);
+ if (r < 0)
+ return r;
+ else if (strnlen(attr_data, r) >= (size_t) r)
+ return -EIO;
+
+ if (data)
+ *data = (const char *) attr_data;
+
+ return 0;
+}
+
+int sd_rtnl_message_read_u8(sd_rtnl_message *m, unsigned short type, uint8_t *data) {
+ int r;
+ void *attr_data;