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
ac760bf5
Commit
ac760bf5
authored
Oct 05, 2005
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SET mandatory map generation
parent
b07880d8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
217 additions
and
9 deletions
+217
-9
ChangeLog
ChangeLog
+3
-1
libasn1compiler/asn1c_C.c
libasn1compiler/asn1c_C.c
+5
-8
tests/94-set-optionals-OK.asn1
tests/94-set-optionals-OK.asn1
+28
-0
tests/94-set-optionals-OK.asn1.-P
tests/94-set-optionals-OK.asn1.-P
+181
-0
No files found.
ChangeLog
View file @
ac760bf5
0.9.19: 2005-
Sep-04
0.9.19: 2005-
Oct-05
* A proper solution to circular references. No kludge flags
should be necessary anymore to produce reference-free code:
...
...
@@ -8,6 +8,8 @@
* Introduced compiler directives to allow finer control over the
generated code ("--<ASN1C...>--" in comments), (Test case 93).
* New feature for unber(1): -s <skip> bytes.
* Mandatory elements map for SET was not getting generated properly.
(Test case 94) (Severity: high; Security impact: low)
0.9.18: 2005-Aug-14
...
...
libasn1compiler/asn1c_C.c
View file @
ac760bf5
...
...
@@ -544,21 +544,18 @@ asn1c_lang_C_type_SET_def(arg_t *arg) {
OUT
(
" = {
\n
"
);
INDENTED
(
if
(
elements
)
{
int
delimit
=
0
;
int
el
=
0
;
TQ_FOR
(
v
,
&
(
expr
->
members
),
next
)
{
if
(
v
->
expr_type
==
A1TC_EXTENSIBLE
)
continue
;
if
(
delimit
)
{
OUT
(
",
\n
"
);
delimit
=
0
;
}
else
if
(
el
)
{
OUT
(
" | "
);
if
(
el
)
{
if
((
el
%
8
)
==
0
)
OUT
(
",
\n
"
)
;
else
OUT
(
" | "
);
}
OUT
(
"(%d << %d)"
,
(
v
->
marker
.
flags
&
EM_OMITABLE
)
!=
EM_OMITABLE
,
7
-
(
el
%
8
));
if
(
el
&&
(
el
%
8
)
==
0
)
delimit
=
1
;
el
++
;
}
}
else
{
...
...
tests/94-set-optionals-OK.asn1
0 → 100644
View file @
ac760bf5
-- OK: Everything is fine
-- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1)
-- .spelio.software.asn1c.test (9363.1.5.1)
-- .94
ModuleSetOptionals
{ iso org(3) dod(6) internet (1) private(4) enterprise(1)
spelio(9363) software(1) asn1c(5) test(1) 94 }
DEFINITIONS AUTOMATIC TAGS ::=
BEGIN
TestSet ::= SET {
m0 [0] IMPLICIT VisibleString,
m1 [1] IMPLICIT VisibleString OPTIONAL,
m2 [2] IMPLICIT VisibleString,
m3 [3] IMPLICIT VisibleString,
m4 [4] IMPLICIT VisibleString OPTIONAL,
m5 [5] IMPLICIT VisibleString,
m6 [6] IMPLICIT VisibleString,
m7 [7] IMPLICIT VisibleString,
m8 [8] IMPLICIT VisibleString OPTIONAL,
m9 [9] IMPLICIT VisibleString,
...
}
END
tests/94-set-optionals-OK.asn1.-P
0 → 100644
View file @
ac760bf5
/*** <<< INCLUDES [TestSet] >>> ***/
#include <VisibleString.h>
#include <constr_SET.h>
/*** <<< DEPS [TestSet] >>> ***/
/*
* Method of determining the components presence
*/
typedef enum TestSet_PR {
TestSet_PR_m0, /* Member m0 is present */
TestSet_PR_m1, /* Member m1 is present */
TestSet_PR_m2, /* Member m2 is present */
TestSet_PR_m3, /* Member m3 is present */
TestSet_PR_m4, /* Member m4 is present */
TestSet_PR_m5, /* Member m5 is present */
TestSet_PR_m6, /* Member m6 is present */
TestSet_PR_m7, /* Member m7 is present */
TestSet_PR_m8, /* Member m8 is present */
TestSet_PR_m9, /* Member m9 is present */
} TestSet_PR;
/*** <<< TYPE-DECLS [TestSet] >>> ***/
typedef struct TestSet {
VisibleString_t m0;
VisibleString_t *m1 /* OPTIONAL */;
VisibleString_t m2;
VisibleString_t m3;
VisibleString_t *m4 /* OPTIONAL */;
VisibleString_t m5;
VisibleString_t m6;
VisibleString_t m7;
VisibleString_t *m8 /* OPTIONAL */;
VisibleString_t m9;
/*
* This type is extensible,
* possible extensions are below.
*/
/* Presence bitmask: ASN_SET_ISPRESENT(pTestSet, TestSet_PR_x) */
unsigned int _presence_map
[((10+(8*sizeof(unsigned int))-1)/(8*sizeof(unsigned int)))];
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} TestSet_t;
/*** <<< FUNC-DECLS [TestSet] >>> ***/
extern asn_TYPE_descriptor_t asn_DEF_TestSet;
/*** <<< STAT-DEFS [TestSet] >>> ***/
static asn_TYPE_member_t asn_MBR_TestSet_1[] = {
{ ATF_NOFLAGS, 0, offsetof(struct TestSet, m0),
.tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = &asn_DEF_VisibleString,
.memb_constraints = 0, /* Defer constraints checking to the member type */
.name = "m0"
},
{ ATF_POINTER, 1, offsetof(struct TestSet, m1),
.tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = &asn_DEF_VisibleString,
.memb_constraints = 0, /* Defer constraints checking to the member type */
.name = "m1"
},
{ ATF_NOFLAGS, 0, offsetof(struct TestSet, m2),
.tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = &asn_DEF_VisibleString,
.memb_constraints = 0, /* Defer constraints checking to the member type */
.name = "m2"
},
{ ATF_NOFLAGS, 0, offsetof(struct TestSet, m3),
.tag = (ASN_TAG_CLASS_CONTEXT | (3 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = &asn_DEF_VisibleString,
.memb_constraints = 0, /* Defer constraints checking to the member type */
.name = "m3"
},
{ ATF_POINTER, 1, offsetof(struct TestSet, m4),
.tag = (ASN_TAG_CLASS_CONTEXT | (4 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = &asn_DEF_VisibleString,
.memb_constraints = 0, /* Defer constraints checking to the member type */
.name = "m4"
},
{ ATF_NOFLAGS, 0, offsetof(struct TestSet, m5),
.tag = (ASN_TAG_CLASS_CONTEXT | (5 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = &asn_DEF_VisibleString,
.memb_constraints = 0, /* Defer constraints checking to the member type */
.name = "m5"
},
{ ATF_NOFLAGS, 0, offsetof(struct TestSet, m6),
.tag = (ASN_TAG_CLASS_CONTEXT | (6 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = &asn_DEF_VisibleString,
.memb_constraints = 0, /* Defer constraints checking to the member type */
.name = "m6"
},
{ ATF_NOFLAGS, 0, offsetof(struct TestSet, m7),
.tag = (ASN_TAG_CLASS_CONTEXT | (7 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = &asn_DEF_VisibleString,
.memb_constraints = 0, /* Defer constraints checking to the member type */
.name = "m7"
},
{ ATF_POINTER, 1, offsetof(struct TestSet, m8),
.tag = (ASN_TAG_CLASS_CONTEXT | (8 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = &asn_DEF_VisibleString,
.memb_constraints = 0, /* Defer constraints checking to the member type */
.name = "m8"
},
{ ATF_NOFLAGS, 0, offsetof(struct TestSet, m9),
.tag = (ASN_TAG_CLASS_CONTEXT | (9 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = &asn_DEF_VisibleString,
.memb_constraints = 0, /* Defer constraints checking to the member type */
.name = "m9"
},
};
static ber_tlv_tag_t asn_DEF_TestSet_1_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (17 << 2))
};
static asn_TYPE_tag2member_t asn_MAP_TestSet_1_tag2el[] = {
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* m0 at 15 */
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* m1 at 16 */
{ (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* m2 at 17 */
{ (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* m3 at 18 */
{ (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* m4 at 19 */
{ (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* m5 at 20 */
{ (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* m6 at 21 */
{ (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 }, /* m7 at 22 */
{ (ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0 }, /* m8 at 23 */
{ (ASN_TAG_CLASS_CONTEXT | (9 << 2)), 9, 0, 0 } /* m9 at 24 */
};
static uint8_t asn_MAP_TestSet_1_mmap[(10 + (8 * sizeof(unsigned int)) - 1) / 8] = {
(1 << 7) | (0 << 6) | (1 << 5) | (1 << 4) | (0 << 3) | (1 << 2) | (1 << 1) | (1 << 0),
(0 << 7) | (1 << 6)
};
static asn_SET_specifics_t asn_SPC_TestSet_1_specs = {
sizeof(struct TestSet),
offsetof(struct TestSet, _asn_ctx),
offsetof(struct TestSet, _presence_map),
asn_MAP_TestSet_1_tag2el,
10, /* Count of tags in the map */
asn_MAP_TestSet_1_tag2el, /* Same as above */
10, /* Count of tags in the CXER map */
1, /* Whether extensible */
(unsigned int *)asn_MAP_TestSet_1_mmap /* Mandatory elements map */
};
asn_TYPE_descriptor_t asn_DEF_TestSet = {
"TestSet",
"TestSet",
SET_free,
SET_print,
SET_constraint,
SET_decode_ber,
SET_encode_der,
SET_decode_xer,
SET_encode_xer,
0, /* Use generic outmost tag fetcher */
asn_DEF_TestSet_1_tags,
sizeof(asn_DEF_TestSet_1_tags)
/sizeof(asn_DEF_TestSet_1_tags[0]), /* 1 */
asn_DEF_TestSet_1_tags, /* Same as above */
sizeof(asn_DEF_TestSet_1_tags)
/sizeof(asn_DEF_TestSet_1_tags[0]), /* 1 */
asn_MBR_TestSet_1,
10, /* Elements count */
&asn_SPC_TestSet_1_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