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
781af821
Commit
781af821
authored
Jan 28, 2021
by
Denis Filatov
Committed by
v0-e
Nov 09, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WITH SUCCESSORS support
parent
84d3a59c
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
64 additions
and
28 deletions
+64
-28
libasn1fix/asn1fix_export.c
libasn1fix/asn1fix_export.c
+1
-1
libasn1fix/asn1fix_retrieve.c
libasn1fix/asn1fix_retrieve.c
+16
-18
libasn1fix/asn1fix_retrieve.h
libasn1fix/asn1fix_retrieve.h
+1
-1
libasn1parser/asn1p_l.l
libasn1parser/asn1p_l.l
+2
-1
libasn1parser/asn1p_oid.c
libasn1parser/asn1p_oid.c
+17
-6
libasn1parser/asn1p_oid.h
libasn1parser/asn1p_oid.h
+4
-0
libasn1parser/asn1p_xports.h
libasn1parser/asn1p_xports.h
+2
-0
libasn1parser/asn1p_y.y
libasn1parser/asn1p_y.y
+21
-1
No files found.
libasn1fix/asn1fix_export.c
View file @
781af821
...
...
@@ -42,7 +42,7 @@ asn1f_lookup_module_ex(asn1p_t *asn, const char *module_name,
arg
.
asn
=
asn
;
arg
.
eh
=
a1f_replace_me_with_proper_interface_arg
.
eh
;
arg
.
debug
=
a1f_replace_me_with_proper_interface_arg
.
debug
;
return
asn1f_lookup_module
(
&
arg
,
module_name
,
oid
);
return
asn1f_lookup_module
(
&
arg
,
module_name
,
oid
,
0
);
}
asn1p_expr_t
*
...
...
libasn1fix/asn1fix_retrieve.c
View file @
781af821
...
...
@@ -53,7 +53,7 @@ asn1f_lookup_in_imports(arg_t *arg, asn1p_module_t *mod, const char *name) {
*/
TQ_FOR
(
xp
,
&
(
mod
->
imports
),
xp_next
)
{
asn1p_module_t
*
fromModule
=
asn1f_lookup_module
(
arg
,
xp
->
fromModuleName
,
NULL
);
asn1f_lookup_module
(
arg
,
xp
->
fromModuleName
,
NULL
,
0
);
asn1p_expr_t
*
tc
=
(
asn1p_expr_t
*
)
0
;
TQ_FOR
(
tc
,
&
(
xp
->
xp_members
),
next
)
{
...
...
@@ -78,7 +78,7 @@ asn1f_lookup_in_imports(arg_t *arg, asn1p_module_t *mod, const char *name) {
* Okay, right now we have a module name and, hopefully, an OID.
* Search the arg->asn for the specified module.
*/
mod
=
asn1f_lookup_module
(
arg
,
xp
->
fromModuleName
,
xp
->
identifier
.
oid
);
mod
=
asn1f_lookup_module
(
arg
,
xp
->
fromModuleName
,
xp
->
identifier
.
oid
,
xp
->
option
);
if
(
mod
==
NULL
)
{
/* Conditional debug */
if
(
!
(
arg
->
expr
->
_mark
&
TM_BROKEN
))
{
...
...
@@ -106,8 +106,8 @@ asn1f_lookup_in_imports(arg_t *arg, asn1p_module_t *mod, const char *name) {
}
asn1p_module_t
*
asn1f_lookup_module
(
arg_t
*
arg
,
const
char
*
module_name
,
const
asn1p_oid_t
*
oid
)
{
asn1p_module_t
*
mod
;
asn1f_lookup_module
(
arg_t
*
arg
,
const
char
*
module_name
,
const
asn1p_oid_t
*
oid
,
int
oid_option
)
{
asn1p_module_t
*
mod
,
*
ret
=
NULL
;
assert
(
module_name
);
...
...
@@ -149,27 +149,25 @@ asn1f_lookup_module(arg_t *arg, const char *module_name, const asn1p_oid_t *oid)
TQ_FOR
(
mod
,
&
(
arg
->
asn
->
modules
),
mod_next
)
{
if
(
oid
)
{
if
(
mod
->
module_oid
)
{
if
(
asn1p_oid_compare
(
oid
,
mod
->
module_oid
))
{
continue
;
}
else
{
if
(
0
==
asn1p_oid_compare_opt
(
oid
,
mod
->
module_oid
,
oid_option
))
{
/* Match! Even if name doesn't. */
return
mod
;
oid
=
mod
->
module_oid
;
ret
=
mod
;
}
}
}
else
{
/* Not match, even if name is the same. */
continue
;
}
}
if
(
strcmp
(
module_name
,
mod
->
ModuleName
)
==
0
)
return
mod
;
}
if
(
ret
==
NULL
)
{
DEBUG
(
"
\t
Module
\"
%s
\"
not found"
,
module_name
);
errno
=
ENOENT
;
return
NULL
;
}
return
ret
;
}
static
asn1p_expr_t
*
...
...
@@ -268,7 +266,7 @@ asn1f_lookup_symbol_impl(arg_t *arg, asn1p_expr_t *rhs_pspecs, const asn1p_ref_t
* switch namespace to that module.
*/
if
(
modulename
)
{
imports_from
=
asn1f_lookup_module
(
arg
,
modulename
,
0
);
imports_from
=
asn1f_lookup_module
(
arg
,
modulename
,
0
,
0
);
if
(
imports_from
==
NULL
)
{
FATAL
(
"Module
\"
%s
\"
"
...
...
libasn1fix/asn1fix_retrieve.h
View file @
781af821
...
...
@@ -31,7 +31,7 @@ asn1p_module_t *asn1f_lookup_in_imports(arg_t *arg, asn1p_module_t *mod, const c
*/
asn1p_module_t
*
asn1f_lookup_module
(
arg_t
*
arg
,
const
char
*
module_name
,
const
asn1p_oid_t
*
module_oid
);
const
asn1p_oid_t
*
module_oid
,
int
oid_option
);
/*
* Return the reference to a destination of the given reference,
...
...
libasn1parser/asn1p_l.l
View file @
781af821
...
...
@@ -381,7 +381,8 @@ UTF8String {
VideotexString return TOK_VideotexString;
VisibleString return TOK_VisibleString;
WITH return TOK_WITH;
SUCCESSORS return TOK_SUCCESSORS;
DESCENDANTS return TOK_DESCENDANTS;
<INITIAL,with_syntax>&[A-Z][A-Za-z0-9]*([-][A-Za-z0-9]+)* {
asn1p_lval.tv_str = strdup(yytext);
...
...
libasn1parser/asn1p_oid.c
View file @
781af821
...
...
@@ -89,26 +89,37 @@ asn1p_oid_compare(const asn1p_oid_t *a, const asn1p_oid_t *b) {
if
(
b
->
arcs_count
>
i
)
{
if
(
a
->
arcs_count
<=
i
)
return
-
1
;
return
-
1
-
i
;
}
else
if
(
a
->
arcs_count
>
i
)
{
if
(
b
->
arcs_count
<=
i
)
return
1
;
return
1
+
i
;
}
else
if
(
b
->
arcs_count
<=
i
&&
a
->
arcs_count
<=
i
)
{
cmp
=
b
->
arcs_count
-
a
->
arcs_count
;
if
(
cmp
<
0
)
return
-
1
;
return
-
1
-
i
;
else
if
(
cmp
>
0
)
return
1
;
return
1
+
i
;
return
0
;
}
cmp
=
b
->
arcs
[
i
].
number
-
a
->
arcs
[
i
].
number
;
if
(
cmp
<
0
)
return
-
1
;
return
-
1
-
i
;
else
if
(
cmp
>
0
)
return
1
;
return
1
+
i
;
}
}
int
asn1p_oid_compare_opt
(
const
asn1p_oid_t
*
a
,
const
asn1p_oid_t
*
b
,
int
oid_options
)
{
int
r
=
asn1p_oid_compare
(
a
,
b
);
if
(
oid_options
==
OID_WITH_SUCCESSORS
)
{
if
(
r
==
b
->
arcs_count
)
/* positive and last arc */
r
=
0
;
}
else
if
(
oid_options
==
OID_WITH_DESCENDANTS
)
{
/* not supported yet */
}
return
r
;
}
libasn1parser/asn1p_oid.h
View file @
781af821
...
...
@@ -63,5 +63,9 @@ void asn1p_oid_free(asn1p_oid_t *);
*/
int
asn1p_oid_compare
(
const
asn1p_oid_t
*
a
,
const
asn1p_oid_t
*
b
);
#define OID_WITH_SUCCESSORS 1
#define OID_WITH_DESCENDANTS 2
int
asn1p_oid_compare_opt
(
const
asn1p_oid_t
*
a
,
const
asn1p_oid_t
*
b
,
int
oid_option
);
#endif
/* ASN1_PARSER_OID_H */
libasn1parser/asn1p_xports.h
View file @
781af821
...
...
@@ -23,6 +23,8 @@ typedef struct asn1p_xports_s {
asn1p_value_t
*
value
;
/* DefinedValue */
}
identifier
;
int
option
;
/* (0) | WITH SUCCESSORS (1) | WITH DESCENDANTS (2) */
/*
* Number of entities to import.
*/
...
...
libasn1parser/asn1p_y.y
View file @
781af821
...
...
@@ -267,6 +267,8 @@ static asn1p_module_t *currentModule;
%token TOK_TwoDots ".."
%token TOK_ThreeDots "..."
%token TOK_SUCCESSORS
%token TOK_DESCENDANTS
/*
* Types defined herein.
...
...
@@ -286,6 +288,8 @@ static asn1p_module_t *currentModule;
%type <a_module> optImportsBundleSet
%type <a_module> ImportsBundleSet
%type <a_xports> ImportsBundle
%type <a_xports> ImportsBundleInt
%type <a_int> ImportSelectionOption
%type <a_xports> ImportsList
%type <a_xports> ExportsDefinition
%type <a_xports> ExportsBody
...
...
@@ -712,10 +716,18 @@ AssignedIdentifier:
/* | DefinedValue { $$.value = $1; }; // Handled through saved_aid */
ImportsBundle:
ImportsBundleInt ImportSelectionOption {
$$ = $1;
$$->option = $2;
}
| ImportsBundleInt ;
ImportsBundleInt:
ImportsList TOK_FROM TypeRefName AssignedIdentifier {
$$ = $1;
$$->fromModuleName = $3;
$$->identifier = $4;
$$->option = 0;
/* This stupid thing is used for look-back hack. */
saved_aid = $$->identifier.oid ? 0 : &($$->identifier);
checkmem($$);
...
...
@@ -755,6 +767,14 @@ ImportsElement:
}
;
ImportSelectionOption:
TOK_WITH TOK_SUCCESSORS {
$$ = OID_WITH_SUCCESSORS;
}
| TOK_WITH TOK_DESCENDANTS {
$$ = OID_WITH_DESCENDANTS;
}
;
optExports:
{ $$ = 0; }
...
...
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