help-libtasn1
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to change CHOICE alternative


From: Alevtina Glonina
Subject: How to change CHOICE alternative
Date: Tue, 22 Jan 2019 15:21:23 +0300

Hello,

I have a question about working with CHOICE alternative using libtasn1.

Consider simple example. Here is test.asn file:

TEST {}
DEFINITIONS IMPLICIT TAGS ::=
BEGIN

TestType ::= SEQUENCE {
A INTEGER,
F MyChoice
}

MyChoice ::= CHOICE {
V1 INTEGER,
V2 OCTET STRING
}

END

Firstly, I want to work with V2 alternative:

asn1_node tree = NULL, node = NULL;
char error_string[1024];
asn1_parser2tree("test.asn", &tree, error_string);
asn1_create_element(tree, "TEST.TestType", &node);
asn1_write_value(node, "F", "V2", 1);
asn1_write_value(node, "F.V2", "abc", 3);
// Some other operations here ...

Then I want to use the same structure (node), but with "V1" alternative.
Unfortunately asn1_write_value(node, "F", "V1", 1); returns ELEMENT_NOT_FOUND now. What is the right way to change V2 to V1? 


--
Best regards,
Alevtina Glonina

reply via email to

[Prev in Thread] Current Thread [Next in Thread]