• Bi-Ruei, Chiu's avatar
    Use comprehensible names for instances of parameterized types · 59b9e705
    Bi-Ruei, Chiu authored
    With previous commit, the following data types are generated in ProtocolIE-Field.h
    for S1AP's ASN.1 :
    
    ```
    typedef enum ProtocolIE_Field_6564P0__value_PR {
        ProtocolIE_Field_6564P0__value_PR_NOTHING, /* No components present */
        ProtocolIE_Field_6564P0__value_PR_E_RABToBeSetupItemBearerSUReq
    } ProtocolIE_Field_6564P0__value_PR;
    
    typedef struct ProtocolIE_Field_6564P0 {
        ProtocolIE_ID_t      id;
        Criticality_t        criticality;
        struct ProtocolIE_Field_6564P0__value {
            ProtocolIE_Field_6564P0__value_PR        present;
            union ProtocolIE_Field_6564P0__value_u {
                E_RABToBeSetupItemBearerSUReq_t      E_RABToBeSetupItemBearerSUReq;
            } choice;
    
            /* Context for parsing across buffer boundaries */
            asn_struct_ctx_t _asn_ctx;
        } value;
    
        /* Context for parsing across buffer boundaries */
        asn_struct_ctx_t _asn_ctx;
    } ProtocolIE_Field_6564P0_t;
    
    ```
    
    It's difficult for developer to recognize to which ASN.1 type they are linked.
    They all start with 'ProtocolIE_Field_'. It will be error-prone.
    
    With this commit, more human comprehensible data types are generated :
    
    ```
    
    typedef enum E_RABToBeSetupItemBearerSUReqIEs__value_PR {
        E_RABToBeSetupItemBearerSUReqIEs__value_PR_NOTHING, /* No components present */
        E_RABToBeSetupItemBearerSUReqIEs__value_PR_E_RABToBeSetupItemBearerSUReq
    } E_RABToBeSetupItemBearerSUReqIEs__value_PR;
    
    typedef struct E_RABToBeSetupItemBearerSUReqIEs {
        ProtocolIE_ID_t      id;
        Criticality_t        criticality;
        struct E_RABToBeSetupItemBearerSUReqIEs__value {
            E_RABToBeSetupItemBearerSUReqIEs__value_PR present;
            union E_RABToBeSetupItemBearerSUReqIEs__value_u {
                E_RABToBeSetupItemBearerSUReq_t               E_RABToBeSetupItemBearerSUReq;
            } choice;
    
            /* Context for parsing across buffer boundaries */
            asn_struct_ctx_t _asn_ctx;
        } value;
    
        /* Context for parsing across buffer boundaries */
        asn_struct_ctx_t _asn_ctx;
    } E_RABToBeSetupItemBearerSUReqIEs_t;
    
    ```
    
    Developers can understand they are generated from :
    
    ```
    
    E-RABToBeSetupItemBearerSUReqIEs S1AP-PROTOCOL-IES ::= {
        { ID id-E-RABToBeSetupItemBearerSUReq CRITICALITY reject TYPE E-RABToBeSetupItemBearerSUReq PRESENCE mandatory },
        ...
    }
    
    ```
    59b9e705
asn1fix_param.c 6.34 KB