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
2e9bd5c7
Commit
2e9bd5c7
authored
Aug 13, 2005
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
groking obsolete syntax
parent
b36317c2
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
935 additions
and
781 deletions
+935
-781
ChangeLog
ChangeLog
+3
-2
libasn1parser/asn1p_y.c
libasn1parser/asn1p_y.c
+850
-777
libasn1parser/asn1p_y.y
libasn1parser/asn1p_y.y
+53
-2
tests/87-old-syntax-OK.asn1
tests/87-old-syntax-OK.asn1
+29
-0
No files found.
ChangeLog
View file @
2e9bd5c7
0.9.17: 2005-Aug-1
1
0.9.17: 2005-Aug-1
3
* ...
* The obsolete X.208 syntax is handled gracefully now (compound types'
member names are invented on the fly). (Test case 87).
0.9.17: 2005-Aug-07
...
...
libasn1parser/asn1p_y.c
View file @
2e9bd5c7
This diff is collapsed.
Click to expand it.
libasn1parser/asn1p_y.y
View file @
2e9bd5c7
...
...
@@ -29,8 +29,8 @@ extern int asn1p_lineno;
*/
static struct AssignedIdentifier *saved_aid;
static asn1p_value_t *
_convert_bitstring2binary(char *str, int base
);
static asn1p_value_t *
_convert_bitstring2binary(char *str, int base);
static void _fixup_anonymous_identifier(asn1p_expr_t *expr
);
#define checkmem(ptr) do { \
if(!(ptr)) \
...
...
@@ -901,6 +901,11 @@ ComponentType:
| ExtensionAndException {
$$ = $1;
}
| Type optMarker {
$$ = $1;
$$->marker = $2;
_fixup_anonymous_identifier($$);
}
;
AlternativeTypeLists:
...
...
@@ -924,6 +929,10 @@ AlternativeType:
| ExtensionAndException {
$$ = $1;
}
| Type {
$$ = $1;
_fixup_anonymous_identifier($$);
}
;
ClassDeclaration:
...
...
@@ -2184,6 +2193,48 @@ _convert_bitstring2binary(char *str, int base) {
return val;
}
/*
* For unnamed types (used in old X.208 compliant modules)
* generate some sort of interim names, to not to force human being to fix
* the specification's compliance to modern ASN.1 standards.
*/
static void
_fixup_anonymous_identifier(asn1p_expr_t *expr) {
char *p;
assert(expr->Identifier == 0);
/*
* Try to figure out the type name
* without going too much into details
*/
expr->Identifier = ASN_EXPR_TYPE2STR(expr->expr_type);
if(expr->reference && expr->reference->comp_count > 0)
expr->Identifier = expr->reference->components[0].name;
fprintf(stderr,
"WARNING: Line %d: expected lower-case member identifier, "
"found an unnamed %s.\n"
"WARNING: Obsolete X.208 syntax detected, "
"please give the member a name.\n",
yylineno, expr->Identifier ? expr->Identifier : "type");
if(!expr->Identifier)
expr->Identifier = "unnamed";
expr->Identifier = strdup(expr->Identifier);
assert(expr->Identifier);
/* Make a lowercase identifier from the type name */
for(p = expr->Identifier; *p; p++) {
switch(*p) {
case 'A' ... 'Z': *p += 32; break;
case ' ': *p = '_'; break;
case '-': *p = '_'; break;
}
}
fprintf(stderr, "NOTE: Assigning temporary identifier \"%s\". "
"Name clash may occur later.\n",
expr->Identifier);
}
extern char *asn1p_text;
int
...
...
tests/87-old-syntax-OK.asn1
0 → 100644
View file @
2e9bd5c7
-- OK: Everything is fine
-- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1)
-- .spelio.software.asn1c.test (9363.1.5.1)
-- .87
ModuleObsoleteSyntax
{ iso org(3) dod(6) internet (1) private(4) enterprise(1)
spelio(9363) software(1) asn1c(5) test(1) 87 }
DEFINITIONS ::=
BEGIN
Tc ::= CHOICE {
INTEGER,
BOOLEAN
}
Ts ::= SET {
INTEGER,
BOOLEAN,
SEQUENCE {
OBJECT IDENTIFIER,
RELATIVE-OID,
Tc
}
}
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