asn1: swapped fields
Jozsef Berces (QCZ)
Jozsef.Berces@REDACTED
Mon Dec 30 14:36:41 CET 2002
Hi,
I have compiled RANAP with asn1ct and the decoder erlang code produces swapped fields for ProtocolIE-FieldPair: firstValue and secondCriticality are swapped in the resulting record. Here I am posting a simplified example.
If you try to compile the attached file RAB-SetupOrModifyList.asn with option per, then for the sequence
ProtocolIE-FieldPair {RANAP-PROTOCOL-IES-PAIR : IEsSetParam} ::= SEQUENCE {
id RANAP-PROTOCOL-IES-PAIR.&id ({IEsSetParam}),
firstCriticality RANAP-PROTOCOL-IES-PAIR.&firstCriticality ({IEsSetParam}{@id}),
firstValue RANAP-PROTOCOL-IES-PAIR.&FirstValue ({IEsSetParam}{@id}),
secondCriticality RANAP-PROTOCOL-IES-PAIR.&secondCriticality ({IEsSetParam}{@id}),
secondValue RANAP-PROTOCOL-IES-PAIR.&SecondValue ({IEsSetParam}{@id})
}
the erlang code will be
'dec_RAB-SetupOrModifyList_SEQOF_ProtocolIE-FieldPair'(Bytes,Telltype) ->
%% attribute number 1 with type id
{Term1,Bytes1} = ?RT_PER:decode_integer(Bytes,[{'ValueRange',{0,65535}}]),
%% attribute number 2 with type firstCriticality
{Term2,Bytes2} = ?RT_PER:decode_enumerated(Bytes1,[{'ValueRange',{0,2}}],{reject,ignore,notify}),
%% attribute number 3 with type FirstValue
{Tmpterm1, Bytes3} = ?RT_PER:decode_open_type(Bytes2, []),
%% attribute number 4 with type secondCriticality
{Term3,Bytes4} = ?RT_PER:decode_enumerated(Bytes3,[{'ValueRange',{0,2}}],{reject,ignore,notify}),
%% attribute number 5 with type SecondValue
{Tmpterm2, Bytes5} = ?RT_PER:decode_open_type(Bytes4, []),
DecObjidTerm1 =
'getdec_RAB-SetupOrModifyItem-IEs'(id, Term1),
{Term4, _} =
case DecObjidTerm1('FirstValue', Tmpterm1, telltype,[]) of
{'EXIT', Reason1} ->
exit({'Type not compatible with table constraint',Reason1});
Tmpterm3 ->
Tmpterm3
end,
{Term5, _} =
case DecObjidTerm1('SecondValue', Tmpterm2, telltype,[]) of
{'EXIT', Reason2} ->
exit({'Type not compatible with table constraint',Reason2});
Tmpterm4 ->
Tmpterm4
end,
{{'ProtocolIE-FieldPair',Term1,Term2,Term3,Term4,Term5},Bytes5}.
It can be seen that attribute number 3 is assigned to Term4 and attribute number 4 goes to Term3. It seems that the problem is to have the 'getdec_RAB-SetupOrModifyItem-IEs'(id, Term1) call too late, so Term4 will receive attribute number 3.
I attached the results for different options: per, per_bin, and ber. per and per_bin are the same but ber is even worse (however, RANAP uses PER encoding)!
Could someone post a fix? Until then we have to modify the erang code manually.
Thanks in advance,
Jozsef
-------------- next part --------------
A non-text attachment was scrubbed...
Name: RAB-SetupOrModifyList.asn
Type: application/octet-stream
Size: 2396 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20021230/11b6a8da/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: RAB-SetupOrModifyList.ber.erl
Type: application/octet-stream
Size: 15019 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20021230/11b6a8da/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: RAB-SetupOrModifyList.per.erl
Type: application/octet-stream
Size: 10378 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20021230/11b6a8da/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: RAB-SetupOrModifyList.per_bin.erl
Type: application/octet-stream
Size: 10409 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20021230/11b6a8da/attachment-0003.obj>
More information about the erlang-questions
mailing list