Replies: 2 comments 1 reply
-
Thank you for your question! There's two parts to this question, but they have similar answers.
|
Beta Was this translation helpful? Give feedback.
-
I am writing this here, since I might be doing something wrong, but it could be also an issue. There might be a little design error for handling default values for discriminant values and how they are handled in enumerated types. It is defined in the section 20.6 in ITU-T Rec. X.680 (02/2021), for example A ::= ENUMERATED {a, b, ..., c} -- c = 2
B ::= ENUMERATED {a, b, c(0), ..., d} -- d = 3
C ::= ENUMERATED {a, b, ..., c(3), d} -- d = 4
D ::= ENUMERATED {a, z(25), ..., d} -- d = 1 Let's say we have a following #[derive(AsnType, Clone, Copy, Debug, Decode, Encode, PartialEq)]
#[rasn(enumerated, crate_root = "crate")]
enum Enum {
Red, // Should be 0
Blue, // Should be 1
Green, // Should be 2
#[rasn(extension_addition)]
Yellow, // Should be 3, but currently is 0 (living alone in EXTENDED_DISCRIMINANTS list)
Purple, // Should be 4, but currently is 3 (I assume this is also extension variant, but it is still in root (DISCRIMINANTS) list)
} I would assume that discriminant values should be incremented correctly. Also, shouldn't Purple also be on the EXTENDED_DISCRIMINANTS list? If I am supposed supposed to mark every extension variant with #[derive(AsnType, Clone, Copy, Debug, Decode, Encode, PartialEq)]
#[rasn(enumerated, crate_root = "crate")]
enum Enum {
Red, // Should be 0
Blue, // Should be 1
Green, // Should be 2
#[rasn(extension_addition)]
Yellow, // Should be 3, but currently is 0 (living in EXTENDED_DISCRIMINANTS list)
#[rasn(extension_addition)]
Purple, // Should be 4, but currently is 1 (living also in EXTENDED_DISCRIMINANTS list)
} This does not feel intuitive, since I was expecting On the other hand, if I use In this case, the values are correct as none are in separate list, but is this intended? If the extended variants are supposed to be on separate list, temporal easy fix for values might be on adding But this not might cover all the cases. |
Beta Was this translation helpful? Give feedback.
-
Hey,
I am just wondering how the extension mark (...) is handled when the ASN.1 definition uses it.
For example
The first case is always supported, but on newer versions the latter as well.
Is this something which is handled automatically by encoder/decoder or how I can mark that after specific point there might be extensions? Or should I add it manually for encoder/decoder.
Beta Was this translation helpful? Give feedback.
All reactions