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
59165cf2
Commit
59165cf2
authored
Sep 11, 2017
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reorganized parsing around constraints
parent
2701dc2a
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
1517 additions
and
1536 deletions
+1517
-1536
libasn1parser/asn1p_y.c
libasn1parser/asn1p_y.c
+1221
-1326
libasn1parser/asn1p_y.h
libasn1parser/asn1p_y.h
+1
-1
libasn1parser/asn1p_y.y
libasn1parser/asn1p_y.y
+119
-146
tests/tests-asn1c-compiler/110-param-3-OK.asn1.-Pfcompound-names
...ests-asn1c-compiler/110-param-3-OK.asn1.-Pfcompound-names
+62
-62
tests/tests-asn1c-compiler/149-with-components-SE.asn1.-E
tests/tests-asn1c-compiler/149-with-components-SE.asn1.-E
+1
-1
tests/tests-asn1c-compiler/151-per-b2110-OK.asn1
tests/tests-asn1c-compiler/151-per-b2110-OK.asn1
+18
-0
tests/tests-asn1c-compiler/151-per-b2110-OK.asn1.-EFprint-constraints
...asn1c-compiler/151-per-b2110-OK.asn1.-EFprint-constraints
+12
-0
tests/tests-asn1c-compiler/152-value-and-type-references-OK.asn1
...ests-asn1c-compiler/152-value-and-type-references-OK.asn1
+43
-0
tests/tests-asn1c-compiler/152-value-and-type-references-OK.asn1.-EF
...-asn1c-compiler/152-value-and-type-references-OK.asn1.-EF
+40
-0
No files found.
libasn1parser/asn1p_y.c
View file @
59165cf2
This source diff could not be displayed because it is too large. You can
view the blob
instead.
libasn1parser/asn1p_y.h
View file @
59165cf2
...
...
@@ -262,7 +262,7 @@
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef
union
YYSTYPE
#line 11
5
"asn1p_y.y"
#line 11
6
"asn1p_y.y"
{
asn1p_t
*
a_grammar
;
asn1p_module_flags_e
a_module_flags
;
...
...
libasn1parser/asn1p_y.y
View file @
59165cf2
This diff is collapsed.
Click to expand it.
tests/tests-asn1c-compiler/110-param-3-OK.asn1.-Pfcompound-names
View file @
59165cf2
...
...
@@ -7,41 +7,41 @@
/*** <<< DEPS [Flag] >>> ***/
typedef enum Flag_1
6
P0__field {
Flag_1
6
P0__field_red = 0,
Flag_1
6
P0__field_green = 1,
Flag_1
6
P0__field_blue = 5
} e_Flag_1
6
P0__field;
typedef enum Flag_1
6
P1__field {
Flag_1
6
P1__field_red = 3,
Flag_1
6
P1__field_green = 4,
Flag_1
6
P1__field_blue = 5
} e_Flag_1
6
P1__field;
typedef enum Flag_1
5
P0__field {
Flag_1
5
P0__field_red = 0,
Flag_1
5
P0__field_green = 1,
Flag_1
5
P0__field_blue = 5
} e_Flag_1
5
P0__field;
typedef enum Flag_1
5
P1__field {
Flag_1
5
P1__field_red = 3,
Flag_1
5
P1__field_green = 4,
Flag_1
5
P1__field_blue = 5
} e_Flag_1
5
P1__field;
/*** <<< TYPE-DECLS [Flag] >>> ***/
typedef struct Flag_1
6
P0 {
typedef struct Flag_1
5
P0 {
long *field /* DEFAULT 5 */;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} Flag_1
6
P0_t;
typedef struct Flag_1
6
P1 {
} Flag_1
5
P0_t;
typedef struct Flag_1
5
P1 {
long *field /* DEFAULT 5 */;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} Flag_1
6
P1_t;
} Flag_1
5
P1_t;
/*** <<< FUNC-DECLS [Flag] >>> ***/
extern asn_TYPE_descriptor_t asn_DEF_Flag_1
6
P0;
extern asn_SEQUENCE_specifics_t asn_SPC_Flag_1
6
P0_specs_1;
extern asn_TYPE_member_t asn_MBR_Flag_1
6
P0_1[1];
extern asn_TYPE_descriptor_t asn_DEF_Flag_1
5
P0;
extern asn_SEQUENCE_specifics_t asn_SPC_Flag_1
5
P0_specs_1;
extern asn_TYPE_member_t asn_MBR_Flag_1
5
P0_1[1];
/* extern asn_TYPE_descriptor_t asn_DEF_field_7; // (Use -fall-defs-global to expose) */
extern asn_TYPE_descriptor_t asn_DEF_Flag_1
6
P1;
extern asn_SEQUENCE_specifics_t asn_SPC_Flag_1
6
P1_specs_6;
extern asn_TYPE_member_t asn_MBR_Flag_1
6
P1_6[1];
extern asn_TYPE_descriptor_t asn_DEF_Flag_1
5
P1;
extern asn_SEQUENCE_specifics_t asn_SPC_Flag_1
5
P1_specs_6;
extern asn_TYPE_member_t asn_MBR_Flag_1
5
P1_6[1];
/*** <<< CODE [Flag] >>> ***/
...
...
@@ -70,8 +70,8 @@ static int asn_DFL_2_set_5(int set_value, void **sptr) {
return (*st == 5);
}
}
asn_TYPE_member_t asn_MBR_Flag_1
6
P0_1[] = {
{ ATF_POINTER, 1, offsetof(struct Flag_1
6
P0, field),
asn_TYPE_member_t asn_MBR_Flag_1
5
P0_1[] = {
{ ATF_POINTER, 1, offsetof(struct Flag_1
5
P0, field),
.tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)),
.tag_mode = 0,
.type = &asn_DEF_NativeInteger,
...
...
@@ -83,37 +83,37 @@ asn_TYPE_member_t asn_MBR_Flag_16P0_1[] = {
.name = "field"
},
};
static const ber_tlv_tag_t asn_DEF_Flag_1
6
P0_tags_1[] = {
static const ber_tlv_tag_t asn_DEF_Flag_1
5
P0_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static const asn_TYPE_tag2member_t asn_MAP_Flag_1
6
P0_tag2el_1[] = {
static const asn_TYPE_tag2member_t asn_MAP_Flag_1
5
P0_tag2el_1[] = {
{ (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 } /* field */
};
asn_SEQUENCE_specifics_t asn_SPC_Flag_1
6
P0_specs_1 = {
sizeof(struct Flag_1
6
P0),
offsetof(struct Flag_1
6
P0, _asn_ctx),
.tag2el = asn_MAP_Flag_1
6
P0_tag2el_1,
asn_SEQUENCE_specifics_t asn_SPC_Flag_1
5
P0_specs_1 = {
sizeof(struct Flag_1
5
P0),
offsetof(struct Flag_1
5
P0, _asn_ctx),
.tag2el = asn_MAP_Flag_1
5
P0_tag2el_1,
.tag2el_count = 1, /* Count of tags in the map */
0, 0, 0, /* Optional elements (not needed) */
-1, /* Start extensions */
-1 /* Stop extensions */
};
asn_TYPE_descriptor_t asn_DEF_Flag_1
6
P0 = {
asn_TYPE_descriptor_t asn_DEF_Flag_1
5
P0 = {
"Flag",
"Flag",
&asn_OP_SEQUENCE,
SEQUENCE_constraint,
asn_DEF_Flag_1
6
P0_tags_1,
sizeof(asn_DEF_Flag_1
6
P0_tags_1)
/sizeof(asn_DEF_Flag_1
6
P0_tags_1[0]), /* 1 */
asn_DEF_Flag_1
6
P0_tags_1, /* Same as above */
sizeof(asn_DEF_Flag_1
6
P0_tags_1)
/sizeof(asn_DEF_Flag_1
6
P0_tags_1[0]), /* 1 */
asn_DEF_Flag_1
5
P0_tags_1,
sizeof(asn_DEF_Flag_1
5
P0_tags_1)
/sizeof(asn_DEF_Flag_1
5
P0_tags_1[0]), /* 1 */
asn_DEF_Flag_1
5
P0_tags_1, /* Same as above */
sizeof(asn_DEF_Flag_1
5
P0_tags_1)
/sizeof(asn_DEF_Flag_1
5
P0_tags_1[0]), /* 1 */
0, /* No OER visible constraints */
0, /* No PER visible constraints */
asn_MBR_Flag_1
6
P0_1,
asn_MBR_Flag_1
5
P0_1,
1, /* Elements count */
&asn_SPC_Flag_1
6
P0_specs_1 /* Additional specs */
&asn_SPC_Flag_1
5
P0_specs_1 /* Additional specs */
};
static int asn_DFL_7_set_5(int set_value, void **sptr) {
...
...
@@ -174,8 +174,8 @@ asn_TYPE_descriptor_t asn_DEF_field_7 = {
&asn_SPC_field_specs_7 /* Additional specs */
};
asn_TYPE_member_t asn_MBR_Flag_1
6
P1_6[] = {
{ ATF_POINTER, 1, offsetof(struct Flag_1
6
P1, field),
asn_TYPE_member_t asn_MBR_Flag_1
5
P1_6[] = {
{ ATF_POINTER, 1, offsetof(struct Flag_1
5
P1, field),
.tag = (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)),
.tag_mode = 0,
.type = &asn_DEF_field_7,
...
...
@@ -187,37 +187,37 @@ asn_TYPE_member_t asn_MBR_Flag_16P1_6[] = {
.name = "field"
},
};
static const ber_tlv_tag_t asn_DEF_Flag_1
6
P1_tags_6[] = {
static const ber_tlv_tag_t asn_DEF_Flag_1
5
P1_tags_6[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static const asn_TYPE_tag2member_t asn_MAP_Flag_1
6
P1_tag2el_6[] = {
static const asn_TYPE_tag2member_t asn_MAP_Flag_1
5
P1_tag2el_6[] = {
{ (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 0, 0, 0 } /* field */
};
asn_SEQUENCE_specifics_t asn_SPC_Flag_1
6
P1_specs_6 = {
sizeof(struct Flag_1
6
P1),
offsetof(struct Flag_1
6
P1, _asn_ctx),
.tag2el = asn_MAP_Flag_1
6
P1_tag2el_6,
asn_SEQUENCE_specifics_t asn_SPC_Flag_1
5
P1_specs_6 = {
sizeof(struct Flag_1
5
P1),
offsetof(struct Flag_1
5
P1, _asn_ctx),
.tag2el = asn_MAP_Flag_1
5
P1_tag2el_6,
.tag2el_count = 1, /* Count of tags in the map */
0, 0, 0, /* Optional elements (not needed) */
-1, /* Start extensions */
-1 /* Stop extensions */
};
asn_TYPE_descriptor_t asn_DEF_Flag_1
6
P1 = {
asn_TYPE_descriptor_t asn_DEF_Flag_1
5
P1 = {
"Flag",
"Flag",
&asn_OP_SEQUENCE,
SEQUENCE_constraint,
asn_DEF_Flag_1
6
P1_tags_6,
sizeof(asn_DEF_Flag_1
6
P1_tags_6)
/sizeof(asn_DEF_Flag_1
6
P1_tags_6[0]), /* 1 */
asn_DEF_Flag_1
6
P1_tags_6, /* Same as above */
sizeof(asn_DEF_Flag_1
6
P1_tags_6)
/sizeof(asn_DEF_Flag_1
6
P1_tags_6[0]), /* 1 */
asn_DEF_Flag_1
5
P1_tags_6,
sizeof(asn_DEF_Flag_1
5
P1_tags_6)
/sizeof(asn_DEF_Flag_1
5
P1_tags_6[0]), /* 1 */
asn_DEF_Flag_1
5
P1_tags_6, /* Same as above */
sizeof(asn_DEF_Flag_1
5
P1_tags_6)
/sizeof(asn_DEF_Flag_1
5
P1_tags_6[0]), /* 1 */
0, /* No OER visible constraints */
0, /* No PER visible constraints */
asn_MBR_Flag_1
6
P1_6,
asn_MBR_Flag_1
5
P1_6,
1, /* Elements count */
&asn_SPC_Flag_1
6
P1_specs_6 /* Additional specs */
&asn_SPC_Flag_1
5
P1_specs_6 /* Additional specs */
};
...
...
@@ -227,7 +227,7 @@ asn_TYPE_descriptor_t asn_DEF_Flag_16P1 = {
/*** <<< TYPE-DECLS [IntegerColorFlag] >>> ***/
typedef Flag_1
6
P0_t IntegerColorFlag_t;
typedef Flag_1
5
P0_t IntegerColorFlag_t;
/*** <<< FUNC-DECLS [IntegerColorFlag] >>> ***/
...
...
@@ -243,7 +243,7 @@ xer_type_encoder_f IntegerColorFlag_encode_xer;
/*** <<< CODE [IntegerColorFlag] >>> ***/
/*
* This type is implemented using Flag_1
6
P0,
* This type is implemented using Flag_1
5
P0,
* so here we adjust the DEF accordingly.
*/
...
...
@@ -265,9 +265,9 @@ asn_TYPE_descriptor_t asn_DEF_IntegerColorFlag = {
/sizeof(asn_DEF_IntegerColorFlag_tags_1[0]), /* 1 */
0, /* No OER visible constraints */
0, /* No PER visible constraints */
asn_MBR_Flag_1
6
P0_1,
asn_MBR_Flag_1
5
P0_1,
1, /* Elements count */
&asn_SPC_Flag_1
6
P0_specs_1 /* Additional specs */
&asn_SPC_Flag_1
5
P0_specs_1 /* Additional specs */
};
...
...
@@ -277,7 +277,7 @@ asn_TYPE_descriptor_t asn_DEF_IntegerColorFlag = {
/*** <<< TYPE-DECLS [EnumeratedColorFlag] >>> ***/
typedef Flag_1
6
P1_t EnumeratedColorFlag_t;
typedef Flag_1
5
P1_t EnumeratedColorFlag_t;
/*** <<< FUNC-DECLS [EnumeratedColorFlag] >>> ***/
...
...
@@ -293,7 +293,7 @@ xer_type_encoder_f EnumeratedColorFlag_encode_xer;
/*** <<< CODE [EnumeratedColorFlag] >>> ***/
/*
* This type is implemented using Flag_1
6
P1,
* This type is implemented using Flag_1
5
P1,
* so here we adjust the DEF accordingly.
*/
...
...
@@ -315,8 +315,8 @@ asn_TYPE_descriptor_t asn_DEF_EnumeratedColorFlag = {
/sizeof(asn_DEF_EnumeratedColorFlag_tags_1[0]), /* 1 */
0, /* No OER visible constraints */
0, /* No PER visible constraints */
asn_MBR_Flag_1
6
P1_6,
asn_MBR_Flag_1
5
P1_6,
1, /* Elements count */
&asn_SPC_Flag_1
6
P1_specs_6 /* Additional specs */
&asn_SPC_Flag_1
5
P1_specs_6 /* Additional specs */
};
tests/tests-asn1c-compiler/149-with-components-SE.asn1.-E
View file @
59165cf2
...
...
@@ -7,6 +7,6 @@ Certificate ::= ExplicitCertificate (WITH COMPONENTS { ..., issuer (WITH COMPONE
IdentifiedRegion ( WITH COMPONENTS { countryOnly(Canada) }),
IdentifiedRegion ( WITH COMPONENTS { countryOnly(Mexico) }),
IdentifiedRegion ( WITH COMPONENTS { countryOnly(USA) })
})) }), canRequestRollover (
NULL), encryptionKey ABSENT, verifyKeyIndicator (WITH COMPONENTS { verificationKey (WITH COMPONENTS { ecdsaNistP256 (WITH COMPONENTS { compressed-y-0, compressed-y-1 }) }) }) }) })
})) }), canRequestRollover (NULL), encryptionKey ABSENT, verifyKeyIndicator (WITH COMPONENTS { verificationKey (WITH COMPONENTS { ecdsaNistP256 (WITH COMPONENTS { compressed-y-0, compressed-y-1 }) }) }) }) })
END
tests/tests-asn1c-compiler/151-per-b2110-OK.asn1
0 → 100644
View file @
59165cf2
-- OK: Everything is fine
-- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1)
-- .spelio.software.asn1c.test (9363.1.5.1)
-- .151
ModulePerEffectiveConstraint
{ iso org(3) dod(6) internet(1) private(4) enterprise(1)
spelio(9363) software(1) asn1c(5) test(1) 151 }
DEFINITIONS ::= BEGIN
-- B.2.1.10
-- Effective constraint: SIZE(3..20) and FROM("A".."K")
B ::= VisibleString (SIZE (20) INTERSECTION FROM ("A".."F")
UNION SIZE (3) INTERSECTION FROM ("F".."K"))
END
tests/tests-asn1c-compiler/151-per-b2110-OK.asn1.-EFprint-constraints
0 → 100644
View file @
59165cf2
ModulePerEffectiveConstraint { iso org(3) dod(6) internet(1) private(4)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 151 }
DEFINITIONS ::=
BEGIN
B ::= VisibleString (SIZE(20) ^ FROM("A".."F") | SIZE(3) ^ FROM("F".."K"))
-- Combined constraints: (SIZE(20) ^ FROM("A".."F") | SIZE(3) ^ FROM("F".."K"))
-- Practical constraints (B): (MIN..MAX) (SIZE(3 | 20)) (FROM("A".."K"))
-- OER-visible constraints (B): (MIN..MAX) (SIZE(3 | 20))
-- PER-visible constraints (B): (MIN..MAX) (SIZE(3 | 20)) (FROM("A".."K"))
END
tests/tests-asn1c-compiler/152-value-and-type-references-OK.asn1
0 → 100644
View file @
59165cf2
-- OK: Everything is fine
-- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1)
-- .spelio.software.asn1c.test (9363.1.5.1)
-- .152
ModuleValueAndTypeReferences
{ iso org(3) dod(6) internet(1) private(4) enterprise(1)
spelio(9363) software(1) asn1c(5) test(1) 152 }
DEFINITIONS ::= BEGIN
value INTEGER ::= 3
valueAssignment3 INTEGER ::= value
valueAssignment4 INTEGER ::= MOD-CAPITALS.value4
Foo ::= Extension {{CAPS.SomeType}}
Bar ::= Extension {{Uppercase.SomeType}}
Extension {Foo} ::= SEQUENCE {
}
MTYPE ::= CLASS {
&id INTEGER UNIQUE,
&Type
} WITH SYNTAX {&Type IDENTIFIED BY &id}
MessageFrame ::= SEQUENCE {
messageIdE MTYPE.&id,
messageIdF MTYPE.&id({MessageTypes}),
valueE MTYPE.&Type,
valueF MTYPE.&Type({MessageTypes}{@.messageId})
}
END
MOD-CAPITALS
{ iso org(3) dod(6) internet(1) private(4) enterprise(1)
spelio(9363) software(1) asn1c(5) test(1) 152 1 }
DEFINITIONS ::= BEGIN
value4 INTEGER ::= 4
END
tests/tests-asn1c-compiler/152-value-and-type-references-OK.asn1.-EF
0 → 100644
View file @
59165cf2
ModuleValueAndTypeReferences { iso org(3) dod(6) internet(1) private(4)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 152 }
DEFINITIONS ::=
BEGIN
value INTEGER ::= 3
valueAssignment3 INTEGER ::= 3
valueAssignment4 INTEGER ::= 4
Foo ::= Extension{ { CAPS.SomeType}}
Bar ::= Extension{ { Uppercase.SomeType}}
Extension{Foo} ::= SEQUENCE { }
MTYPE ::= CLASS {
&id INTEGER UNIQUE,
&Type ANY
} WITH SYNTAX {&Type IDENTIFIED BY &id}
MessageFrame ::= SEQUENCE {
messageIdE MTYPE.&id,
messageIdF MTYPE.&id ({MessageTypes}),
valueE MTYPE.&Type,
valueF MTYPE.&Type ({MessageTypes}{@.messageId})
}
END
MOD-CAPITALS { iso org(3) dod(6) internet(1) private(4) enterprise(1)
spelio(9363) software(1) asn1c(5) test(1) 152 1 }
DEFINITIONS ::=
BEGIN
value4 INTEGER ::= 4
END
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