break;
}
+ /*
+ * While UNIONs are named, it's nicer to hide them.
+ * Therefore we automatically add an ALIAS in the unions
+ * parent, for the child in the union.
+ */
+ if (parent->type == FR_TYPE_UNION) {
+ fr_assert(parent->parent);
+
+ if (dict_attr_alias_add(parent->parent, da->name, da) < 0) {
+ goto error;
+ }
+ }
+
return 0;
}
}
if (parent->type == FR_TYPE_UNION) {
- fr_strerror_printf("Parent attribute %s is of type 'union', and can only have STRUCT children",
+ fr_strerror_printf("Parent attribute %s is of type 'union', and cannot use DEFINE for children",
parent->name);
return -1;
}
+
#
# UNION tests
#
encode-pair Test-Struct2 = { Data = { Sub-Struct = { Nested-Uint1 = 33, Nested-Uint2 = 18 } } }
match fd 05 01 21 12
+#
+# Skip the UNION
+#
+pair Test-Struct2 = { Sub-Struct = { Nested-Uint1 = 33, Nested-Uint2 = 18 } }
+match Test-Struct2 = { Data = { Sub-Struct = { Nested-Uint1 = 33, Nested-Uint2 = 18 } } }
+
+encode-pair Test-Struct2 = { Sub-Struct = { Nested-Uint1 = 33, Nested-Uint2 = 18 } }
+match fd 05 01 21 12
+
#
# Wrong Key-Field - it gets over-written
#
#
count
-match 24
+match 28