I have 2 different structures in ASN.1: a rectangle and a circle:
Mystructs DEFINITIONS ::= BEGIN
Rectangle ::= SEQUENCE {
height INTEGER (0..255),
width INTEGER (0..255)
}
Circle ::= SEQUENCE {
radius INTEGER (0..255)
}
END
After the compilation, I can encode these structures (uper_encode()) and send either the rectangle or the circle. My problem is that when I want to decode the structures (uper_decode()), I should know a priori what I am receiving but actually I don't know. I only know that it could be a circle or a rectangle.
So I thought that I could add somehow a tag after sending the encoded data (like a header) that I can process before I decode to know which template should I use to decode: rectangle or circle.
However, I do not know how to do this.
Thanks!!!
I think you are looking for a CHOICE type.
The encoding will then carry information about which selection was made.