[erlang-questions] ASN.1 decode errors

Dániel Szoboszlay dszoboszlay@REDACTED
Thu Sep 12 20:41:08 CEST 2019


Hi,

I'm not very familiar with ASN.1, but I believe the error comes from a
different place than the CallEventRecord. {invalid_choice_tag, {1, _}}
suggests that you're trying to decode a CHOICE and found tag 1 in the data,
but there's no tag 1 in the definition. CallEventRecord has tag 1
(GGSNPDPRecord), so the error cannot come from this place (and if there
were an error decoding the GGSNPDPRecord, the error message won't complain
about the invalid choice tag).

Could you please include the top of the call stack? i think the name of the
function where this error is coming from may hint to what kind of data
fails to decode. Or, you can search the ASN.1 files for a CHOICE that has
no tag 1.

Cheers,
Daniel

On Thu, 12 Sep 2019 at 16:37, Anthony Howe <achowe@REDACTED> wrote:

> I've written a couple ASN.1 BER and PER transcoders to JSON for LTE,
> TAP3, NRTRDE files before.  ( It was Erlang's open source ASN.1 support
> that got me to learn the language in the first place. )  I'm trying to
> write one now for GPRS charging records (ETSI TS 101 393 V7.4.0
> (2000-02)); I have something that builds, but does not decode the input
> and just reports a vague Erlang ASN error.
>
> I figure the problem revolves around a mismatched set of ASN module
> files (which are a frik'n pain to find, but I digress).  Anyway, I
> figure if I understood the error better it might point me finally in the
> right direction.
>
> So the error is...
>
> $ ./_build/default/bin/gprsdump -r cdr_0f1
> cdr_0f1: processing...
> runtime error: cdr_0f1: {badmatch,
>                          {error,
>                           {asn1,
>                            {invalid_choice_tag,
>                             {1,
>                              <<0,168,161,129,165,128,1,19,131,8,48,36,128,
>                                1,113,0,0,63,164>>}}}}}
>
> Reset of stack omitted.
>
> My interpretation is that initial CallEventRecord choice 1
> (GGSNPDPRecord) is not decoding, but I have no idea what the binary is
> suppose to be telling me, other than "You Are Here in the BER input".
>
> CallEventRecord ::= CHOICE
> {
>         sgsnPDPRecord                   [0] SGSNPDPRecord,
>         ggsnPDPRecord                   [1] GGSNPDPRecord,
>         sgsnMMRecord                    [2] SGSNMMRecord,
>         sgsnSMORecord                   [3] SGSNSMORecord,
>         sgsnSMTRecord                   [4] SGSNSMTRecord
> }
>
> Any clues to would be welcome.
>
> Right now its looking like I'll have to learn how to decode BER by hand
> in order to understand the failure better.  Maybe a generic BER to ASN
> syntax decoder tool?
>
>
> --
> Anthony C Howe                                              SnertSoft
> achowe@REDACTED       Twitter: SirWumpus       BarricadeMX & Milters
> http://snert.com/      http://nanozen.info/     http://snertsoft.com/
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20190912/1426e4ca/attachment.htm>


More information about the erlang-questions mailing list