asn1c icon indicating copy to clipboard operation
asn1c copied to clipboard

failed to codec INTEGER with extension vales

Open zxr1001 opened this issue 7 months ago • 1 comments

hello when i encode/decode 38.413 and 38.455 asn which like UE-Measurement-ID ::= INTEGER (1..15, ..., 16..256) in 38.455 or MaximumDataBurstVolume ::= INTEGER (0..4095, ..., 4096.. 2000000) in 38.413 it seems can not work correctly.

the asn1c generate files is: asn_per_constraints_t asn_PER_type_NRPPA_UE_Measurement_ID_constr_1 CC_NOTUSED = { { APC_CONSTRAINED | APC_EXTENSIBLE, 8, 8, 1, 256 } /* (1..256,...) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ };

#if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) asn_per_constraints_t asn_PER_type_NGAP_MaximumDataBurstVolume_constr_1 CC_NOTUSED = { { APC_CONSTRAINED | APC_EXTENSIBLE, 21, -1, 0, 2000000 } /* (0..2000000,...) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; #endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */

It seems that the generated file simplifies the definition of ASN.

Image

Image

nprra pdu streams: 20 02 00 00 15 80 f9 00 00 06 00 02 00 01 00 00 06 00 03 80 01 14 00 07 40 80 a8 30 64 f0 80 40 05 04 03 02 00 01 02 03 14 80 00 07 60 80 00 0a 00 64 00 64 f0 80 00 10 20 35 a8 08 00 64 20 03 e8 00 64 f0 80 00 10 20 43 d4 00 20 40 14 07 00 00 c8 80 32 09 3d 00 64 f0 80 05 04 03 02 0f e0 01 7f a0 00 23 40 15 07 00 01 2c 80 05 00 ec 00 64 f0 80 05 04 03 02 01 80 17 c6 00 a0 00 24 40 0c 60 0e 0f 07 07 00 0e 0f 0e 0f 0e 0f 00 00 00 25 40 30 40 98 80 00 01 ff c0 80 00 01 ff 40 fb ff ff ff b3 c8 64 c8 04 09 00 03 fe 03 fe 04 02 00 ff c8 00 c8 00 08 24 03 fe 03 fe 04 02 00 ff c8 00 c8 00 0e 40 03 00 00 c8 00 11 40 0c 04 00 00 01 7e fd 0c 00 01 bf 80 31 00 15 40 22 01 fc 8d 68 01 02 03 04 48 a7 ff ac aa aa 00 00 00 00 01 02 03 06 48 a7 01 02 03 05 48 a7 ff 60 01 40

Environment (please complete the following information):

  • Platform: [x86_64]
  • OS: [ubuntu]
  • Version of asn1c : commit a99409e29af43f50ecd225788e3bdf5e6a54bba3 (HEAD -> vlm_master, origin/vlm_master, origin/HEAD)

Please help to fix this problems? thanks a lot!

zxr1001 avatar May 22 '25 03:05 zxr1001

In order for the maintainers to look into this, could you please provide instructions on how to reproduce your issue? As an example could you please look into the "Here how to reproduce:" section of the issue #204?

mr-j0nes avatar Jun 01 '25 13:06 mr-j0nes

In order for the maintainers to look into this, could you please provide instructions on how to reproduce your issue? As an example could you please look into the "Here how to reproduce:" section of the issue #204?

git clone https://github.com/mouse07410/asn1c.git cd asn1c test -f configure || autoreconf -iv ./configure make -j 16

mkdir nrppa_asn #Referring to the OAI project ../asn1c -no-gen-BER -no-gen-XER -no-gen-JER -no-gen-OER -fcompound-names -findirect-choice -fno-include-deps -fprefix=NRPPA_ 38.455-i40.asn make -f converter-example.mk

gcc -o zzz test_nrppa_code.c -I. -L. -lnrppaasncodec

zxr1001 avatar Jun 08 '25 07:06 zxr1001

I got one have no idea what OAI project is and where is files are (though I'm pretty sure that mkdir nrppa_asn is not the way to get them). Would much prefer a simpler and smaller reproducer.

Update Also, would appreciate if somebody could clue me in to what's the point of defining

Whatever-ID ::= INTEGER (1..15, ..., 16..256)

instead of

Whatever-ID ::= INTEGER (1..256)

and how should the semantics and behavior of one differ from that of the other?

The prior seems ~~sheer idiocy~~ wrong to me.

mouse07410 avatar Jun 08 '25 21:06 mouse07410

Image

the value 1 and 16 have different code stream.

OAI Project link: https://gitlab.eurecom.fr/oai/openairinterface5g/blob/master/doc/BUILD.md#installing-new-asn1c-from-source

I learned how to use asn1c based on this project https://gitlab.eurecom.fr/oai/openairinterface5g/-/tree/develop/openair3/NRPPA?ref_type=heads

zxr1001 avatar Aug 01 '25 08:08 zxr1001

I'm sorry, but I don't see what I could fix here.

mouse07410 avatar Aug 01 '25 15:08 mouse07410