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
0c68645c
Commit
0c68645c
authored
Sep 07, 2017
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated parsing bnf
parent
2d0effca
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
1490 additions
and
1272 deletions
+1490
-1272
asn1c/asn1c.c
asn1c/asn1c.c
+5
-1
doc/man/asn1c.1
doc/man/asn1c.1
+5
-0
doc/man/asn1c.man.md
doc/man/asn1c.man.md
+3
-0
libasn1parser/asn1p_y.c
libasn1parser/asn1p_y.c
+1005
-1001
libasn1parser/asn1p_y.h
libasn1parser/asn1p_y.h
+1
-1
libasn1parser/asn1p_y.y
libasn1parser/asn1p_y.y
+145
-110
libasn1parser/asn1parser.c
libasn1parser/asn1parser.c
+9
-5
libasn1parser/asn1parser.h
libasn1parser/asn1parser.h
+4
-3
libasn1print/asn1print.c
libasn1print/asn1print.c
+5
-10
tests/tests-asn1c-compiler/138-oer-constraints-OK.asn1
tests/tests-asn1c-compiler/138-oer-constraints-OK.asn1
+9
-6
tests/tests-asn1c-compiler/138-oer-constraints-OK.asn1.-Pgen-OER
...ests-asn1c-compiler/138-oer-constraints-OK.asn1.-Pgen-OER
+295
-131
tests/tests-asn1c-compiler/50-constraint-OK.asn1
tests/tests-asn1c-compiler/50-constraint-OK.asn1
+1
-1
tests/tests-asn1c-compiler/50-constraint-OK.asn1.-EFprint-constraints
...asn1c-compiler/50-constraint-OK.asn1.-EFprint-constraints
+0
-0
tests/tests-asn1c-compiler/50-constraint-OK.asn1.-Pfwide-types
.../tests-asn1c-compiler/50-constraint-OK.asn1.-Pfwide-types
+1
-1
tests/tests-asn1c-compiler/50-constraint-OK.asn1.-Pgen-PER
tests/tests-asn1c-compiler/50-constraint-OK.asn1.-Pgen-PER
+2
-2
No files found.
asn1c/asn1c.c
View file @
0c68645c
...
...
@@ -173,7 +173,10 @@ main(int ac, char **av) {
warnings_as_errors
=
1
;
break
;
}
else
if
(
strcmp
(
optarg
,
"debug-lexer"
)
==
0
)
{
asn1_parser_flags
|=
A1P_LEXER_DEBUG
;
asn1_parser_flags
|=
A1P_DEBUG_LEXER
;
break
;
}
else
if
(
strcmp
(
optarg
,
"debug-parser"
)
==
0
)
{
asn1_parser_flags
|=
A1P_DEBUG_PARSER
;
break
;
}
else
if
(
strcmp
(
optarg
,
"debug-fixer"
)
==
0
)
{
asn1_fixer_flags
|=
A1F_DEBUG
;
...
...
@@ -483,6 +486,7 @@ usage(const char *av0) {
" -Werror Treat warnings as errors; abort if any warning
\n
"
" -Wdebug-lexer Enable verbose debugging output from lexer
\n
"
" -Wdebug-parser Enable verbose debugging output from parser
\n
"
" -Wdebug-fixer --//-- semantics processor
\n
"
" -Wdebug-compiler --//-- compiler
\n
"
"
\n
"
...
...
doc/man/asn1c.1
View file @
0c68645c
...
...
@@ -78,6 +78,11 @@ Treat warnings as errors; abort if any warning is produced.
.RE
.TP
.B \-Wdebug\-lexer
Enable lexer debugging during the ASN.1 lexing stage.
.RS
.RE
.TP
.B \-Wdebug\-parser
Enable lexer debugging during the ASN.1 parsing stage.
.RS
.RE
...
...
doc/man/asn1c.man.md
View file @
0c68645c
...
...
@@ -54,6 +54,9 @@ and other encoding rules.
: Treat warnings as errors; abort if any warning is produced.
-Wdebug-lexer
: Enable lexer debugging during the ASN.1 lexing stage.
-Wdebug-parser
: Enable lexer debugging during the ASN.1 parsing stage.
-Wdebug-fixer
...
...
libasn1parser/asn1p_y.c
View file @
0c68645c
This source diff could not be displayed because it is too large. You can
view the blob
instead.
libasn1parser/asn1p_y.h
View file @
0c68645c
...
...
@@ -262,7 +262,7 @@
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef
union
YYSTYPE
#line
90
"asn1p_y.y"
#line
115
"asn1p_y.y"
{
asn1p_t
*
a_grammar
;
asn1p_module_flags_e
a_module_flags
;
...
...
libasn1parser/asn1p_y.y
View file @
0c68645c
...
...
@@ -3,6 +3,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <errno.h>
#include <assert.h>
...
...
@@ -11,6 +12,30 @@
#define YYPARSE_PARAM param
#define YYPARSE_PARAM_TYPE void **
#define YYERROR_VERBOSE
#define YYDEBUG 1
#define YYFPRINTF prefixed_fprintf
/*
* Prefix parser debug with "PARSER: " for easier human eye scanning.
*/
static int
__attribute__((format(printf, 2, 3)))
prefixed_fprintf(FILE *f, const char *fmt, ...) {
static int line_ended = 1;
va_list ap;
va_start(ap, fmt);
if(line_ended) {
fprintf(f, "PARSER: ");
line_ended = 0;
}
size_t len = strlen(fmt);
if(len && fmt[len-1] == '\n') {
line_ended = 1;
}
int ret = vfprintf(f, fmt, ap);
va_end(ap);
return ret;
}
int yylex(void);
int yyerror(const char *msg);
...
...
@@ -328,9 +353,13 @@ static asn1p_module_t *currentModule;
%type <a_tag> Tag /* [UNIVERSAL 0] IMPLICIT */
%type <a_tag> TagClass TagTypeValue TagPlicit
%type <a_tag> optTag /* [UNIVERSAL 0] IMPLICIT */
%type <a_constr> optConstraints
%type <a_constr> optSizeConstraints
%type <a_constr> optConstraint
%type <a_constr> optManyConstraints /* Only for Type */
%type <a_constr> ManyConstraints
%type <a_constr> optSizeOrConstraint
%type <a_constr> Constraint
%type <a_constr> PermittedAlphabet
%type <a_constr> SizeConstraint
%type <a_constr> SingleTypeConstraint
%type <a_constr> MultipleTypeConstraints
%type <a_constr> NamedConstraint
...
...
@@ -340,25 +369,27 @@ static asn1p_module_t *currentModule;
%type <a_constr> ConstraintSpec
%type <a_constr> SubtypeConstraint
%type <a_constr> GeneralConstraint
%type <a_constr> SetOfConstraints
%type <a_constr> ElementSetSpecs /* 1..2,...,3 */
%type <a_constr> ElementSetSpec /* 1..2
,...,3
*/
%type <a_constr> ElementSetSpec /* 1..2 */
%type <a_constr> Unions
%type <a_constr> Intersections
%type <a_constr> IntersectionElements
%type <a_constr> ConstraintSubtypeElement /* 1..2 */
%type <a_constr> Elements
%type <a_constr> SubtypeElements /* 1..2 */
%type <a_constr> SimpleTableConstraint
%type <a_constr> UserDefinedConstraint
%type <a_constr> TableConstraint
%type <a_constr> ContentsConstraint
%type <a_constr> PatternConstraint
%type <a_constr> InnerTypeConstraint
%type <a_constr> InnerTypeConstraints
%type <a_constr> ValueRange
%type <a_constr> ComponentRelationConstraint
%type <a_constr> AtNotationList
%type <a_ref> AtNotationElement
%type <a_value> SingleValue
%type <a_value> LowerEndValue
%type <a_value> UpperEndValue
%type <a_value> ContainedSubtype
%type <a_ctype> ConstraintType
%type <a_ctype> ConstraintRangeSpec
%type <a_value> RestrictedCharacterStringValue
%type <a_wsynt> optWithSyntax
...
...
@@ -366,7 +397,8 @@ static asn1p_module_t *currentModule;
%type <a_wsynt> WithSyntaxList
%type <a_wchunk> WithSyntaxToken
%type <a_marker> optMarker Marker
%type <a_int> optUnique
%type <a_int> optUNIQUE
%type <a_int> optINCLUDES
%type <a_pres> optPresenceConstraint PresenceConstraint
%type <tv_str> ComponentIdList
%type <a_int> NSTD_IndirectMarker
...
...
@@ -1073,7 +1105,7 @@ ObjectClass:
}
;
optU
nique
:
optU
NIQUE
:
{ $$ = 0; }
| TOK_UNIQUE { $$ = 1; }
;
...
...
@@ -1106,7 +1138,7 @@ ClassField:
}
/* FixedTypeValueFieldSpec ::= valuefieldreference Type UNIQUE ? ValueOptionalitySpec ? */
| TOK_valuefieldreference Type optU
nique
optMarker {
| TOK_valuefieldreference Type optU
NIQUE
optMarker {
$$ = NEW_EXPR();
$$->Identifier = $1;
$$->meta_type = AMT_OBJECTFIELD;
...
...
@@ -1244,7 +1276,7 @@ ExtensionAndException:
;
Type:
optTag TypeDeclaration optConstraints {
optTag TypeDeclaration opt
Many
Constraints {
$$ = $2;
$$->tag = $1;
/*
...
...
@@ -1258,7 +1290,7 @@ Type:
} else {
if($$->constraints) {
assert(!$2);
/* Check this : optConstraints is not used ?! */
/* Check this : opt
Many
Constraints is not used ?! */
asn1p_constraint_free($3);
} else {
$$->constraints = $3;
...
...
@@ -1315,7 +1347,7 @@ TypeDeclarationSet:
$$->expr_type = ASN_CONSTR_SET;
$$->meta_type = AMT_TYPE;
}
| TOK_SEQUENCE optSize
Constraints
TOK_OF optIdentifier optTag TypeDeclaration {
| TOK_SEQUENCE optSize
OrConstraint
TOK_OF optIdentifier optTag TypeDeclaration {
$$ = NEW_EXPR();
checkmem($$);
$$->constraints = $2;
...
...
@@ -1325,7 +1357,7 @@ TypeDeclarationSet:
$6->tag = $5;
asn1p_expr_add($$, $6);
}
| TOK_SET optSize
Constraints
TOK_OF optIdentifier optTag TypeDeclaration {
| TOK_SET optSize
OrConstraint
TOK_OF optIdentifier optTag TypeDeclaration {
$$ = NEW_EXPR();
checkmem($$);
$$->constraints = $2;
...
...
@@ -1742,31 +1774,36 @@ UnionMark: '|' | TOK_UNION;
IntersectionMark: '^' | TOK_INTERSECTION;
/* empty | Constraint */
optConstraint
s
:
optConstraint:
{ $$ = 0; }
| Constraint;
/* empty | Constraint... */
optManyConstraints:
{ $$ = 0; }
| ManyConstraints;
/* empty | Constraint | SIZE(...) */
optSize
Constraints
:
optSize
OrConstraint
:
{ $$ = 0; }
| Constraint
| TOK_SIZE '(' ConstraintSpec ')' {
CONSTRAINT_INSERT($$, ACT_CT_SIZE, $3, 0);
}
| SizeConstraint
;
Constraint:
SetOfConstraints
{
CONSTRAINT_INSERT($$, ACT_CA_SET, $
1
, 0);
'(' ConstraintSpec ')'
{
CONSTRAINT_INSERT($$, ACT_CA_SET, $
2
, 0);
}
;
SetOfConstraints:
'(' ConstraintSpec ')' {
$$ = $2;
ManyConstraints:
Constraint
| ManyConstraints Constraint {
if($2->type == ACT_CA_SET && $2->el_count == 1) {
CONSTRAINT_INSERT($$, ACT_CA_SET, $1, $2->elements[0]);
} else {
CONSTRAINT_INSERT($$, ACT_CA_SET, $1, $2);
}
| SetOfConstraints '(' ConstraintSpec ')' {
CONSTRAINT_INSERT($$, ACT_CA_SET, $1, $3);
}
;
...
...
@@ -1794,11 +1831,11 @@ ElementSetSpecs:
ct = $$;
CONSTRAINT_INSERT($$, ACT_CA_CSV, ct, $5);
}
;
;
ElementSetSpec:
Unions
| TOK_ALL TOK_EXCEPT
ConstraintSubtypeElement
{
| TOK_ALL TOK_EXCEPT
Elements
{
CONSTRAINT_INSERT($$, ACT_CA_AEX, $3, 0);
}
;
...
...
@@ -1819,22 +1856,15 @@ Intersections:
IntersectionElements:
ConstraintSubtypeElement
|
ConstraintSubtypeElement TOK_EXCEPT ConstraintSubtypeElement
{
Elements
|
Elements TOK_EXCEPT Elements
{
CONSTRAINT_INSERT($$, ACT_CA_EXC, $1, $3);
}
;
ConstraintSubtypeElement:
ConstraintType '(' ElementSetSpecs ')' {
int ret;
$$ = asn1p_constraint_new(yylineno, currentModule);
checkmem($$);
$$->type = $1;
ret = asn1p_constraint_insert($$, $3);
checkmem(ret == 0);
}
| '(' ElementSetSpecs ')' {
Elements:
SubtypeElements
| '(' ElementSetSpec ')' {
int ret;
$$ = asn1p_constraint_new(yylineno, currentModule);
checkmem($$);
...
...
@@ -1842,7 +1872,10 @@ ConstraintSubtypeElement:
ret = asn1p_constraint_insert($$, $2);
checkmem(ret == 0);
}
| SingleValue {
;
SubtypeElements:
SingleValue {
$$ = asn1p_constraint_new(yylineno, currentModule);
checkmem($$);
$$->type = ACT_EL_VALUE;
...
...
@@ -1854,40 +1887,12 @@ ConstraintSubtypeElement:
$$->type = ACT_EL_TYPE;
$$->containedSubtype = $1;
}
| SingleValue ConstraintRangeSpec SingleValue {
$$ = asn1p_constraint_new(yylineno, currentModule);
checkmem($$);
$$->type = $2;
$$->range_start = $1;
$$->range_stop = $3;
}
| TOK_MIN ConstraintRangeSpec SingleValue {
$$ = asn1p_constraint_new(yylineno, currentModule);
checkmem($$);
$$->type = $2;
$$->range_start = asn1p_value_fromint(-123);
$$->range_stop = $3;
$$->range_start->type = ATV_MIN;
}
| SingleValue ConstraintRangeSpec TOK_MAX {
$$ = asn1p_constraint_new(yylineno, currentModule);
checkmem($$);
$$->type = $2;
$$->range_start = $1;
$$->range_stop = asn1p_value_fromint(321);
$$->range_stop->type = ATV_MAX;
}
| TOK_MIN ConstraintRangeSpec TOK_MAX {
$$ = asn1p_constraint_new(yylineno, currentModule);
checkmem($$);
$$->type = $2;
$$->range_start = asn1p_value_fromint(-123);
$$->range_stop = asn1p_value_fromint(321);
$$->range_start->type = ATV_MIN;
$$->range_stop->type = ATV_MAX;
}
| InnerTypeConstraint
| PatternConstraint
| PermittedAlphabet /* FROM ... */
| SizeConstraint /* SIZE ... */
/* | TypeConstraint is via ContainedSubtype */
| InnerTypeConstraints /* WITH COMPONENT[S] ... */
| PatternConstraint /* PATTERN ... */
| ValueRange
| '{' { asn1p_lexer_hack_push_opaque_state(); } Opaque /* '}' */ {
$$ = asn1p_constraint_new(yylineno, currentModule);
checkmem($$);
...
...
@@ -1897,6 +1902,17 @@ ConstraintSubtypeElement:
}
;
PermittedAlphabet:
TOK_FROM Constraint {
CONSTRAINT_INSERT($$, ACT_CT_FROM, $2, 0);
};
SizeConstraint:
TOK_SIZE Constraint {
CONSTRAINT_INSERT($$, ACT_CT_SIZE, $2, 0);
};
PatternConstraint:
TOK_PATTERN TOK_cstring {
$$ = asn1p_constraint_new(yylineno, currentModule);
...
...
@@ -1914,14 +1930,28 @@ PatternConstraint:
}
;
ConstraintType:
TOK_SIZE {
$$ = ACT_CT_SIZE;
}
| TOK_FROM {
$$ = ACT_CT_FROM;
}
;
ValueRange:
LowerEndValue ConstraintRangeSpec UpperEndValue {
$$ = asn1p_constraint_new(yylineno, currentModule);
checkmem($$);
$$->type = $2;
$$->range_start = $1;
$$->range_stop = $3;
};
LowerEndValue:
SingleValue
| TOK_MIN {
$$ = asn1p_value_fromint(-123);
$$->type = ATV_MIN;
};
UpperEndValue:
SingleValue
| TOK_MAX {
$$ = asn1p_value_fromint(321);
$$->type = ATV_MAX;
};
SingleValue:
TOK_FALSE {
...
...
@@ -1964,17 +1994,22 @@ BitStringValue:
;
ContainedSubtype:
Type {
$$ = asn1p_value_fromtype($
1
);
optINCLUDES
Type {
$$ = asn1p_value_fromtype($
2
);
checkmem($$);
}
;
optINCLUDES:
{ $$ = 0; }
| TOK_INCLUDES { $$ = 1; }
;
/*
* X.680 08/2015
* #51.8.5
*/
InnerTypeConstraint:
InnerTypeConstraint
s
:
TOK_WITH TOK_COMPONENT SingleTypeConstraint {
CONSTRAINT_INSERT($$, ACT_CT_WCOMP, $3, 0);
}
...
...
@@ -2012,7 +2047,7 @@ TypeConstraints:
}
;
NamedConstraint:
IdentifierAsValue optConstraint
s
optPresenceConstraint {
IdentifierAsValue optConstraint optPresenceConstraint {
$$ = asn1p_constraint_new(yylineno, currentModule);
checkmem($$);
$$->type = ACT_EL_VALUE;
...
...
libasn1parser/asn1parser.c
View file @
0c68645c
...
...
@@ -132,6 +132,7 @@ extern int asn1p_lexer_types_year;
extern
int
asn1p_lexer_constructs_year
;
extern
int
asn1p_lexer_extended_values
;
extern
int
asn1p__flex_debug
;
extern
int
asn1p_debug
;
static
int
_asn1p_set_flags
(
enum
asn1p_flags
flags
)
{
...
...
@@ -139,15 +140,18 @@ _asn1p_set_flags(enum asn1p_flags flags) {
asn1p_lexer_types_year
=
0
;
asn1p_lexer_constructs_year
=
0
;
asn1p__flex_debug
=
0
;
asn1p_debug
=
0
;
/*
* Enable debugging in lexer.
*/
if
(
flags
&
A1P_LEXER_DEBUG
)
{
flags
&=
~
A1P_LEXER_DEBUG
;
if
(
flags
&
A1P_DEBUG_LEXER
)
{
flags
&=
~
A1P_DEBUG_LEXER
;
asn1p__flex_debug
=
1
;
}
if
(
flags
&
A1P_DEBUG_PARSER
)
{
flags
&=
~
A1P_DEBUG_PARSER
;
asn1p_debug
=
1
;
}
if
(
flags
&
A1P_EXTENDED_VALUES
)
{
flags
&=
~
A1P_EXTENDED_VALUES
;
asn1p_lexer_extended_values
=
1
;
...
...
libasn1parser/asn1parser.h
View file @
0c68645c
...
...
@@ -29,13 +29,14 @@
enum
asn1p_flags
{
A1P_NOFLAGS
,
/*
* Enable verbose debugging output from lexer.
* Enable verbose debugging output from lexer
and parser
.
*/
A1P_LEXER_DEBUG
=
0x01
,
A1P_DEBUG_LEXER
=
0x01
,
A1P_DEBUG_PARSER
=
0x02
,
/*
* Unlock internal helper value types.
*/
A1P_EXTENDED_VALUES
=
0x0
2
A1P_EXTENDED_VALUES
=
0x0
4
};
/*
...
...
libasn1print/asn1print.c
View file @
0c68645c
...
...
@@ -341,9 +341,6 @@ asn1print_constraint(const asn1p_constraint_t *ct, enum asn1print_flags flags) {
if
(
ct
==
0
)
return
0
;
if
(
ct
->
type
==
ACT_CA_SET
)
safe_printf
(
"("
);
switch
(
ct
->
type
)
{
case
ACT_EL_TYPE
:
asn1print_value
(
ct
->
containedSubtype
,
flags
);
...
...
@@ -373,14 +370,13 @@ asn1print_constraint(const asn1p_constraint_t *ct, enum asn1print_flags flags) {
case
ACT_CT_SIZE
:
case
ACT_CT_FROM
:
switch
(
ct
->
type
)
{
case
ACT_CT_SIZE
:
safe_printf
(
"SIZE
(
"
);
break
;
case
ACT_CT_FROM
:
safe_printf
(
"FROM
(
"
);
break
;
default:
safe_printf
(
"???
(
"
);
break
;
case
ACT_CT_SIZE
:
safe_printf
(
"SIZE"
);
break
;
case
ACT_CT_FROM
:
safe_printf
(
"FROM"
);
break
;
default:
safe_printf
(
"??? "
);
break
;
}
assert
(
ct
->
el_count
!=
0
);
assert
(
ct
->
el_count
==
1
);
asn1print_constraint
(
ct
->
elements
[
0
],
flags
);
safe_printf
(
")"
);
break
;
case
ACT_CT_WCOMP
:
assert
(
ct
->
el_count
!=
0
);
...
...
@@ -431,6 +427,7 @@ asn1print_constraint(const asn1p_constraint_t *ct, enum asn1print_flags flags) {
char
*
symtable
[]
=
{
" EXCEPT "
,
" ^ "
,
" | "
,
","
,
""
,
"("
};
unsigned
int
i
;
if
(
ct
->
type
==
ACT_CA_SET
)
safe_printf
(
"("
);
for
(
i
=
0
;
i
<
ct
->
el_count
;
i
++
)
{
if
(
i
)
safe_printf
(
"%s"
,
symtable
[
symno
]);
if
(
ct
->
type
==
ACT_CA_CRC
)
safe_printf
(
"{"
);
...
...
@@ -439,6 +436,7 @@ asn1print_constraint(const asn1p_constraint_t *ct, enum asn1print_flags flags) {
if
(
ct
->
type
==
ACT_CA_SET
&&
i
+
1
<
ct
->
el_count
)
safe_printf
(
") "
);
}
if
(
ct
->
type
==
ACT_CA_SET
)
safe_printf
(
")"
);
}
break
;
case
ACT_CA_AEX
:
...
...
@@ -457,9 +455,6 @@ asn1print_constraint(const asn1p_constraint_t *ct, enum asn1print_flags flags) {
asn1print_constraint
(
ct
->
elements
[
0
],
flags
);
}
if
(
ct
->
type
==
ACT_CA_SET
)
safe_printf
(
")"
);
return
0
;
}
...
...
tests/tests-asn1c-compiler/138-oer-constraints-OK.asn1
View file @
0c68645c
...
...
@@ -20,13 +20,16 @@ BEGIN
G-3-3 ::= INTEGER (0..10,...)(2..5,...)(3) -- OER-visible constraint 3
-- X.696 #8.2.4 Not OER-visible parts of INTERSECTION are ignored
H-4-5 ::= INTEGER ((0..5) ^ (4..9)) -- OER-visible constraint 4..5
I-
0-5 ::= INTEGER ((0..5) ^ (4..12,...)) -- OER-visible constraint 0
..5
J-4-
9 ::= INTEGER ((0..5,...) ^ (4..9)) -- OER-visible constraint 4..9
K-
inv ::= INTEGER ((0..5,...) ^ (4..9,...)) -- Not OER-visible
I-
1-5 ::= INTEGER ((0..5) ^ (EConstr)) -- OER-visible constraint 1
..5
J-4-
5 ::= INTEGER ((EConstr) ^ (4..9)) -- OER-visible constraint 4..5
K-
1-4 ::= INTEGER ((FConstr) ^ (EConstr)) -- OER-visible constraint 1..4
-- X.696 #8.2.5 UNION with exeptions are ignored
L-0-5 ::= INTEGER ((0) | (5)) -- OER-visible constraint 0..5
M-inv ::= INTEGER ((0) | (5,...)) -- Not OER-visible
N-inv ::= INTEGER ((0..4,...) | (5)) -- Not OER-visible
O-inv ::= INTEGER ((0..4,...) | (5,...)) -- Not OER-visible
M-inv ::= INTEGER ((0) | (EConstr),...) -- Not OER-visible
N-0-5 ::= INTEGER ((FConstr) | (5)) -- OER-visible constraint 0..5
O-inv ::= INTEGER ((FConstr) | (5), ...) -- Not OER-visible
EConstr ::= INTEGER (1..5,...)
FConstr ::= INTEGER (0..4)
END
tests/tests-asn1c-compiler/138-oer-constraints-OK.asn1.-Pgen-OER
View file @
0c68645c
...
...
@@ -624,31 +624,31 @@ asn_TYPE_descriptor_t asn_DEF_H_4_5 = {
};
/*** <<< INCLUDES [I-
0
-5] >>> ***/
/*** <<< INCLUDES [I-
1
-5] >>> ***/
#include <NativeInteger.h>
/*** <<< TYPE-DECLS [I-
0
-5] >>> ***/
/*** <<< TYPE-DECLS [I-
1
-5] >>> ***/
typedef long I_
0
_5_t;
typedef long I_
1
_5_t;
/*** <<< FUNC-DECLS [I-
0
-5] >>> ***/
/*** <<< FUNC-DECLS [I-
1
-5] >>> ***/
extern asn_TYPE_descriptor_t asn_DEF_I_
0
_5;
asn_struct_free_f I_
0
_5_free;
asn_struct_print_f I_
0
_5_print;
asn_constr_check_f I_
0
_5_constraint;
ber_type_decoder_f I_
0
_5_decode_ber;
der_type_encoder_f I_
0
_5_encode_der;
xer_type_decoder_f I_
0
_5_decode_xer;
xer_type_encoder_f I_
0
_5_encode_xer;
oer_type_decoder_f I_
0
_5_decode_oer;
oer_type_encoder_f I_
0
_5_encode_oer;
extern asn_TYPE_descriptor_t asn_DEF_I_
1
_5;
asn_struct_free_f I_
1
_5_free;
asn_struct_print_f I_
1
_5_print;
asn_constr_check_f I_
1
_5_constraint;
ber_type_decoder_f I_
1
_5_decode_ber;
der_type_encoder_f I_
1
_5_encode_der;
xer_type_decoder_f I_
1
_5_decode_xer;
xer_type_encoder_f I_
1
_5_encode_xer;
oer_type_decoder_f I_
1
_5_decode_oer;
oer_type_encoder_f I_
1
_5_encode_oer;
/*** <<< CODE [I-
0
-5] >>> ***/
/*** <<< CODE [I-
1
-5] >>> ***/
int
I_
0
_5_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
I_
1
_5_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
long value;
...
...
@@ -661,7 +661,7 @@ I_0_5_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
value = *(const long *)sptr;
if((value >=
4
&& value <= 5)) {
if((value >=
1
&& value <= 5)) {
/* Constraint check succeeded */
return 0;
} else {
...
...
@@ -677,60 +677,60 @@ I_0_5_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
* so here we adjust the DEF accordingly.
*/
/*** <<< CTDEFS [I-
0
-5] >>> ***/
/*** <<< CTDEFS [I-
1
-5] >>> ***/
static asn_oer_constraints_t asn_OER_type_I_
0
_5_constr_1 GCC_NOTUSED = {
{ 1, 1 } /* (
0
..5) */,
static asn_oer_constraints_t asn_OER_type_I_
1
_5_constr_1 GCC_NOTUSED = {
{ 1, 1 } /* (
1
..5) */,
-1};
/*** <<< STAT-DEFS [I-
0
-5] >>> ***/
/*** <<< STAT-DEFS [I-
1
-5] >>> ***/
static const ber_tlv_tag_t asn_DEF_I_
0
_5_tags_1[] = {
static const ber_tlv_tag_t asn_DEF_I_
1
_5_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
};
asn_TYPE_descriptor_t asn_DEF_I_
0
_5 = {
"I-
0
-5",
"I-
0
-5",
asn_TYPE_descriptor_t asn_DEF_I_
1
_5 = {
"I-
1
-5",
"I-
1
-5",
&asn_OP_NativeInteger,
I_
0
_5_constraint,
asn_DEF_I_
0
_5_tags_1,
sizeof(asn_DEF_I_
0
_5_tags_1)
/sizeof(asn_DEF_I_
0
_5_tags_1[0]), /* 1 */
asn_DEF_I_
0
_5_tags_1, /* Same as above */
sizeof(asn_DEF_I_
0
_5_tags_1)
/sizeof(asn_DEF_I_
0
_5_tags_1[0]), /* 1 */
&asn_OER_type_I_
0
_5_constr_1,
I_
1
_5_constraint,
asn_DEF_I_
1
_5_tags_1,
sizeof(asn_DEF_I_
1
_5_tags_1)
/sizeof(asn_DEF_I_
1
_5_tags_1[0]), /* 1 */
asn_DEF_I_
1
_5_tags_1, /* Same as above */
sizeof(asn_DEF_I_
1
_5_tags_1)
/sizeof(asn_DEF_I_
1
_5_tags_1[0]), /* 1 */
&asn_OER_type_I_
1
_5_constr_1,
0, /* No PER visible constraints */
0, 0, /* No members */
0 /* No specifics */
};
/*** <<< INCLUDES [J-4-
9
] >>> ***/
/*** <<< INCLUDES [J-4-
5
] >>> ***/
#include <NativeInteger.h>
/*** <<< TYPE-DECLS [J-4-
9
] >>> ***/
/*** <<< TYPE-DECLS [J-4-
5
] >>> ***/
typedef long J_4_
9
_t;
typedef long J_4_
5
_t;
/*** <<< FUNC-DECLS [J-4-
9
] >>> ***/
/*** <<< FUNC-DECLS [J-4-
5
] >>> ***/
extern asn_TYPE_descriptor_t asn_DEF_J_4_
9
;
asn_struct_free_f J_4_
9
_free;
asn_struct_print_f J_4_
9
_print;
asn_constr_check_f J_4_
9
_constraint;
ber_type_decoder_f J_4_
9
_decode_ber;
der_type_encoder_f J_4_
9
_encode_der;
xer_type_decoder_f J_4_
9
_decode_xer;
xer_type_encoder_f J_4_
9
_encode_xer;
oer_type_decoder_f J_4_
9
_decode_oer;
oer_type_encoder_f J_4_
9
_encode_oer;
extern asn_TYPE_descriptor_t asn_DEF_J_4_
5
;
asn_struct_free_f J_4_
5
_free;
asn_struct_print_f J_4_
5
_print;
asn_constr_check_f J_4_
5
_constraint;
ber_type_decoder_f J_4_
5
_decode_ber;
der_type_encoder_f J_4_
5
_encode_der;
xer_type_decoder_f J_4_
5
_decode_xer;
xer_type_encoder_f J_4_
5
_encode_xer;
oer_type_decoder_f J_4_
5
_decode_oer;
oer_type_encoder_f J_4_
5
_encode_oer;
/*** <<< CODE [J-4-
9
] >>> ***/
/*** <<< CODE [J-4-
5
] >>> ***/
int
J_4_
9
_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
J_4_
5
_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
long value;
...
...
@@ -759,60 +759,60 @@ J_4_9_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
* so here we adjust the DEF accordingly.
*/
/*** <<< CTDEFS [J-4-
9
] >>> ***/
/*** <<< CTDEFS [J-4-
5
] >>> ***/
static asn_oer_constraints_t asn_OER_type_J_4_
9
_constr_1 GCC_NOTUSED = {
{ 1, 1 } /* (4..
9
) */,
static asn_oer_constraints_t asn_OER_type_J_4_
5
_constr_1 GCC_NOTUSED = {
{ 1, 1 } /* (4..
5
) */,
-1};
/*** <<< STAT-DEFS [J-4-
9
] >>> ***/
/*** <<< STAT-DEFS [J-4-
5
] >>> ***/
static const ber_tlv_tag_t asn_DEF_J_4_
9
_tags_1[] = {
static const ber_tlv_tag_t asn_DEF_J_4_
5
_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
};
asn_TYPE_descriptor_t asn_DEF_J_4_
9
= {
"J-4-
9
",
"J-4-
9
",
asn_TYPE_descriptor_t asn_DEF_J_4_
5
= {
"J-4-
5
",
"J-4-
5
",
&asn_OP_NativeInteger,
J_4_
9
_constraint,
asn_DEF_J_4_
9
_tags_1,
sizeof(asn_DEF_J_4_
9
_tags_1)
/sizeof(asn_DEF_J_4_
9
_tags_1[0]), /* 1 */
asn_DEF_J_4_
9
_tags_1, /* Same as above */
sizeof(asn_DEF_J_4_
9
_tags_1)
/sizeof(asn_DEF_J_4_
9
_tags_1[0]), /* 1 */
&asn_OER_type_J_4_
9
_constr_1,
J_4_
5
_constraint,
asn_DEF_J_4_
5
_tags_1,
sizeof(asn_DEF_J_4_
5
_tags_1)
/sizeof(asn_DEF_J_4_
5
_tags_1[0]), /* 1 */
asn_DEF_J_4_
5
_tags_1, /* Same as above */
sizeof(asn_DEF_J_4_
5
_tags_1)
/sizeof(asn_DEF_J_4_
5
_tags_1[0]), /* 1 */
&asn_OER_type_J_4_
5
_constr_1,
0, /* No PER visible constraints */
0, 0, /* No members */
0 /* No specifics */
};
/*** <<< INCLUDES [K-
inv
] >>> ***/
/*** <<< INCLUDES [K-
1-4
] >>> ***/
#include <NativeInteger.h>
/*** <<< TYPE-DECLS [K-
inv
] >>> ***/
/*** <<< TYPE-DECLS [K-
1-4
] >>> ***/
typedef long K_
inv
_t;
typedef long K_
1_4
_t;
/*** <<< FUNC-DECLS [K-
inv
] >>> ***/
/*** <<< FUNC-DECLS [K-
1-4
] >>> ***/
extern asn_TYPE_descriptor_t asn_DEF_K_
inv
;
asn_struct_free_f K_
inv
_free;
asn_struct_print_f K_
inv
_print;
asn_constr_check_f K_
inv
_constraint;
ber_type_decoder_f K_
inv
_decode_ber;
der_type_encoder_f K_
inv
_encode_der;
xer_type_decoder_f K_
inv
_decode_xer;
xer_type_encoder_f K_
inv
_encode_xer;
oer_type_decoder_f K_
inv
_decode_oer;
oer_type_encoder_f K_
inv
_encode_oer;
extern asn_TYPE_descriptor_t asn_DEF_K_
1_4
;
asn_struct_free_f K_
1_4
_free;
asn_struct_print_f K_
1_4
_print;
asn_constr_check_f K_
1_4
_constraint;
ber_type_decoder_f K_
1_4
_decode_ber;
der_type_encoder_f K_
1_4
_encode_der;
xer_type_decoder_f K_
1_4
_decode_xer;
xer_type_encoder_f K_
1_4
_encode_xer;
oer_type_decoder_f K_
1_4
_decode_oer;
oer_type_encoder_f K_
1_4
_encode_oer;
/*** <<< CODE [K-
inv
] >>> ***/
/*** <<< CODE [K-
1-4
] >>> ***/
int
K_
inv
_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
K_
1_4
_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
long value;
...
...
@@ -825,7 +825,7 @@ K_inv_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
value = *(const long *)sptr;
if((value >=
4 && value <= 5
)) {
if((value >=
1 && value <= 4
)) {
/* Constraint check succeeded */
return 0;
} else {
...
...
@@ -841,29 +841,29 @@ K_inv_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
* so here we adjust the DEF accordingly.
*/
/*** <<< CTDEFS [K-
inv
] >>> ***/
/*** <<< CTDEFS [K-
1-4
] >>> ***/
static asn_oer_constraints_t asn_OER_type_K_
inv
_constr_1 GCC_NOTUSED = {
{
0, 0 }
,
static asn_oer_constraints_t asn_OER_type_K_
1_4
_constr_1 GCC_NOTUSED = {
{
1, 1 } /* (1..4) */
,
-1};
/*** <<< STAT-DEFS [K-
inv
] >>> ***/
/*** <<< STAT-DEFS [K-
1-4
] >>> ***/
static const ber_tlv_tag_t asn_DEF_K_
inv
_tags_1[] = {
static const ber_tlv_tag_t asn_DEF_K_
1_4
_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
};
asn_TYPE_descriptor_t asn_DEF_K_
inv
= {
"K-
inv
",
"K-
inv
",
asn_TYPE_descriptor_t asn_DEF_K_
1_4
= {
"K-
1-4
",
"K-
1-4
",
&asn_OP_NativeInteger,
K_
inv
_constraint,
asn_DEF_K_
inv
_tags_1,
sizeof(asn_DEF_K_
inv
_tags_1)
/sizeof(asn_DEF_K_
inv
_tags_1[0]), /* 1 */
asn_DEF_K_
inv
_tags_1, /* Same as above */
sizeof(asn_DEF_K_
inv
_tags_1)
/sizeof(asn_DEF_K_
inv
_tags_1[0]), /* 1 */
&asn_OER_type_K_
inv
_constr_1,
K_
1_4
_constraint,
asn_DEF_K_
1_4
_tags_1,
sizeof(asn_DEF_K_
1_4
_tags_1)
/sizeof(asn_DEF_K_
1_4
_tags_1[0]), /* 1 */
asn_DEF_K_
1_4
_tags_1, /* Same as above */
sizeof(asn_DEF_K_
1_4
_tags_1)
/sizeof(asn_DEF_K_
1_4
_tags_1[0]), /* 1 */
&asn_OER_type_K_
1_4
_constr_1,
0, /* No PER visible constraints */
0, 0, /* No members */
0 /* No specifics */
...
...
@@ -989,7 +989,7 @@ M_inv_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
value = *(const long *)sptr;
if((
(value == 0) || (value == 5)
)) {
if((
value >= 0 && value <= 5
)) {
/* Constraint check succeeded */
return 0;
} else {
...
...
@@ -1034,31 +1034,31 @@ asn_TYPE_descriptor_t asn_DEF_M_inv = {
};
/*** <<< INCLUDES [N-
inv
] >>> ***/
/*** <<< INCLUDES [N-
0-5
] >>> ***/
#include <NativeInteger.h>
/*** <<< TYPE-DECLS [N-
inv
] >>> ***/
/*** <<< TYPE-DECLS [N-
0-5
] >>> ***/
typedef long N_
inv
_t;
typedef long N_
0_5
_t;
/*** <<< FUNC-DECLS [N-
inv
] >>> ***/
/*** <<< FUNC-DECLS [N-
0-5
] >>> ***/
extern asn_TYPE_descriptor_t asn_DEF_N_
inv
;
asn_struct_free_f N_
inv
_free;
asn_struct_print_f N_
inv
_print;
asn_constr_check_f N_
inv
_constraint;
ber_type_decoder_f N_
inv
_decode_ber;
der_type_encoder_f N_
inv
_encode_der;
xer_type_decoder_f N_
inv
_decode_xer;
xer_type_encoder_f N_
inv
_encode_xer;
oer_type_decoder_f N_
inv
_decode_oer;
oer_type_encoder_f N_
inv
_encode_oer;
extern asn_TYPE_descriptor_t asn_DEF_N_
0_5
;
asn_struct_free_f N_
0_5
_free;
asn_struct_print_f N_
0_5
_print;
asn_constr_check_f N_
0_5
_constraint;
ber_type_decoder_f N_
0_5
_decode_ber;
der_type_encoder_f N_
0_5
_encode_der;
xer_type_decoder_f N_
0_5
_decode_xer;
xer_type_encoder_f N_
0_5
_encode_xer;
oer_type_decoder_f N_
0_5
_decode_oer;
oer_type_encoder_f N_
0_5
_encode_oer;
/*** <<< CODE [N-
inv
] >>> ***/
/*** <<< CODE [N-
0-5
] >>> ***/
int
N_
inv
_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
N_
0_5
_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
long value;
...
...
@@ -1087,29 +1087,29 @@ N_inv_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
* so here we adjust the DEF accordingly.
*/
/*** <<< CTDEFS [N-
inv
] >>> ***/
/*** <<< CTDEFS [N-
0-5
] >>> ***/
static asn_oer_constraints_t asn_OER_type_N_
inv
_constr_1 GCC_NOTUSED = {
{
0, 0 }
,
static asn_oer_constraints_t asn_OER_type_N_
0_5
_constr_1 GCC_NOTUSED = {
{
1, 1 } /* (0..5) */
,
-1};
/*** <<< STAT-DEFS [N-
inv
] >>> ***/
/*** <<< STAT-DEFS [N-
0-5
] >>> ***/
static const ber_tlv_tag_t asn_DEF_N_
inv
_tags_1[] = {
static const ber_tlv_tag_t asn_DEF_N_
0_5
_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
};
asn_TYPE_descriptor_t asn_DEF_N_
inv
= {
"N-
inv
",
"N-
inv
",
asn_TYPE_descriptor_t asn_DEF_N_
0_5
= {
"N-
0-5
",
"N-
0-5
",
&asn_OP_NativeInteger,
N_
inv
_constraint,
asn_DEF_N_
inv
_tags_1,
sizeof(asn_DEF_N_
inv
_tags_1)
/sizeof(asn_DEF_N_
inv
_tags_1[0]), /* 1 */
asn_DEF_N_
inv
_tags_1, /* Same as above */
sizeof(asn_DEF_N_
inv
_tags_1)
/sizeof(asn_DEF_N_
inv
_tags_1[0]), /* 1 */
&asn_OER_type_N_
inv
_constr_1,
N_
0_5
_constraint,
asn_DEF_N_
0_5
_tags_1,
sizeof(asn_DEF_N_
0_5
_tags_1)
/sizeof(asn_DEF_N_
0_5
_tags_1[0]), /* 1 */
asn_DEF_N_
0_5
_tags_1, /* Same as above */
sizeof(asn_DEF_N_
0_5
_tags_1)
/sizeof(asn_DEF_N_
0_5
_tags_1[0]), /* 1 */
&asn_OER_type_N_
0_5
_constr_1,
0, /* No PER visible constraints */
0, 0, /* No members */
0 /* No specifics */
...
...
@@ -1197,3 +1197,167 @@ asn_TYPE_descriptor_t asn_DEF_O_inv = {
0 /* No specifics */
};
/*** <<< INCLUDES [EConstr] >>> ***/
#include <NativeInteger.h>
/*** <<< TYPE-DECLS [EConstr] >>> ***/
typedef long EConstr_t;
/*** <<< FUNC-DECLS [EConstr] >>> ***/
extern asn_TYPE_descriptor_t asn_DEF_EConstr;
asn_struct_free_f EConstr_free;
asn_struct_print_f EConstr_print;
asn_constr_check_f EConstr_constraint;
ber_type_decoder_f EConstr_decode_ber;
der_type_encoder_f EConstr_encode_der;
xer_type_decoder_f EConstr_decode_xer;
xer_type_encoder_f EConstr_encode_xer;
oer_type_decoder_f EConstr_decode_oer;
oer_type_encoder_f EConstr_encode_oer;
/*** <<< CODE [EConstr] >>> ***/
int
EConstr_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
long value;
if(!sptr) {
ASN__CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
value = *(const long *)sptr;
if((value >= 1 && value <= 5)) {
/* Constraint check succeeded */
return 0;
} else {
ASN__CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
}
/*
* This type is implemented using NativeInteger,
* so here we adjust the DEF accordingly.
*/
/*** <<< CTDEFS [EConstr] >>> ***/
static asn_oer_constraints_t asn_OER_type_EConstr_constr_1 GCC_NOTUSED = {
{ 0, 0 },
-1};
/*** <<< STAT-DEFS [EConstr] >>> ***/
static const ber_tlv_tag_t asn_DEF_EConstr_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
};
asn_TYPE_descriptor_t asn_DEF_EConstr = {
"EConstr",
"EConstr",
&asn_OP_NativeInteger,
EConstr_constraint,
asn_DEF_EConstr_tags_1,
sizeof(asn_DEF_EConstr_tags_1)
/sizeof(asn_DEF_EConstr_tags_1[0]), /* 1 */
asn_DEF_EConstr_tags_1, /* Same as above */
sizeof(asn_DEF_EConstr_tags_1)
/sizeof(asn_DEF_EConstr_tags_1[0]), /* 1 */
&asn_OER_type_EConstr_constr_1,
0, /* No PER visible constraints */
0, 0, /* No members */
0 /* No specifics */
};
/*** <<< INCLUDES [FConstr] >>> ***/
#include <NativeInteger.h>
/*** <<< TYPE-DECLS [FConstr] >>> ***/
typedef long FConstr_t;
/*** <<< FUNC-DECLS [FConstr] >>> ***/
extern asn_TYPE_descriptor_t asn_DEF_FConstr;
asn_struct_free_f FConstr_free;
asn_struct_print_f FConstr_print;
asn_constr_check_f FConstr_constraint;
ber_type_decoder_f FConstr_decode_ber;
der_type_encoder_f FConstr_encode_der;
xer_type_decoder_f FConstr_decode_xer;
xer_type_encoder_f FConstr_encode_xer;
oer_type_decoder_f FConstr_decode_oer;
oer_type_encoder_f FConstr_encode_oer;
/*** <<< CODE [FConstr] >>> ***/
int
FConstr_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
long value;
if(!sptr) {
ASN__CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
value = *(const long *)sptr;
if((value >= 0 && value <= 4)) {
/* Constraint check succeeded */
return 0;
} else {
ASN__CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
}
/*
* This type is implemented using NativeInteger,
* so here we adjust the DEF accordingly.
*/
/*** <<< CTDEFS [FConstr] >>> ***/
static asn_oer_constraints_t asn_OER_type_FConstr_constr_1 GCC_NOTUSED = {
{ 1, 1 } /* (0..4) */,
-1};
/*** <<< STAT-DEFS [FConstr] >>> ***/
static const ber_tlv_tag_t asn_DEF_FConstr_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
};
asn_TYPE_descriptor_t asn_DEF_FConstr = {
"FConstr",
"FConstr",
&asn_OP_NativeInteger,
FConstr_constraint,
asn_DEF_FConstr_tags_1,
sizeof(asn_DEF_FConstr_tags_1)
/sizeof(asn_DEF_FConstr_tags_1[0]), /* 1 */
asn_DEF_FConstr_tags_1, /* Same as above */
sizeof(asn_DEF_FConstr_tags_1)
/sizeof(asn_DEF_FConstr_tags_1[0]), /* 1 */
&asn_OER_type_FConstr_constr_1,
0, /* No PER visible constraints */
0, 0, /* No members */
0 /* No specifics */
};
tests/tests-asn1c-compiler/50-constraint-OK.asn1
View file @
0c68645c
...
...
@@ -24,7 +24,7 @@ BEGIN
other-ten Int2 ::= 10
-- G.4.3.4
ExtensibleExtensions ::= INTEGER (
(1..256,...) INTERSECTION (1..256))
ExtensibleExtensions ::= INTEGER (
1..256) (1..255,...)
Str1 ::= IA5String
Str2 ::= Str1 (SIZE(MIN..20 | 25..30))
...
...
tests/tests-asn1c-compiler/50-constraint-OK.asn1.-EFprint-constraints
View file @
0c68645c
No preview for this file type
tests/tests-asn1c-compiler/50-constraint-OK.asn1.-Pfwide-types
View file @
0c68645c
...
...
@@ -405,7 +405,7 @@ ExtensibleExtensions_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
return -1;
}
if((value >= 1 && value <= 25
6
)) {
if((value >= 1 && value <= 25
5
)) {
/* Constraint check succeeded */
return 0;
} else {
...
...
tests/tests-asn1c-compiler/50-constraint-OK.asn1.-Pgen-PER
View file @
0c68645c
...
...
@@ -427,7 +427,7 @@ ExtensibleExtensions_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
value = *(const long *)sptr;
if((value >= 1 && value <= 25
6
)) {
if((value >= 1 && value <= 25
5
)) {
/* Constraint check succeeded */
return 0;
} else {
...
...
@@ -446,7 +446,7 @@ ExtensibleExtensions_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
/*** <<< CTDEFS [ExtensibleExtensions] >>> ***/
static asn_per_constraints_t asn_PER_type_ExtensibleExtensions_constr_1 GCC_NOTUSED = {
{ APC_CONSTRAINED | APC_EXTENSIBLE, 8, 8, 1, 25
6 } /* (1..256
,...) */,
{ APC_CONSTRAINED | APC_EXTENSIBLE, 8, 8, 1, 25
5 } /* (1..255
,...) */,
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
0, 0 /* No PER value map */
};
...
...
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