|
|
| Author |
Message |
|
| BruceFitzsimons |
Posted: Sat Sep 29, 2007 10:05 am |
|
|
|
User
Joined: 14 Sep 2007
Posts: 13
Location: New Zealand
|
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
_______________________________________________
erlang-questions mailing list
erlang-questions@erlang.org
http://www.erlang.org/mailman/listinfo/erlang-questions
Post recived from mailinglist |
|
|
| Back to top |
|
| anders_n |
Posted: Sun Sep 30, 2007 1:40 pm |
|
|
|
User
Joined: 28 Feb 2005
Posts: 155
Location: Saltillo, Mexico
|
On 9/29/07, Bruce Fitzsimons <Bruce@fitzsimons.org> wrote:
> 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.
>
Hi
It seems like the asn1 compiler option does most of what You want.
>From the docs
"undec_rest
A buffer that holds a message, beeing decoded may also have some
following bytes.
Now it is possible to get those following bytes returned together with
the decoded value.
If an asn1 spec is compiled with this option a tuple {ok,Value,Rest}
is returned.
Rest may be a list or a binary. Earlier versions of the compiler
ignored those following
bytes. "
/Anders
_______________________________________________
erlang-questions mailing list
erlang-questions@erlang.org
http://www.erlang.org/mailman/listinfo/erlang-questions
Post recived from mailinglist |
|
|
| Back to top |
|
| wuji |
Posted: Tue Sep 11, 2012 2:42 am |
|
|
|
User
Joined: 10 Aug 2012
Posts: 654
|
H.W. Bush, and mother, Barbara Bush, officially endorsed Mitt Romney five weeks weeks cheap Ralph Lauren weeks ago. His brother, former Florida Gov. Jeb Bush, also has backed
presumptive Republican nominee.So far, George W. Bush has not.And while the former former [h3]cheap replica *beep*[/h3] former president is expected to formally support Romney at some point between
and Election Day -- perhaps in a written statement -- many Republicans Republicans cheap jordan shoes Republicans doubt he will actively campaign for the party's ticket this fall.His
from the political stage stands in contrast to his predecessor, former President President [h4]cheap Ralph Lauren[/h4] President Bill Clinton, who has plunged into campaigns large and small since
office, even a race for a state Senate seat in Buffalo, N.Y.At N.Y.At [h4]cheap designer *beep*[/h4] N.Y.At a similar point in his post-presidency, Clinton tried to sway the |
|
|
| Back to top |
|
|
|
All times are GMT
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|
|