[erlang-questions] Decoding of ASN.1 BER files

Bruce Fitzsimons Bruce@REDACTED
Sat Sep 29 12:01:36 CEST 2007


Hullo list,

A hint and a request.

The hint: If you need to process files of ASN.1 structures concatenated 
together then the standard routines generated by the asn1ct module will 
almost work perfectly (proven for BER at least), you only need to alter 
the <toplevel>:decode/2 to return the remaining bytes and length from 
whatever reasonable size chunk of binary data you pass in (they default 
to suppressing it). Concatenate, rinse, repeat. A simple fix, but like 
most simple fixes they take more investigation than the ugly hack that 
went before them...

The request: It would be nice if the asn1ct generated <ASN1_erl>:decode 
functions returned this information by default, or via an alternative 
entry point. I can understand the encode routines accepting exactly the 
required amount of data, but for decodes having the correct information 
only occurs in some circumstances such as TCAP packet decoding (and even 
there it is of interest to know if there are leftovers).

If there is interest and /// motivation I can produce a patch to provide 
this behaviour, or otherwise if someone can tell me the rationale for 
not providing it and how else I should parse files I'd be interested.

For those still reading I am constructing a webpage for 3GPP CDR 
decoding (MSC, SGSN, IMS, LBS etc). Someone at work described how their 
hand-coded BER decoder crashed when extra fields were added (!) the 
other day and that offended me to the point of getting the 3GPP ASN.1 
source for CDRs compiling under Erlang (non-trivial dependencies). I'll 
post the url when the rest is working.

Regards,
Bruce



More information about the erlang-questions mailing list