Mantis Bug Tracker

View Revisions: Issue #822 All Revisions ] Back to Issue ]
Summary 0000822: Support present-when with expressions
Revision 2019-03-13 14:06 by maxime
Description At the moment, asn1scc supports only `present-when` property with boolean fields, for optional asn fields. ----- ASN.1 T-MySeq ::= SEQUENCE { field1 INTEGER(0..10), field2 BOOLEAN OPTIONAL, field3 BOOLEAN } ---- ACN T-MySeq [] { field1 [size 4, encoding pos-int], field2-is-present BOOLEAN [], field2 [present-when field2-is-present], field3 [] } However, in some protocols the presence of fields depends on the values of other fields, and it is not allowed to add additional fields in the encoding. In the previous example, this desirable ACN specification would do it: T-MySeq [] { field1 [size 4, encoding pos-int], field2 [present-when field1 == 3], field3 [] } I think that having this feature in place would provide great reward as I consider it is essential to deal with legacy encodings. The implementation may provide several limitations, like in this list with increasing features: 0. Support equalities for a single field appearing before the optional field (like in the example "field1 == 3") 1. Like 0, but with general predicates (e.g. "field1 < 4") 2. Like 1, but with predicates over multiple fields (e.g. field0 < 4 & field1 != 3) 3. Like 2, but with fields which may appear after the optional field (e.g. "field0 < 4 & field1 != 3 | field3", where field3 appears after the optional field) From the current encoding/decoding generated code, I think 0..2 should be relatively easy to implement, while 3 perhaps is more challenging. I think that 0..2 may be a sensible limitation to keep.
Revision 2018-12-13 12:00 by maxime
Description At the moment, asn1scc supports only `present-when` property with boolean fields, for optional asn fields. ----- ASN.1 T-MySeq ::= SEQUENCE { field1 INTEGER(0..10), field2 BOOLEAN OPTIONAL, field3 BOOLEAN } ---- ACN T-MySeq [] { field1 [size 4, encoding pos-int], field2-is-present BOOLEAN [], field2 [present-when field2-is-present], field3 [] } However, in some protocols the presence of fields depends on the values of other fields, and it is not allowed to add additional fields in the encoding. In the previous example, this desirable ACN specification would do it: T-MySeq [] { field1 [size 4, encoding pos-int], field2 [present-when field1 == 3], field3 [] } I think that having this feature in place would provide great reward as I consider it is essential to deal with legacy encodings. The implementation may provide several limitations, like in this list with increasing features: 0. Support equalities for a single field appearing before the optional field (like in the example "field1 == 3") 1. Like 0, but with general predicates (e.g. "field1 < 4") 2. Like 1, but with predicates over multiple fields (e.g. field0 < 4 & field1 != 3) 3. Like 2, but with fields which may appear after the optional field (e.g. "field0 < 4 & field1 != 3 | field3", where field3 appears after the optional field) From the current encoding/decoding generated code, I think 0..2 should be relatively easy to implement, while 3 perhaps is more challenging. I think that 0..2 may be a sensible limitation to keep.


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker