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
6b3ff543
Commit
6b3ff543
authored
Mar 06, 2006
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
standard modules are being picked up
parent
4649987b
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
108 additions
and
21 deletions
+108
-21
ChangeLog
ChangeLog
+1
-0
libasn1fix/asn1fix_retrieve.c
libasn1fix/asn1fix_retrieve.c
+45
-14
libasn1fix/check_fixer.c
libasn1fix/check_fixer.c
+16
-3
libasn1parser/asn1p_oid.c
libasn1parser/asn1p_oid.c
+20
-0
libasn1parser/asn1p_oid.h
libasn1parser/asn1p_oid.h
+2
-1
libasn1print/asn1print.c
libasn1print/asn1print.c
+2
-3
tests/96-type-identifier-OK.asn1
tests/96-type-identifier-OK.asn1
+22
-0
No files found.
ChangeLog
View file @
6b3ff543
0.9.21: 2006-Mar-06
* skeletons/standard-modules directory is now used for standard types.
0.9.20: 2006-Mar-06
...
...
libasn1fix/asn1fix_retrieve.c
View file @
6b3ff543
...
...
@@ -217,6 +217,7 @@ asn1f_lookup_symbol(arg_t *arg, asn1p_module_t *mod, asn1p_ref_t *ref) {
return
NULL
;
}
}
else
{
/* Search inside the IMPORTS section of the current module */
imports_from
=
asn1f_lookup_in_imports
(
arg
,
mod
,
identifier
);
if
(
imports_from
==
NULL
&&
errno
!=
ESRCH
)
{
/*
...
...
@@ -231,6 +232,7 @@ asn1f_lookup_symbol(arg_t *arg, asn1p_module_t *mod, asn1p_ref_t *ref) {
/*
* The symbol is being imported from another module.
*/
importing:
if
(
imports_from
)
{
asn1p_ref_t
tmpref
=
*
ref
;
asn1p_expr_t
*
expr
;
...
...
@@ -274,23 +276,52 @@ asn1f_lookup_symbol(arg_t *arg, asn1p_module_t *mod, asn1p_ref_t *ref) {
if
(
strcmp
(
ref_tc
->
Identifier
,
identifier
)
==
0
)
break
;
}
if
(
ref_tc
==
NULL
)
{
DEBUG
(
"Module
\"
%s
\"
does not contain
\"
%s
\"
"
"mentioned at line %d: %s"
,
mod
->
ModuleName
,
identifier
,
ref
->
_lineno
,
strerror
(
errno
)
);
if
(
asn1f_check_known_external_type
(
identifier
)
==
0
)
{
errno
=
EEXIST
;
/* Exists somewhere */
}
else
{
errno
=
ESRCH
;
if
(
ref_tc
)
return
ref_tc
;
{
/* Search inside standard module */
static
asn1p_oid_t
*
uioc_oid
;
if
(
!
uioc_oid
)
{
asn1p_oid_arc_t
arcs
[]
=
{
{
1
,
"iso"
},
{
3
,
"org"
},
{
6
,
"dod"
},
{
1
,
"internet"
},
{
4
,
"private"
},
{
1
,
"enterprise"
},
{
9363
,
"spelio"
},
{
1
,
"software"
},
{
5
,
"asn1c"
},
{
3
,
"standard-modules"
},
{
0
,
"auto-imported"
},
{
1
,
0
}
};
uioc_oid
=
asn1p_oid_construct
(
arcs
,
sizeof
(
arcs
)
/
sizeof
(
arcs
[
0
]));
}
if
(
!
imports_from
&&
mod
->
module_oid
&&
asn1p_oid_compare
(
mod
->
module_oid
,
uioc_oid
))
{
imports_from
=
asn1f_lookup_module
(
arg
,
"ASN1C-UsefulInformationObjectClasses"
,
uioc_oid
);
if
(
imports_from
)
goto
importing
;
}
return
NULL
;
}
return
ref_tc
;
DEBUG
(
"Module
\"
%s
\"
does not contain
\"
%s
\"
"
"mentioned at line %d: %s"
,
mod
->
ModuleName
,
identifier
,
ref
->
_lineno
,
strerror
(
errno
));
if
(
asn1f_check_known_external_type
(
identifier
)
==
0
)
{
errno
=
EEXIST
;
/* Exists somewhere */
}
else
{
errno
=
ESRCH
;
}
return
NULL
;
}
...
...
libasn1fix/check_fixer.c
View file @
6b3ff543
...
...
@@ -178,11 +178,23 @@ check(const char *fname,
"yet parsing was successfull!
\n
"
,
fname
);
r_value
=
-
1
;
}
if
(
!
asn
)
return
r_value
;
if
(
r_value
==
0
)
{
asn1p_t
*
std_asn
;
std_asn
=
asn1p_parse_file
(
"../skeletons/standard-modules/ASN1C-UsefulInformationObjectClasses.asn1"
,
A1P_NOFLAGS
);
if
(
std_asn
)
{
asn1p_module_t
*
mod
;
while
((
mod
=
TQ_REMOVE
(
&
(
std_asn
->
modules
),
mod_next
)))
TQ_ADD
(
&
(
asn
->
modules
),
mod
,
mod_next
);
asn1p_free
(
std_asn
);
}
}
/*
* Perform semantical checks and fixes.
*/
if
(
asn
&&
r_value
==
0
)
{
if
(
r_value
==
0
)
{
int
ret
;
if
(
expected_fix_code
)
...
...
@@ -214,14 +226,15 @@ check(const char *fname,
* Check validity of some values, if grammar has special
* instructions for that.
*/
if
(
asn
&&
r_value
==
0
)
{
if
(
r_value
==
0
)
{
if
(
post_fix_check
(
asn
))
r_value
=
-
1
;
}
/*
*
TODO: d
estroy the asn.
*
D
estroy the asn.
*/
asn1p_free
(
asn
);
return
r_value
;
}
...
...
libasn1parser/asn1p_oid.c
View file @
6b3ff543
...
...
@@ -4,6 +4,26 @@
#include "asn1parser.h"
asn1p_oid_t
*
asn1p_oid_construct
(
asn1p_oid_arc_t
*
arc
,
int
narcs
)
{
asn1p_oid_t
*
oid
;
if
(
narcs
<=
0
)
return
NULL
;
oid
=
asn1p_oid_new
();
if
(
oid
)
{
for
(;
narcs
--
;
arc
++
)
{
if
(
asn1p_oid_add_arc
(
oid
,
arc
))
{
asn1p_oid_free
(
oid
);
return
NULL
;
}
}
}
return
oid
;
}
asn1p_oid_t
*
asn1p_oid_new
()
{
return
calloc
(
1
,
sizeof
(
asn1p_oid_t
));
...
...
libasn1parser/asn1p_oid.h
View file @
6b3ff543
...
...
@@ -41,9 +41,10 @@ typedef struct asn1p_oid_s {
}
asn1p_oid_t
;
/*
* OID constructor.
* OID constructor
s
.
*/
asn1p_oid_t
*
asn1p_oid_new
(
void
);
asn1p_oid_t
*
asn1p_oid_construct
(
asn1p_oid_arc_t
*
,
int
narcs
);
/*
* Add another arc using given one as a template
...
...
libasn1print/asn1print.c
View file @
6b3ff543
...
...
@@ -45,6 +45,8 @@ asn1print(asn1p_t *asn, enum asn1print_flags flags) {
printf
(
"<!-- XML DTD generated by asn1c-"
VERSION
" -->
\n\n
"
);
TQ_FOR
(
mod
,
&
(
asn
->
modules
),
mod_next
)
{
if
(
mod
->
_tags
&
MT_STANDARD_MODULE
)
return
0
;
/* Ignore modules imported from skeletons */
if
(
modno
++
)
printf
(
"
\n
"
);
asn1print_module
(
asn
,
mod
,
flags
);
}
...
...
@@ -62,9 +64,6 @@ static int
asn1print_module
(
asn1p_t
*
asn
,
asn1p_module_t
*
mod
,
enum
asn1print_flags
flags
)
{
asn1p_expr_t
*
tc
;
if
(
mod
->
_tags
&
MT_STANDARD_MODULE
)
return
0
;
/* Ignore modules imported from skeletons */
if
(
flags
&
APF_PRINT_XML_DTD
)
printf
(
"<!-- ASN.1 module
\n
"
);
...
...
tests/96-type-identifier-OK.asn1
0 → 100644
View file @
6b3ff543
-- OK: Everything is fine
-- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1)
-- .spelio.software.asn1c.test (9363.1.5.1)
-- .96
ModuleTypeIdentifier
{ iso org(3) dod(6) internet (1) private(4) enterprise(1)
spelio(9363) software(1) asn1c(5) test(1) 96 }
DEFINITIONS ::=
BEGIN
/*
* TYPE-IDENTIFIER shall be automatically available.
*/
T ::= SEQUENCE {
id TYPE-IDENTIFIER.&id,
type TYPE-IDENTIFIER.&Type
}
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