Commit 4e7edb05 authored by Bi-Ruei, Chiu's avatar Bi-Ruei, Chiu

Fix code generated from ASN.1 of F1AP v15.4.0 failed to be compiled

ProtocolExtensionField.c generated from the following excerpt from ASN.1 of F1AP v15.4.0 :

RRC-Version ::= SEQUENCE {
    latest-RRC-Version BIT STRING (SIZE(3)),
    iE-Extensions      ProtocolExtensionContainer { { RRC-Version-ExtIEs } } OPTIONAL}

RRC-Version-ExtIEs F1AP-PROTOCOL-EXTENSION ::= {
    {ID id-latest-RRC-Version-Enhanced CRITICALITY ignore EXTENSION OCTET STRING (SIZE(3)) PRESENCE optional },
    ...
}

failed to be compiled because asn_PER_memb_OCTET_STRING_SIZE_3__constr_31 is not generated.

The reason is constraints of types used in information object sets are not processed in asn1fix() stage
so it's constraint, i.e. (SIZE(3)) in this case, is not generated.

With this fix, OCTET STRING (SIZE(3)) used in ASN.1 of F1AP v15.4.0 can be correctly processed
and generated code can be compiled.

However, this fix does not work for all sorts of types.

For example, if information object refer to a type like this : SEQUENCE (SIZE(3)) OF INTEGER
it will be failed to compiled because asn_IOS_RRC_Version_ExtIEs_1_rows[] refers to non-existing
asn_DEF_SEQUENCE_OF.
parent 0a752418
......@@ -283,6 +283,26 @@ asn1f_fix_module__phase_2(arg_t *arg) {
ret = asn1f_recurse_expr(arg, asn1f_check_constraints);
RET2RVAL(ret, rvalue);
if (expr->ioc_table) {
for (size_t rn = 0; rn < expr->ioc_table->rows; rn++) {
for (size_t cn = 0; cn < expr->ioc_table->row[rn]->columns; cn++) {
if (!expr->ioc_table->row[rn]->column[cn].value) {
continue;
}
arg->expr = expr->ioc_table->row[rn]->column[cn].value;
ret = asn1f_recurse_expr(arg, asn1f_fix_dereference_defaults);
RET2RVAL(ret, rvalue);
ret = asn1f_recurse_expr(arg, asn1f_resolve_constraints);
RET2RVAL(ret, rvalue);
ret = asn1f_recurse_expr(arg, asn1f_check_constraints);
RET2RVAL(ret, rvalue);
}
}
arg->expr = expr;
}
/*
* Uniquely tag each inner type.
*/
......
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