mirror of https://gerrit.osmocom.org/asn1c
SET mandatory map generation
git-svn-id: https://asn1c.svn.sourceforge.net/svnroot/asn1c/trunk@985 59561ff5-6e30-0410-9f3c-9617f08c8826
This commit is contained in:
parent
1c16d30751
commit
e287319b2b
|
@ -1,5 +1,5 @@
|
|||
|
||||
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
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
|
||||
-- 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
|
|
@ -0,0 +1,181 @@
|
|||
|
||||
/*** <<< 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 */
|
||||
};
|
||||
|
Loading…
Reference in New Issue