Commit Graph

180 Commits

Author SHA1 Message Date
Lev Walkin 4bc278d043 libs fix 2017-11-20 23:10:30 -08:00
Lev Walkin 3eb2703268 format integer value as INTEGER_t 2017-11-20 19:41:23 -08:00
Lev Walkin 1a49ced90e use hash for name lookup 2017-11-06 00:07:53 -08:00
Bi-Ruei, Chiu 5bdb55552f Fix duplicate 'asn_VAL_23_ignore' generated from RANAP ASN.1
Information object set RANAP-ELEMENTARY-PROCEDURES is a union of
RANAP-ELEMENTARY-PROCEDURES-CLASS-1 and RANAP-ELEMENTARY-PROCEDURES-CLASS-2.

Each time _asn1f_assign_cell_value() parses an object, value of an
incremented counter is assigned to '_type_unique_index' field for
distinquishing different items.

However, these two information object sets have their own counters.
It has chance that generated variables have the same name and also the same
'_type_unique_index'. And they collide if they join up into one set.

S1AP's ASN.1 is lucky without this problem, while RANAP has.

By adding the number of items of the first set to '_type_unique_index' field
of items of the second set can solve this issue.
2017-10-24 03:31:59 -07:00
Bi-Ruei, Chiu dcc822a090 Fix duplicate type names generated in headers file
For example, there are many 'enum value_PR' and 'struct value' generated if
a class is instantiated as many instances.

typedef enum value_PR {
    value_PR_NOTHING,    /* No components present */
    .....
} value_PR;

typedef struct ProtocolIE_Field_6563P5 {
    ....
    struct value {
        value_PR present;
        union value_u {
        } 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_6563P5_t;
2017-10-20 17:15:57 -07:00
Bi-Ruei, Chiu 50934ba3d4 Fix 'Information Object Set XXX contains no objects' when parsing S1AP's ASN.1
The aforementioned error message displayed during processing the following ASN.1 excerpt.

S1AP-ELEMENTARY-PROCEDURES S1AP-ELEMENTARY-PROCEDURE ::= {
    S1AP-ELEMENTARY-PROCEDURES-CLASS-1 |
    S1AP-ELEMENTARY-PROCEDURES-CLASS-2,
    ...
}

S1AP-ELEMENTARY-PROCEDURES-CLASS-1 S1AP-ELEMENTARY-PROCEDURE ::= {
    handoverPreparation                |
...
    writeReplaceWarning,
    ...,
    uERadioCapabilityMatch             |
....
    uEContextResume
}

S1AP-ELEMENTARY-PROCEDURES-CLASS-2 S1AP-ELEMENTARY-PROCEDURE ::= {
    handoverNotification               |
...
    privateMessage,
    ...,
    downlinkUEAssociatedLPPaTransport  |
...
    mMECPRelocationIndication
}

Because S1AP-ELEMENTARY-PROCEDURES-CLASS-1 and S1AP-ELEMENTARY-PROCEDURES-CLASS-2
are resolved 'after' S1AP-ELEMENTARY-PROCEDURES, so the ioc tables of them are not
available during resolving S1AP-ELEMENTARY-PROCEDURES. So we can not drop the
latter's containedSubtype field at first pass of asn1f_resolve_constraints of fix
process.

We also add second pass of asn1f_resolve_constraints to have a chance to combine
ioc tables of S1AP-ELEMENTARY-PROCEDURES-CLASS-1 and
S1AP-ELEMENTARY-PROCEDURES-CLASS-2.
2017-10-20 17:15:57 -07:00
Lev Walkin 48e82d1f1f removed gcc-7 warnings 2017-10-19 03:07:27 -07:00
Lev Walkin a25584bab7 fixed INTEGER/ENUMERATED mismatch 2017-10-02 00:41:59 -07:00
Lev Walkin ed409e2b75 remove memleaks 2017-09-26 18:07:40 -07:00
Lev Walkin 59165cf2ae reorganized parsing around constraints 2017-09-11 06:24:45 -07:00
Lev Walkin bf979156ac parse a variant of value constraint 2017-09-07 23:36:11 -07:00
Lev Walkin 0c68645c5c updated parsing bnf 2017-09-07 22:59:36 -07:00
Lev Walkin be518fac4c ENUMERATION can not be empty 2017-09-07 02:05:28 -07:00
Lev Walkin d523ea454d parse advanced WITH COMPONENTS 2017-09-06 22:15:08 -07:00
Lev Walkin 5efafc56b4 early suggestion of -fcompound-names 2017-09-05 03:43:00 -07:00
Lev Walkin bc407267bb explicit extensibility of object sets 2017-08-23 10:03:22 -07:00
Lev Walkin a45518f565 const fix 2017-08-23 07:22:52 -07:00
Lev Walkin c336c4ac8a compile fix 2017-08-22 09:23:06 +00:00
Lev Walkin c0e03b946e introduce namespaces 2017-08-22 01:48:23 -07:00
Lev Walkin d9221847e5 add common lib 2017-08-22 01:44:56 -07:00
Lev Walkin f6853ce38e further runtime support for information object classes 2017-08-11 01:37:26 -07:00
Lev Walkin 4dcf8367d9 refactor constraint matrix handling 2017-08-07 20:10:05 -07:00
Lev Walkin 62d95d2ef4 rm warnings 2017-08-06 23:41:11 -07:00
Lev Walkin ea6635bdae better parsing information object class sets 2017-08-06 23:23:04 -07:00
Lev Walkin e700b208bc comment 2017-08-06 23:21:32 -07:00
Lev Walkin ecbb8ff34a add const 2017-08-06 15:01:00 -07:00
Lev Walkin 2888f6c886 fix warnings 2017-08-05 23:49:03 -07:00
Lev Walkin 7268f33f6a fix warning 2017-08-05 18:20:52 -07:00
Lev Walkin 752e9735d8 ignore UTF-8 byte order mark 2017-08-04 02:06:22 -07:00
Lev Walkin da997b1ea1 work in 128-bit integer values while compiling 2017-08-04 01:38:41 -07:00
Lev Walkin fc4f37a5a2 add const 2017-08-02 13:32:23 -07:00
Bi-Ruei, Chiu 80fd3065f4 Merge PR99 and its fixes to support parsing Information Object and Information Object Set
This is a collection of works :

1. Based on @zhanglei002's pull request 99.

2. A fix by @AuthenticEshkinKot and merged by @mouse07410 at
   commit 2c8d366bbe1fc4e4c041e9b0eb9779f8a42d754b of https://github.com/mouse07410/asn1c
   to support parsing of Information Object and Information Object Set

3. A fix by @Uri Blumenthal in asn1fix_derefv.c at :
   commit ec0ade4f87c807e763e3f35fc5466adb6dda3473 of https://github.com/mouse07410/asn1c
   to solve crash on asn1p_value_free().

4. My pull request 18 to @mouse07410's https://github.com/mouse07410/asn1c to solve
   problems found during parsing ASN.1 modules of S1AP, RANAP and J2735-201603.

5. My pull request 22 to @mouse07410's https://github.com/mouse07410/asn1c to solve issue 147
   and to solve the problem during parsing ASN.1 module of NBAP.

6. My pull request 23 to @mouse07410's https://github.com/mouse07410/asn1c to fix memory leakage
   introduced in aforementioned commits.
   Most code changes are the same as pull request 153 to this repository.

7. A fix of my bug in item 6 which result asn1c crash, fixed by @mouse07410.
2017-05-07 22:20:30 +08:00
Bi-Ruei, Chiu 3dcf05bbb0 Fix some memory leakage found 2017-05-05 15:03:32 +08:00
Lev Walkin fbbe4edc8e Merge pull request #126 from brchiu/fix_some_leak_reported_by_valgrind
Fix many memory leaks reported by valgrind
2017-03-26 05:55:00 -07:00
Lev Walkin a964e03306 removed more unnecessary checks 2017-03-26 03:48:48 -07:00
Bi-Ruei, Chiu b9adfc5f91 Free memory allocated in various functions
1. Add 'ref_cnt' field to asn1p_expr_t.
2. Initialize 'ref_cnt' field to zero when asn1p_expr_t is allocated.
3. Increase 'ref_cnt' field when asn1p_expr_t is cloned by asn1p_value_fromtype().
4. If 'ref_cnt' field of asn1p_expr_t is larger than zero, then asn1p_expr_free() only decrease its value.
5. Free memory pointed by fields of asn1p_expr_t and itself when 'ref_cnt' is zero and asn1p_expr_free() called.
6. Call asn1p_delete(asn) in main().
2016-11-09 00:17:25 +08:00
Bi-Ruei, Chiu 0bfcefc368 Free memory pointed by oid->arcs 2016-11-08 22:37:39 +08:00
Bi-Ruei, Chiu 12021b53b8 Free memory pointed by tag2el, tag2el_cxer and source_file_name 2016-11-04 11:59:45 +08:00
Markus Elfring f3d1861b94 Bug #86: Deletion of unnecessary checks before calls of the function "free"
The function "free" is documented in the way that no action shall occur for
a passed null pointer. It is therefore not needed that a function caller
repeats a corresponding check.
http://stackoverflow.com/questions/18775608/free-a-null-pointer-anyway-or-check-first

This issue was fixed by using the software "Coccinelle 1.0.4".

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
2016-03-15 08:35:24 +01:00
Markus Elfring 671eb9ad14 Bug #86: Deletion of unnecessary checks before a few calls of asn1c functions
The following functions return immediately if a null pointer was passed.
* asn1p_constraint_free
* asn1p_paramlist_free
* asn1p_ref_free
* asn1p_value_free
* asn1p_wsyntx_free

It is therefore not needed that a function caller repeats a corresponding check.

This issue was fixed by using the software "Coccinelle 1.0.4".

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
2016-03-14 17:07:26 +01:00
Lev Walkin 13e57efbd5 removed superfluous check before free 2016-03-14 02:05:23 -07:00
Lev Walkin d8b8364c8a removed unneeded check before free() 2016-03-14 02:00:27 -07:00
Lev Walkin 483c14fcec gcc warning fix? 2016-01-10 20:41:57 -08:00
Lev Walkin 04abdb2463 get rid of compiler warning of too smart compiler 2016-01-10 20:03:04 -08:00
Lev Walkin da94cd4287 useless -all-static 2014-10-13 02:43:57 +00:00
Lev Walkin 1b03c79368 removed autotools intermediate files from source code; use autoreconf -iv. 2014-10-12 17:31:26 -07:00
Lev Walkin e0d321a650 version 0.9.26 2014-09-11 01:28:57 -07:00
Lev Walkin ea55215e3c split ADD_CFLAGS and TESTSUITE_CFLAGS 2014-01-14 02:15:13 -08:00
Lev Walkin f84cc014d4 check cc flags viability before setting them 2014-01-14 02:12:24 -08:00
Lev Walkin aef10c36f7 upgrade autotools 2014-01-14 01:47:25 -08:00