use asn1ct/asn1rc in 'ber list' mode, as 'ber binary' mode has bugs

When trying to asn1rt:encode() the DialoguePortion in ber_bin mode,
we get something like

2> asn1rt:encode('MAP', 'MapSpecificPDUs', {'begin', Msg}).
{error,{asn1,{function_clause,[{asn1rt_check,transform_to_EXTERNAL1990,
                                             [[<<96,15,128,2,7,128,161,9,6,7,4,0,0,1,0,5,3>>],
                                              [asn1_NOVALUE,asn1_NOVALUE,{0,0,17,773,1,1,1},'EXTERNAL']]},
                               {'MAP',enc_EXTERNAL,2},
                               {'MAP',enc_MapSpecificPDUs_begin,2},
                               {'MAP',enc_MapSpecificPDUs,2},
                               {'MAP',encode,2},
                               {asn1rt,encode,3},
                               {erl_eval,do_apply,5},
                               {shell,exprs,7}]}}}
This commit is contained in:
Harald Welte 2011-02-09 23:13:48 +01:00
parent fc281c362b
commit d08ea8d673
2 changed files with 11 additions and 3 deletions

View File

@ -1,2 +1,2 @@
{sub_dirs, ["rel"]}.
{asn1_opts, [ber_bin]}.
{asn1_opts, [ber,verbose]}.

View File

@ -72,7 +72,10 @@ encode_addr_string(#party_number{nature_of_addr_ind = NatureIsup,
binary_to_list(Bin).
parse_tcap_msg(MsgBin) when is_binary(MsgBin) ->
case asn1rt:decode('map', 'MapSpecificPDUs', MsgBin) of
Msg = binary_to_list(MsgBin),
parse_tcap_msg(Msg);
parse_tcap_msg(Msg) when is_list(Msg) ->
case asn1rt:decode('map', 'MapSpecificPDUs', Msg) of
{ok, {Type, TcapMsgDec}} ->
{Type, TcapMsgDec};
Error ->
@ -80,4 +83,9 @@ parse_tcap_msg(MsgBin) when is_binary(MsgBin) ->
end.
encode_tcap_msgt(Type, TcapMsgDec) ->
asn1rt:encode('map', Type, TcapMsgDec).
case asn1rt:encode('map', Type, TcapMsgDec) of
{ok, List} ->
list_to_binary(List);
Error ->
Error
end.