pdl: Add support for constraints in grand children
Before, we assumed that we could fully parse a packet based on the not-yet-parsed bytes from the parent packet. However, this assumption is wrong when child packets are constrained by fields in the (grand) parent packets: packet Parent { a: 8, b: 8, c: 8, } packet Child: Parent(a = 10) { x: 8, } packet GrandChild: Child(b = 20) { y: 8, } packet GrandGrandChild: GrandChild(c = 30) { z: 8, } Here, we need to pass down the values of b and c when constructing a Child packet since b will be used to specialize into a GrandChild packet. Similarly, we need to pass c into GrandChild so that we can determine if we’re dealing with a GrandGranChild packet. Test: atest pdl_tests pdl_rust_generator_tests_{le,be} Change-Id: Iffffdca4b3601f46d3d13bae61490d1e0b60d8ae
Loading
Please register or sign in to comment