Commit 0c68645c authored by Lev Walkin's avatar Lev Walkin

updated parsing bnf

parent 2d0effca
......@@ -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"
......
......@@ -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
......
......@@ -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
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -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;
......
......@@ -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:
}
;
optUnique:
optUNIQUE:
{ $$ = 0; }
| TOK_UNIQUE { $$ = 1; }
;
......@@ -1106,7 +1138,7 @@ ClassField:
}
/* FixedTypeValueFieldSpec ::= valuefieldreference Type UNIQUE ? ValueOptionalitySpec ? */
| TOK_valuefieldreference Type optUnique optMarker {
| TOK_valuefieldreference Type optUNIQUE optMarker {
$$ = NEW_EXPR();
$$->Identifier = $1;
$$->meta_type = AMT_OBJECTFIELD;
......@@ -1244,7 +1276,7 @@ ExtensionAndException:
;
Type:
optTag TypeDeclaration optConstraints {
optTag TypeDeclaration optManyConstraints {
$$ = $2;
$$->tag = $1;
/*
......@@ -1258,7 +1290,7 @@ Type:
} else {
if($$->constraints) {
assert(!$2);
/* Check this : optConstraints is not used ?! */
/* Check this : optManyConstraints 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 optSizeConstraints TOK_OF optIdentifier optTag TypeDeclaration {
| TOK_SEQUENCE optSizeOrConstraint TOK_OF optIdentifier optTag TypeDeclaration {
$$ = NEW_EXPR();
checkmem($$);
$$->constraints = $2;
......@@ -1325,7 +1357,7 @@ TypeDeclarationSet:
$6->tag = $5;
asn1p_expr_add($$, $6);
}
| TOK_SET optSizeConstraints TOK_OF optIdentifier optTag TypeDeclaration {
| TOK_SET optSizeOrConstraint TOK_OF optIdentifier optTag TypeDeclaration {
$$ = NEW_EXPR();
checkmem($$);
$$->constraints = $2;
......@@ -1742,31 +1774,36 @@ UnionMark: '|' | TOK_UNION;
IntersectionMark: '^' | TOK_INTERSECTION;
/* empty | Constraint */
optConstraints:
optConstraint:
{ $$ = 0; }
| Constraint;
/* empty | Constraint... */
optManyConstraints:
{ $$ = 0; }
| ManyConstraints;
/* empty | Constraint | SIZE(...) */
optSizeConstraints:
optSizeOrConstraint:
{ $$ = 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;
}
| SetOfConstraints '(' ConstraintSpec ')' {
CONSTRAINT_INSERT($$, ACT_CA_SET, $1, $3);
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);
}
}
;
......@@ -1779,26 +1816,26 @@ ElementSetSpecs:
$$ = asn1p_constraint_new(yylineno, currentModule);
$$->type = ACT_EL_EXT;
}
| ElementSetSpec
| ElementSetSpec ',' TOK_ThreeDots {
asn1p_constraint_t *ct;
ct = asn1p_constraint_new(yylineno, currentModule);
ct->type = ACT_EL_EXT;
CONSTRAINT_INSERT($$, ACT_CA_CSV, $1, ct);
}
| ElementSetSpec ',' TOK_ThreeDots ',' ElementSetSpec {
asn1p_constraint_t *ct;
ct = asn1p_constraint_new(yylineno, currentModule);
ct->type = ACT_EL_EXT;
CONSTRAINT_INSERT($$, ACT_CA_CSV, $1, ct);
ct = $$;
CONSTRAINT_INSERT($$, ACT_CA_CSV, ct, $5);
}
;
| ElementSetSpec
| ElementSetSpec ',' TOK_ThreeDots {
asn1p_constraint_t *ct;
ct = asn1p_constraint_new(yylineno, currentModule);
ct->type = ACT_EL_EXT;
CONSTRAINT_INSERT($$, ACT_CA_CSV, $1, ct);
}
| ElementSetSpec ',' TOK_ThreeDots ',' ElementSetSpec {
asn1p_constraint_t *ct;
ct = asn1p_constraint_new(yylineno, currentModule);
ct->type = ACT_EL_EXT;
CONSTRAINT_INSERT($$, ACT_CA_CSV, $1, ct);
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,30 +1856,26 @@ 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 ')' {
int ret;
$$ = asn1p_constraint_new(yylineno, currentModule);
checkmem($$);
$$->type = ACT_CA_SET;
ret = asn1p_constraint_insert($$, $2);
checkmem(ret == 0);
}
| SingleValue {
Elements:
SubtypeElements
| '(' ElementSetSpec ')' {
int ret;
$$ = asn1p_constraint_new(yylineno, currentModule);
checkmem($$);
$$->type = ACT_CA_SET;
ret = asn1p_constraint_insert($$, $2);
checkmem(ret == 0);
}
;
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:
InnerTypeConstraints:
TOK_WITH TOK_COMPONENT SingleTypeConstraint {
CONSTRAINT_INSERT($$, ACT_CT_WCOMP, $3, 0);
}
......@@ -2012,7 +2047,7 @@ TypeConstraints:
}
;
NamedConstraint:
IdentifierAsValue optConstraints optPresenceConstraint {
IdentifierAsValue optConstraint optPresenceConstraint {
$$ = asn1p_constraint_new(yylineno, currentModule);
checkmem($$);
$$->type = ACT_EL_VALUE;
......
......@@ -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;
......
......@@ -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 = 0x02
A1P_EXTENDED_VALUES = 0x04
};
/*
......
......@@ -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;
}
......
......@@ -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
......@@ -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 */
};
......@@ -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))
......
......@@ -405,7 +405,7 @@ ExtensibleExtensions_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
return -1;
}
if((value >= 1 && value <= 256)) {
if((value >= 1 && value <= 255)) {
/* Constraint check succeeded */
return 0;
} else {
......
......@@ -427,7 +427,7 @@ ExtensibleExtensions_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
value = *(const long *)sptr;
if((value >= 1 && value <= 256)) {
if((value >= 1 && value <= 255)) {
/* 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, 256 } /* (1..256,...) */,
{ APC_CONSTRAINED | APC_EXTENSIBLE, 8, 8, 1, 255 } /* (1..255,...) */,
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
0, 0 /* No PER value map */
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment