asn1c icon indicating copy to clipboard operation
asn1c copied to clipboard

Unable to decode BCCH-DLSCH message using uper_decode_complete API

Open RevathiGran opened this issue 5 years ago • 6 comments

Hi, I am using vlm/asn1c v0.9.29. RRC version 38.331 15.5.0 I compiled asn using this flags: asn1c -gen-PER -fcompound-names -findirect-choice -fno-include-deps

The PDU is decoded in https://asn1.io/asn1playground/ but unable to decode with this API. Kindly help me out with this.

The PDU is: 74 c5 80 3e 00 61 00 10 08 01 89 90 00 00 00 06 82 e8 05 84 26 81 80 06 41 88 30 22 59 bf e8 02 7f 80 00 00 00 03 07 70 44 20 00 24 90 83 70 84 20 00 00 90 80 00 42 06 84 04 22 90 ea 00 00 40 00 06 20 f3 81 12 cd e8 8a 00 c4 09 db f3 30 39 8f f8 92 5e 10 46 d6 65 c6 00 72 f8 80 41 50 20 00 40 08 a2 49 3c 00 00 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 27 f9 00 00

RevathiGran avatar Dec 09 '20 15:12 RevathiGran

https://github.com/bhati-github/5GCore_NMP.git Network Message Protocol This can be used across all possible signaling interfaces and very easy to parse.

bhati-github avatar Dec 21 '20 09:12 bhati-github

Hello @RevathiGran Did you manage to solve this issue ? We are facing the same problem here Regards.

adejavel avatar Jan 28 '21 09:01 adejavel

Here are some details about the related issue we are facing:

  • We want to decode 5G NR SIB1 data.
  • We have a buffer dl_sch_bytes which is declared like this:
uint8_t *dl_sch_bytes = new uint8_t[84]{0x74, 0x81, 0x01, 0x70, 0x10, 0x64, 0x04, 0xE0, 0x00, 0x00, 0xC8, 0x00, 0x24, 0x68, 0xA0, 0x38, 0x05, 0x21, 0x09, 0xA0, 0x30, 0x00, 0x00, 0x46, 0x4C, 0x6B, 0x6C, 0x65, 0xF0, 0x0F, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x08, 0xDC, 0x10, 0x08, 0x00, 0x00, 0x20, 0x20, 0x00, 0x10, 0x41, 0xA0, 0x28, 0x24, 0x21, 0x00, 0x00, 0x11, 0x95, 0x0E, 0x35, 0xB6, 0x32, 0x25, 0x00, 0x00, 0xF5, 0xC4, 0xAB, 0x1F, 0x01, 0x24, 0xA1, 0x10, 0x6D, 0xC2, 0xB6, 0x38, 0x70, 0x12, 0x0B, 0x01, 0xC8, 0x04, 0x08, 0x16, 0xD1, 0x85, 0x00};
  • We want to decode this buffer into sib1_2 variable which is declared with:
BCCH_DL_SCH_Message_t *sib1_2=0;
  • We use either
asn_dec_rval_t dec_rval = asn_decode(0, ATS_UNALIGNED_BASIC_PER, &asn_DEF_BCCH_DL_SCH_Message,(void **) &sib1_2, dl_sch_bytes, 84);

Or

asn_dec_rval_t dec_rval = uper_decode_complete(0, &asn_DEF_BCCH_DL_SCH_Message,(void **) &sib1_2, dl_sch_bytes, 84);

To decode the buffer into sib1_2 variable.

  • The result code is RC_FAIL with dec_rval.consumed equals to 0.
  • Anyway, asn_fprint(stdout, &asn_DEF_BCCH_DL_SCH_Message, sib1_2); still outputs something, but the printed result does not correspond to other decoding methods
  • The ASN model and above buffer have been tested with https://www.marben-products.com/decoder-asn1-nr/ and https://asn1.io/asn1playground/ and this is working, so the problem might come either from our use of asn1c or from asn1c itself.
  • The asn file used is: NR-RRC-Definitions.txt (it is uploaded in txt format as github does not support asn files).
  • Further testing: We tried to decode SIB1 object using rrc-dump in asn1c/examples/sample.source.RRC. We first replace the provided asn file with our one. Then, we add two lines in our code:
ofstream myFile ("data.bin", ios::out | ios::binary);
myFile.write((char*)dl_sch_bytes, 84);

and execute the project. We get the output data.bin file and run

./rrc-dump -p BCCH-DL-SCH-Message data.bin

and this raises an error: data.bin: Decode failed past byte 0: Input processing error To test our binary file, we upload it on https://www.marben-products.com/decoder-asn1-nr/ and it is decoding well, so binary file seems to be correct. @vlm If you could just have a look to tell us wether or not it is a problem from our side or an issue of ASN1C, it would be great. And thanks for the great project!

adejavel avatar Jan 29 '21 09:01 adejavel

Hello @RevathiGran, Just to inform you that we solved this issue. We used a forked and a specific branch by OpenAirInterface: https://gitlab.eurecom.fr/oai/asn1c/-/tree/velichkov_s1ap_plus_option_group We had to modify the content of ASN files following the procedure detailed here: https://gitlab.eurecom.fr/oai/openairinterface5g/-/blob/NR_RRC_PUSCH/cmake_targets/tools/generate_asn1 Then, the decoding was working well Regards.

adejavel avatar Feb 01 '21 16:02 adejavel

hello @adejavel , The decoding works fine with this solution. Thank you.

revathigrandhi avatar Jun 07 '21 08:06 revathigrandhi

It would be great if you could test https://GitHub.com/mouse07410/asn1c default branch (vlm_master).

It should have the fixes from the repo you referred.

mouse07410 avatar Jun 07 '21 11:06 mouse07410