Commit 6b76c7c7 authored by Bi-Ruei, Chiu's avatar Bi-Ruei, Chiu

Fix problem results from empty ios cells generated

For RANAP specification :

  RANAP-ELEMENTARY-PROCEDURE ::= CLASS {
    &InitiatingMessage,
    &SuccessfulOutcome          OPTIONAL,
    &UnsuccessfulOutcome        OPTIONAL,
    &Outcome                    OPTIONAL,
    &procedureCode              ProcedureCode  UNIQUE,
    &criticality                Criticality    DEFAULT ignore
  } WITH SYNTAX {
    INITIATING MESSAGE          &InitiatingMessage
    [SUCCESSFUL OUTCOME         &SuccessfulOutcome]
    [UNSUCCESSFUL OUTCOME       &UnsuccessfulOutcome]
    [OUTCOME                    &Outcome]
    PROCEDURE CODE              &procedureCode
    [CRITICALITY                &criticality]
  }

Not all instances of elementary procedure have all their
optional members defined.

For examples :

  iu-Release RANAP-ELEMENTARY-PROCEDURE ::= {
    INITIATING MESSAGE  Iu-ReleaseCommand
    SUCCESSFUL OUTCOME  Iu-ReleaseComplete
    PROCEDURE CODE      id-Iu-Release
    CRITICALITY         reject
  }

  rAB-Assignment RANAP-ELEMENTARY-PROCEDURE ::= {
    INITIATING MESSAGE	RAB-AssignmentRequest
    OUTCOME             RAB-AssignmentResponse
    PROCEDURE CODE      id-RAB-Assignment
    CRITICALITY         reject
  }

So there are empty cells generated in Outcome.c ... etc.

  static const asn_ioc_cell_t asn_IOS_RANAP_ELEMENTARY_PROCEDURES_1_rows[] = {
    { "&InitiatingMessage", aioc__type, &asn_DEF_Iu_ReleaseCommand },
    { "&SuccessfulOutcome", aioc__type, &asn_DEF_Iu_ReleaseComplete },
    { "&UnsuccessfulOutcome",  },
    { "&Outcome",  },
    { "&procedureCode", aioc__value, &asn_DEF_ProcedureCode, &asn_VAL_1_id_Iu_Release },
    { "&criticality", aioc__value, &asn_DEF_Criticality, &asn_VAL_1_reject },

    { "&InitiatingMessage", aioc__type, &asn_DEF_RAB_AssignmentRequest },
    { "&SuccessfulOutcome",  },
    { "&UnsuccessfulOutcome",  },
    { "&Outcome", aioc__type, &asn_DEF_RAB_AssignmentResponse },
    { "&procedureCode", aioc__value, &asn_DEF_ProcedureCode, &asn_VAL_49_id_RAB_Assignment },
    { "&criticality", aioc__value, &asn_DEF_Criticality, &asn_VAL_49_reject }
  }

However, in type_selector() functions, these undefined cell are still
be counted into presence_index value. This results in wrong behavior for
decoder.

This commit is to fix this problem.
parent 8d0f6857
......@@ -2705,7 +2705,7 @@ emit_member_type_selector(arg_t *arg, asn1p_expr_t *expr, asn1c_ioc_table_and_ob
opt_ioc->objset->_type_unique_index);
OUT("size_t constraining_column = %zu; /* %s */\n", constraining_column, cfield);
OUT("size_t for_column = %zu; /* %s */\n", for_column, for_field);
OUT("size_t row;\n");
OUT("size_t row, presence_index = 0;\n");
const char *tname = asn1c_type_name(arg, constraining_memb, TNF_SAFE);
if(constraining_memb->marker.flags & EM_INDIRECT) {
......@@ -2740,9 +2740,13 @@ emit_member_type_selector(arg_t *arg, asn1p_expr_t *expr, asn1c_ioc_table_and_ob
OUT(" const asn_ioc_cell_t *constraining_cell = &itable->rows[row * itable->columns_count + constraining_column];\n");
OUT(" const asn_ioc_cell_t *type_cell = &itable->rows[row * itable->columns_count + for_column];\n");
OUT("\n");
OUT(" if(type_cell->cell_kind == aioc__undefined)\n");
OUT(" continue;\n");
OUT("\n");
OUT(" presence_index++;\n");
OUT(" if(constraining_cell->type_descriptor->op->compare_struct(constraining_cell->type_descriptor, constraining_value, constraining_cell->value_sptr) == 0) {\n");
OUT(" result.type_descriptor = type_cell->type_descriptor;\n");
OUT(" result.presence_index = row + 1;\n");
OUT(" result.presence_index = presence_index;\n");
OUT(" break;\n");
OUT(" }\n");
OUT("}\n");
......
......@@ -28,6 +28,7 @@ typedef struct asn_ioc_set_s {
typedef struct asn_ioc_cell_s {
const char *field_name; /* Is equal to corresponding column_name */
enum {
aioc__undefined = 0,
aioc__value,
aioc__type,
aioc__open_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