Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
asn1c
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
asn1c
Commits
659c63b7
Commit
659c63b7
authored
Jan 17, 2005
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
extensions in CHOICE types properly marked
parent
028a28bf
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
129 additions
and
11 deletions
+129
-11
ChangeLog
ChangeLog
+4
-1
libasn1compiler/asn1c_C.c
libasn1compiler/asn1c_C.c
+6
-10
tests/59-choice-extended-OK.asn1
tests/59-choice-extended-OK.asn1
+21
-0
tests/59-choice-extended-OK.asn1.-P
tests/59-choice-extended-OK.asn1.-P
+98
-0
No files found.
ChangeLog
View file @
659c63b7
0.9.8: 200
4-Oct-30
0.9.8: 200
5-Jan-17
* [NEW PLATFORM] Compiled and tested on Linux @ alpha64 (LP64).
* [NEW PLATFORM] Compiled and tested on Linux @ alpha64 (LP64).
Some code needed to be fixed regarding int-long conversions
Some code needed to be fixed regarding int-long conversions
...
@@ -15,6 +15,9 @@
...
@@ -15,6 +15,9 @@
* ber_dec_rval_t renamed into asn_dec_rval_t: more generality.
* ber_dec_rval_t renamed into asn_dec_rval_t: more generality.
* Removed order dependency in DEFAULT references to ENUMERATED
* Removed order dependency in DEFAULT references to ENUMERATED
identifiers (./tests/68-*-OK.asn1).
identifiers (./tests/68-*-OK.asn1).
* Extensions in CHOICE types are properly marked as non-pointers
(Test case 59) (Severity: medium, Secruity impact: medium)
Reported by <roman.pfender@sdm.de>.
* Implemented der_encode_to_buffer() procedure.
* Implemented der_encode_to_buffer() procedure.
0.9.7.1: 2004-Oct-12
0.9.7.1: 2004-Oct-12
...
...
libasn1compiler/asn1c_C.c
View file @
659c63b7
...
@@ -655,22 +655,18 @@ asn1c_lang_C_type_CHOICE_def(arg_t *arg) {
...
@@ -655,22 +655,18 @@ asn1c_lang_C_type_CHOICE_def(arg_t *arg) {
* Print out the table according to which the parsing is performed.
* Print out the table according to which the parsing is performed.
*/
*/
if
(
expr_elements_count
(
arg
,
expr
))
{
if
(
expr_elements_count
(
arg
,
expr
))
{
int
comp_mode
=
0
;
/* {root,ext=1,root,root,...} */
p
=
MKID
(
expr
->
Identifier
);
p
=
MKID
(
expr
->
Identifier
);
OUT
(
"static asn_TYPE_member_t asn_MBR_%s[] = {
\n
"
,
p
);
OUT
(
"static asn_TYPE_member_t asn_MBR_%s[] = {
\n
"
,
p
);
elements
=
0
;
elements
=
0
;
INDENTED
(
TQ_FOR
(
v
,
&
(
expr
->
members
),
next
)
{
INDENTED
(
TQ_FOR
(
v
,
&
(
expr
->
members
),
next
)
{
if
(
v
->
expr_type
==
A1TC_EXTENSIBLE
)
{
if
(
v
->
expr_type
==
A1TC_EXTENSIBLE
)
if
(
comp_mode
<
3
)
comp_mode
++
;
continue
;
}
else
{
if
(
expr_better_indirect
(
arg
,
v
))
if
(
comp_mode
==
1
v
->
marker
.
flags
|=
EM_INDIRECT
;
||
expr_better_indirect
(
arg
,
v
))
elements
++
;
v
->
marker
.
flags
|=
EM_INDIRECT
;
emit_member_table
(
arg
,
v
);
elements
++
;
emit_member_table
(
arg
,
v
);
}
});
});
OUT
(
"};
\n
"
);
OUT
(
"};
\n
"
);
}
else
{
}
else
{
...
...
tests/59-choice-extended-OK.asn1
0 → 100644
View file @
659c63b7
-- OK: Everything is fine
-- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1)
-- .spelio.software.asn1c.test (9363.1.5.1)
-- .59
ModuleTestExtensibleChoice
{ iso org(3) dod(6) internet(1) private(4) enterprise(1)
spelio(9363) software(1) asn1c(5) test(1) 59 }
DEFINITIONS AUTOMATIC TAGS ::=
BEGIN
Choice ::= CHOICE {
a INTEGER,
...,
b INTEGER,
c Choice -- A reference to itself
}
END
tests/59-choice-extended-OK.asn1.-P
0 → 100644
View file @
659c63b7
/*** <<< INCLUDES [Choice] >>> ***/
#include <INTEGER.h>
#include <Choice.h>
#include <constr_CHOICE.h>
/*** <<< DEPS [Choice] >>> ***/
typedef enum Choice_PR {
Choice_PR_NOTHING, /* No components present */
Choice_PR_a,
/* Extensions may appear below */
Choice_PR_b,
Choice_PR_c,
} Choice_PR;
struct Choice; /* Forward declaration */
extern asn_TYPE_descriptor_t asn_DEF_Choice;
/*** <<< TYPE-DECLS [Choice] >>> ***/
typedef struct Choice {
Choice_PR present;
union {
INTEGER_t a;
/*
* This type is extensible,
* possible extensions are below.
*/
INTEGER_t b;
struct Choice *c;
} choice;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} Choice_t;
/*** <<< STAT-DEFS [Choice] >>> ***/
static asn_TYPE_member_t asn_MBR_Choice[] = {
{ ATF_NOFLAGS, 0, offsetof(struct Choice, choice.a),
.tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = (void *)&asn_DEF_INTEGER,
.memb_constraints = 0, /* Defer to actual type */
.name = "a"
},
{ ATF_NOFLAGS, 0, offsetof(struct Choice, choice.b),
.tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = (void *)&asn_DEF_INTEGER,
.memb_constraints = 0, /* Defer to actual type */
.name = "b"
},
{ ATF_POINTER, 0, offsetof(struct Choice, choice.c),
.tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)),
.tag_mode = +1, /* EXPLICIT tag at current level */
.type = (void *)&asn_DEF_Choice,
.memb_constraints = 0, /* Defer to actual type */
.name = "c"
},
};
static asn_TYPE_tag2member_t asn_DEF_Choice_tag2el[] = {
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* a at 15 */
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* b at 17 */
{ (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* c at 19 */
};
static asn_CHOICE_specifics_t asn_DEF_Choice_specs = {
sizeof(struct Choice),
offsetof(struct Choice, _asn_ctx),
offsetof(struct Choice, present),
sizeof(((struct Choice *)0)->present),
asn_DEF_Choice_tag2el,
3, /* Count of tags in the map */
1 /* Whether extensible */
};
asn_TYPE_descriptor_t asn_DEF_Choice = {
"Choice",
"Choice",
CHOICE_free,
CHOICE_print,
CHOICE_constraint,
CHOICE_decode_ber,
CHOICE_encode_der,
CHOICE_decode_xer,
CHOICE_encode_xer,
CHOICE_outmost_tag,
0, /* No effective tags (pointer) */
0, /* No effective tags (count) */
0, /* No tags (pointer) */
0, /* No tags (count) */
asn_MBR_Choice,
3, /* Elements count */
&asn_DEF_Choice_specs /* Additional specs */
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment