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
1e448d3d
Commit
1e448d3d
authored
Mar 24, 2005
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support for some CharsDefn
parent
7039310b
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
945 additions
and
797 deletions
+945
-797
ChangeLog
ChangeLog
+3
-1
libasn1fix/asn1fix_crange.c
libasn1fix/asn1fix_crange.c
+5
-0
libasn1parser/asn1p_constr.h
libasn1parser/asn1p_constr.h
+1
-0
libasn1parser/asn1p_value.c
libasn1parser/asn1p_value.c
+4
-0
libasn1parser/asn1p_value.h
libasn1parser/asn1p_value.h
+3
-1
libasn1parser/asn1p_y.c
libasn1parser/asn1p_y.c
+845
-787
libasn1parser/asn1p_y.y
libasn1parser/asn1p_y.y
+40
-6
libasn1print/asn1print.c
libasn1print/asn1print.c
+19
-2
tests/80-chardefs-OK.asn1
tests/80-chardefs-OK.asn1
+25
-0
No files found.
ChangeLog
View file @
1e448d3d
0.9.13: 2005-Mar-2
0
0.9.13: 2005-Mar-2
4
* Added extra const qualifiers into the support code.
* More RFC variations supported in crfc2asn1.pl.
* Refined string values compatibility. (Test cases 77, 78).
* Support for ContainedSubtype constraints. (Test case 16).
* Parsing support for CONSTRAINED BY. (Test case 79).
* Support for CharsDefn (Quadruple and Tuple, most used in
ASN1-CHARACTER-MODULE) (Test case 80).
0.9.12: 2005-Mar-10
...
...
libasn1fix/asn1fix_crange.c
View file @
1e448d3d
...
...
@@ -321,6 +321,11 @@ static int _range_fill(asn1p_value_t *val, const asn1cnst_range_t *minmax, asn1c
edge
->
type
=
ARE_VALUE
;
edge
->
value
=
(
val
->
type
==
ATV_TRUE
);
return
0
;
case
ATV_TUPLE
:
case
ATV_QUADRUPLE
:
edge
->
type
=
ARE_VALUE
;
edge
->
value
=
val
->
value
.
v_integer
;
return
0
;
case
ATV_STRING
:
if
(
type
!=
ACT_CT_FROM
)
return
0
;
...
...
libasn1parser/asn1p_constr.h
View file @
1e448d3d
...
...
@@ -35,6 +35,7 @@ typedef struct asn1p_constraint_s {
ACT_CA_UNI
,
/* UNION (|) */
ACT_CA_INT
,
/* INTERSECTION (^) */
ACT_CA_EXC
,
/* EXCEPT */
ACT_CA_AEX
,
/* ALL EXCEPT */
}
type
;
enum
asn1p_constr_pres_e
{
...
...
libasn1parser/asn1p_value.c
View file @
1e448d3d
...
...
@@ -123,6 +123,8 @@ asn1p_value_clone(asn1p_value_t *v) {
case
ATV_MAX
:
case
ATV_FALSE
:
case
ATV_TRUE
:
case
ATV_TUPLE
:
case
ATV_QUADRUPLE
:
clone
=
asn1p_value_fromint
(
v
->
value
.
v_integer
);
if
(
clone
)
clone
->
type
=
v
->
type
;
return
clone
;
...
...
@@ -174,6 +176,8 @@ asn1p_value_free(asn1p_value_t *v) {
case
ATV_MAX
:
case
ATV_FALSE
:
case
ATV_TRUE
:
case
ATV_TUPLE
:
case
ATV_QUADRUPLE
:
/* No freeing necessary */
break
;
case
ATV_STRING
:
...
...
libasn1parser/asn1p_value.h
View file @
1e448d3d
...
...
@@ -20,7 +20,9 @@ typedef struct asn1p_value_s {
ATV_MIN
,
ATV_TRUE
,
ATV_FALSE
,
ATV_STRING
,
ATV_TUPLE
,
/* { 1, 15 } */
ATV_QUADRUPLE
,
/* { 0, 14, 0, 255 } */
ATV_STRING
,
/* "abcdef" */
ATV_UNPARSED
,
ATV_BITVECTOR
,
ATV_REFERENCED
,
/* Reference to a value defined elsewhere */
...
...
libasn1parser/asn1p_y.c
View file @
1e448d3d
This source diff could not be displayed because it is too large. You can
view the blob
instead.
libasn1parser/asn1p_y.y
View file @
1e448d3d
...
...
@@ -286,6 +286,7 @@ static asn1p_value_t *
%type <a_value> ContainedSubtype
%type <a_ctype> ConstraintSpec
%type <a_ctype> ConstraintRangeSpec
%type <a_value> RestrictedCharacterStringValue
%type <a_wsynt> optWithSyntax
%type <a_wsynt> WithSyntax
%type <a_wsynt> WithSyntaxFormat
...
...
@@ -1346,9 +1347,8 @@ Value:
$$ = _convert_bitstring2binary($1, 'H');
checkmem($$);
}
| TOK_cstring {
$$ = asn1p_value_frombuf($1.buf, $1.len, 0);
checkmem($$);
| RestrictedCharacterStringValue {
$$ = $$;
}
| SignedNumber {
$$ = $1;
...
...
@@ -1386,6 +1386,38 @@ DefinedValue:
}
;
RestrictedCharacterStringValue:
TOK_cstring {
$$ = asn1p_value_frombuf($1.buf, $1.len, 0);
checkmem($$);
}
| '{' TOK_number ',' TOK_number '}' {
asn1c_integer_t v = ($2 << 4) + $4;
if($2 > 7) return yyerror("X.680:2003, #37.14 "
"mandates 0..7 range for Tuple's TableColumn");
if($4 > 15) return yyerror("X.680:2003, #37.14 "
"mandates 0..15 range for Tuple's TableRow");
$$ = asn1p_value_fromint(v);
checkmem($$);
$$->type = ATV_TUPLE;
}
| '{' TOK_number ',' TOK_number ',' TOK_number ',' TOK_number '}' {
asn1c_integer_t v = ($2 << 24) | ($4 << 16) | ($6 << 8) | $8;
if($2 > 127) return yyerror("X.680:2003, #37.12 "
"mandates 0..127 range for Quadruple's Group");
if($4 > 255) return yyerror("X.680:2003, #37.12 "
"mandates 0..255 range for Quadruple's Plane");
if($6 > 255) return yyerror("X.680:2003, #37.12 "
"mandates 0..255 range for Quadruple's Row");
if($8 > 255) return yyerror("X.680:2003, #37.12 "
"mandates 0..255 range for Quadruple's Cell");
$$ = asn1p_value_fromint(v);
checkmem($$);
$$->type = ATV_QUADRUPLE;
}
;
Opaque:
TOK_opaque {
$$.len = $1.len + 1;
...
...
@@ -1544,6 +1576,9 @@ ElementSetSpec:
ConstraintSubtypeElement {
$$ = $1;
}
| TOK_ALL TOK_EXCEPT ConstraintSubtypeElement {
CONSTRAINT_INSERT($$, ACT_CA_AEX, $3, 0);
}
| ElementSetSpec Union ConstraintSubtypeElement {
CONSTRAINT_INSERT($$, ACT_CA_UNI, $1, $3);
}
...
...
@@ -1663,9 +1698,8 @@ SingleValue:
| SignedNumber {
$$ = $1;
}
| TOK_cstring {
$$ = asn1p_value_frombuf($1.buf, $1.len, 0);
checkmem($$);
| RestrictedCharacterStringValue {
$$ = $1;
}
| Identifier {
asn1p_ref_t *ref;
...
...
libasn1print/asn1print.c
View file @
1e448d3d
...
...
@@ -215,6 +215,19 @@ asn1print_value(asn1p_value_t *val, enum asn1print_flags flags) {
case
ATV_MAX
:
printf
(
"MAX"
);
return
0
;
case
ATV_FALSE
:
printf
(
"FALSE"
);
return
0
;
case
ATV_TRUE
:
printf
(
"TRUE"
);
return
0
;
case
ATV_TUPLE
:
printf
(
"{%d, %d}"
,
(
int
)(
val
->
value
.
v_integer
>>
4
),
(
int
)(
val
->
value
.
v_integer
&
0x0f
));
return
0
;
case
ATV_QUADRUPLE
:
printf
(
"{%d, %d, %d, %d}"
,
(
int
)((
val
->
value
.
v_integer
>>
24
)
&
0xff
),
(
int
)((
val
->
value
.
v_integer
>>
16
)
&
0xff
),
(
int
)((
val
->
value
.
v_integer
>>
8
)
&
0xff
),
(
int
)((
val
->
value
.
v_integer
>>
0
)
&
0xff
)
);
return
0
;
case
ATV_STRING
:
{
char
*
p
=
val
->
value
.
string
.
buf
;
...
...
@@ -339,10 +352,9 @@ asn1print_constraint(asn1p_constraint_t *ct, enum asn1print_flags flags) {
""
,
"("
};
unsigned
int
i
;
for
(
i
=
0
;
i
<
ct
->
el_count
;
i
++
)
{
enum
asn1print_flags
nflags
=
flags
;
if
(
i
)
fputs
(
symtable
[
symno
],
stdout
);
if
(
ct
->
type
==
ACT_CA_CRC
)
fputs
(
"{"
,
stdout
);
asn1print_constraint
(
ct
->
elements
[
i
],
n
flags
);
asn1print_constraint
(
ct
->
elements
[
i
],
flags
);
if
(
ct
->
type
==
ACT_CA_CRC
)
fputs
(
"}"
,
stdout
);
if
(
i
+
1
<
ct
->
el_count
&&
ct
->
type
==
ACT_CA_SET
)
...
...
@@ -350,6 +362,11 @@ asn1print_constraint(asn1p_constraint_t *ct, enum asn1print_flags flags) {
}
}
break
;
case
ACT_CA_AEX
:
assert
(
ct
->
el_count
==
1
);
printf
(
"ALL EXCEPT "
);
asn1print_constraint
(
ct
->
elements
[
0
],
flags
);
break
;
case
ACT_INVALID
:
assert
(
ct
->
type
!=
ACT_INVALID
);
break
;
...
...
tests/80-chardefs-OK.asn1
0 → 100644
View file @
1e448d3d
-- OK: Everything is fine
-- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1)
-- .spelio.software.asn1c.test (9363.1.5.1)
-- .80
ModuleCharacterDefinitions
{ iso org(3) dod(6) internet(1) private(4) enterprise(1)
spelio(9363) software(1) asn1c(5) test(1) 80 }
DEFINITIONS ::=
BEGIN
-- Elements taken from ASN1-CHARACTER-MODULE (X.680:07/2002)
-- { joint-iso-itu-t asn1(1) specification(0) modules(0) iso10646(0) }
nul IA5String ::= {0, 0}
null BMPString ::= {0, 0, 0, 0}
space BMPString ::= {0, 0, 0, 32}
tilde BMPString ::= {0, 0, 0, 126}
BasicLatin ::= BMPString(FROM (space..tilde))
BasicGreek ::= BMPString(FROM ({0, 0, 3, 112}..{0, 0, 3, 207}))
NotSpace ::= BMPString (FROM(ALL EXCEPT space))
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