PAIR_VERIFY(vp);
+ /*
+ * Omit the union if we can.
+ */
+ if ((vp->vp_type == FR_TYPE_UNION) &&
+ (fr_pair_list_num_elements(&vp->vp_group) == 1)) {
+ parent = vp->da;
+ vp = fr_pair_list_head(&vp->vp_group);
+ }
+
if ((vp->op > T_INVALID) && (vp->op < T_TOKEN_LAST)) {
token = fr_tokens[vp->op];
} else {
FR_SBUFF_IN_CHAR_RETURN(&our_out, ':', ':');
FR_SBUFF_IN_STRCPY_RETURN(&our_out, name);
+
} else {
+
no_enumv:
FR_SBUFF_RETURN(fr_pair_print_value_quoted, &our_out, vp, T_DOUBLE_QUOTED_STRING);
}
# attribute "truncated" of type bool.
#
decode-pair fd 04 01 21
-match Test-Struct2 = { Key-Field = ::Sub-Struct, Data = { Sub-Struct = { Nested-Uint1 = 33 } } }
+match Test-Struct2 = { Key-Field = ::Sub-Struct, Sub-Struct = { Nested-Uint1 = 33 } }
#match raw.Test-Struct2 = 0x0121
#
# @todo - perhaps we want an internal attribute for "extra" data, of type octets?
#
decode-pair fd 06 01 21 12 33
-match Test-Struct2 = { Key-Field = ::Sub-Struct, Data = { Sub-Struct = { Nested-Uint1 = 33, Nested-Uint2 = 18 } } }
+match Test-Struct2 = { Key-Field = ::Sub-Struct, Sub-Struct = { Nested-Uint1 = 33, Nested-Uint2 = 18 } }
encode-pair -
match fd 05 01 21 12
# Just right.
#
decode-pair fd 05 01 21 12
-match Test-Struct2 = { Key-Field = ::Sub-Struct, Data = { Sub-Struct = { Nested-Uint1 = 33, Nested-Uint2 = 18 } } }
+match Test-Struct2 = { Key-Field = ::Sub-Struct, Sub-Struct = { Nested-Uint1 = 33, Nested-Uint2 = 18 } }
encode-pair -
match fd 05 01 21 12
#
# Without Key-Field - it automatically figures it out
#
-encode-pair 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
#
# 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 } } }
+match Test-Struct2 = { 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
#
# @todo - to we want to update the parser to disallow bare key fields like this?
#
-encode-pair Test-Struct2 = { Key-Field = 2, Data = { Sub-Struct = { Nested-Uint1 = 33, Nested-Uint2 = 18 } } }
+encode-pair Test-Struct2 = { Key-Field = 2, Sub-Struct = { Nested-Uint1 = 33, Nested-Uint2 = 18 } }
match fd 05 01 21 12
decode-pair fd 05 02 43 41
-match Test-Struct2 = { Key-Field = ::CC, Data = { CC = "CA" } }
+match Test-Struct2 = { Key-Field = ::CC, CC = "CA" }
encode-pair -
match fd 05 02 43 41