diff options
50 files changed, 614 insertions, 466 deletions
diff --git a/lib/asn1/src/asn1ct_check.erl b/lib/asn1/src/asn1ct_check.erl index 0a13801e08..f94f3b56bc 100644 --- a/lib/asn1/src/asn1ct_check.erl +++ b/lib/asn1/src/asn1ct_check.erl @@ -2574,6 +2574,18 @@ normalize_bitstring(S, Value, Type)-> Bs end. +hstring_to_binary(L) -> + byte_align(hstring_to_bitstring(L)). + +bstring_to_binary(L) -> + byte_align(bstring_to_bitstring(L)). + +byte_align(Bs) -> + case bit_size(Bs) rem 8 of + 0 -> Bs; + N -> <<Bs/bitstring,0:(8-N)>> + end. + hstring_to_bitstring(L) -> << <<(hex_to_int(D)):4>> || D <- L >>. @@ -2592,9 +2604,9 @@ hex_to_int(D) when $A =< D, D =< $F -> D - ($A - 10). normalize_octetstring(S,Value,CType) -> case Value of {bstring,String} -> - bstring_to_octetlist(String); + bstring_to_binary(String); {hstring,String} -> - hstring_to_octetlist(String); + hstring_to_binary(String); Rec when is_record(Rec,'Externalvaluereference') -> get_normalized_value(S,Value,CType, fun normalize_octetstring/3,[]); @@ -2616,35 +2628,6 @@ normalize_octetstring(S,Value,CType) -> Value end. - -bstring_to_octetlist([]) -> - []; -bstring_to_octetlist([H|T]) when H == $0 ; H == $1 -> - bstring_to_octetlist(T,6,[(H - $0) bsl 7]). -bstring_to_octetlist([H|T],0,[Hacc|Tacc]) when H == $0; H == $1 -> - bstring_to_octetlist(T, 7, [0,Hacc + (H -$0)| Tacc]); -bstring_to_octetlist([H|T],BSL,[Hacc|Tacc]) when H == $0; H == $1 -> - bstring_to_octetlist(T, BSL-1, [Hacc + ((H - $0) bsl BSL)| Tacc]); -bstring_to_octetlist([],7,[0|Acc]) -> - lists:reverse(Acc); -bstring_to_octetlist([],_,Acc) -> - lists:reverse(Acc). - -hstring_to_octetlist([]) -> - []; -hstring_to_octetlist(L) -> - hstring_to_octetlist(L,4,[]). -hstring_to_octetlist([H|T],0,[Hacc|Tacc]) when H >= $A, H =< $F -> - hstring_to_octetlist(T,4,[Hacc + (H - $A + 10)|Tacc]); -hstring_to_octetlist([H|T],BSL,Acc) when H >= $A, H =< $F -> - hstring_to_octetlist(T,0,[(H - $A + 10) bsl BSL|Acc]); -hstring_to_octetlist([H|T],0,[Hacc|Tacc]) when H >= $0; H =< $9 -> - hstring_to_octetlist(T,4,[Hacc + (H - $0)|Tacc]); -hstring_to_octetlist([H|T],BSL,Acc) when H >= $0; H =< $9 -> - hstring_to_octetlist(T,0,[(H - $0) bsl BSL|Acc]); -hstring_to_octetlist([],_,Acc) -> - lists:reverse(Acc). - normalize_objectidentifier(S, Value) -> {ok,Val} = validate_objectidentifier(S, o_id, Value, []), Val. diff --git a/lib/asn1/src/asn1ct_gen_ber_bin_v2.erl b/lib/asn1/src/asn1ct_gen_ber_bin_v2.erl index 84cda4491b..f3a6f115d3 100644 --- a/lib/asn1/src/asn1ct_gen_ber_bin_v2.erl +++ b/lib/asn1/src/asn1ct_gen_ber_bin_v2.erl @@ -493,7 +493,6 @@ gen_dec_prim(_Erules, Att, BytesVar, DoTag, _TagIn, _Form, _OptOrMand) -> _ -> "" end, NewTypeName = case Typename of - 'OCTET STRING' -> restricted_string; 'NumericString' -> restricted_string; 'TeletexString' -> restricted_string; 'T61String' -> restricted_string; @@ -551,6 +550,19 @@ gen_dec_prim(_Erules, Att, BytesVar, DoTag, _TagIn, _Form, _OptOrMand) -> 'RELATIVE-OID' -> emit(["decode_relative_oid(",BytesVar,","]), need(decode_relative_oid, 2); + 'OCTET STRING' -> + F = case asn1ct:use_legacy_types() of + false -> decode_octet_string; + true -> decode_restricted_string + end, + emit([{asis,F},"(",BytesVar,","]), + case Constraint of + [] -> + need(F, 2); + _ -> + emit([{asis,Constraint},","]), + need(F, 3) + end; restricted_string -> emit(["decode_restricted_string",AsBin,"(",BytesVar,","]), case Constraint of diff --git a/lib/asn1/src/asn1ct_gen_per.erl b/lib/asn1/src/asn1ct_gen_per.erl index 1885f782bd..519ce9f054 100644 --- a/lib/asn1/src/asn1ct_gen_per.erl +++ b/lib/asn1/src/asn1ct_gen_per.erl @@ -151,7 +151,13 @@ gen_encode_prim_imm(Val, #type{def=Type0,constraint=Constraint}, Aligned) -> 'BOOLEAN' -> asn1ct_imm:per_enc_boolean(Val, Aligned); 'OCTET STRING' -> - asn1ct_imm:per_enc_octet_string(Val, Constraint, Aligned); + case asn1ct:use_legacy_types() of + false -> + asn1ct_imm:per_enc_octet_string(Val, Constraint, Aligned); + true -> + asn1ct_imm:per_enc_legacy_octet_string(Val, Constraint, + Aligned) + end; 'ASN1_OPEN_TYPE' -> case Constraint of [#'Externaltypereference'{type=Tname}] -> @@ -332,7 +338,10 @@ gen_dec_imm_1('GeneralizedTime', Constraint, Aligned) -> gen_dec_imm_1('OCTET STRING', Constraint, Aligned) -> SzConstr = asn1ct_imm:effective_constraint(bitstring, Constraint), Imm = asn1ct_imm:per_dec_octet_string(SzConstr, Aligned), - {convert,binary_to_list,Imm}; + case asn1ct:use_legacy_types() of + false -> {convert,{binary,copy},Imm}; + true -> {convert,binary_to_list,Imm} + end; gen_dec_imm_1('TeletexString', _Constraint, Aligned) -> gen_dec_restricted_string(Aligned); gen_dec_imm_1('T61String', _Constraint, Aligned) -> diff --git a/lib/asn1/src/asn1ct_imm.erl b/lib/asn1/src/asn1ct_imm.erl index 9da8658f19..fde39c674e 100644 --- a/lib/asn1/src/asn1ct_imm.erl +++ b/lib/asn1/src/asn1ct_imm.erl @@ -32,6 +32,7 @@ per_enc_integer/3,per_enc_integer/4, per_enc_null/2, per_enc_k_m_string/4,per_enc_octet_string/3, + per_enc_legacy_octet_string/3, per_enc_open_type/2, per_enc_restricted_string/3, per_enc_small_number/2]). @@ -305,7 +306,13 @@ per_enc_open_type(Imm0, Aligned) -> {call,erlang,byte_size,[Bin],Len}| per_enc_length(Bin, 8, Len, Aligned)]. -per_enc_octet_string(Val0, Constraint0, Aligned) -> +per_enc_octet_string(Bin, Constraint0, Aligned) -> + {B,[[],Len]} = mk_vars([], [len]), + Constraint = effective_constraint(bitstring, Constraint0), + B ++ [{call,erlang,byte_size,[Bin],Len}| + per_enc_length(Bin, 8, Len, Constraint, Aligned, 'OCTET STRING')]. + +per_enc_legacy_octet_string(Val0, Constraint0, Aligned) -> {B,[Val,Bin,Len]} = mk_vars(Val0, [bin,len]), Constraint = effective_constraint(bitstring, Constraint0), B ++ [{call,erlang,iolist_to_binary,[Val],Bin}, @@ -903,6 +910,9 @@ dcg_list_outside([{call,Fun,{V,Buf},{Dst,DstBuf}}|T]) -> emit(["{",Dst,",",DstBuf,"} = "]), Fun(V, Buf), iter_dcg_list_outside(T); +dcg_list_outside([{convert,{M,F},V,Dst}|T]) -> + emit([Dst," = ",{asis,M},":",{asis,F},"(",V,")"]), + iter_dcg_list_outside(T); dcg_list_outside([{convert,Op,V,Dst}|T]) -> emit([Dst," = ",Op,"(",V,")"]), iter_dcg_list_outside(T); diff --git a/lib/asn1/src/asn1ct_value.erl b/lib/asn1/src/asn1ct_value.erl index 862b3c4ea5..a86c963b9d 100644 --- a/lib/asn1/src/asn1ct_value.erl +++ b/lib/asn1/src/asn1ct_value.erl @@ -260,7 +260,11 @@ from_type_prim(M, D) -> 'BOOLEAN' -> true; 'OCTET STRING' -> - adjust_list(size_random(C),c_string(C,"OCTET STRING")); + S0 = adjust_list(size_random(C), c_string(C, "OCTET STRING")), + case M:legacy_erlang_types() of + false -> list_to_binary(S0); + true -> S0 + end; 'NumericString' -> adjust_list(size_random(C),c_string(C,"0123456789")); 'TeletexString' -> diff --git a/lib/asn1/src/asn1rtt_ber.erl b/lib/asn1/src/asn1rtt_ber.erl index a4aa347aea..4bd814769f 100644 --- a/lib/asn1/src/asn1rtt_ber.erl +++ b/lib/asn1/src/asn1rtt_ber.erl @@ -40,6 +40,7 @@ encode_relative_oid/2,decode_relative_oid/2, encode_object_identifier/2,decode_object_identifier/2, encode_restricted_string/2, + decode_octet_string/2,decode_octet_string/3, decode_restricted_string/2,decode_restricted_string/3, encode_universal_string/2,decode_universal_string/3, encode_UTF8_string/2,decode_UTF8_string/2, @@ -1302,6 +1303,19 @@ encode_restricted_string(OctetList, TagIn) when is_list(OctetList) -> encode_tags(TagIn, OctetList, length(OctetList)). %%============================================================================ +%% decode OCTET STRING to binary +%%============================================================================ + +decode_octet_string(Tlv, TagsIn) -> + Bin = match_and_collect(Tlv, TagsIn), + binary:copy(Bin). + +decode_octet_string(Tlv, Range, TagsIn) -> + Bin0 = match_and_collect(Tlv, TagsIn), + Bin = binary:copy(Bin0), + check_restricted_string(Bin, byte_size(Bin), Range). + +%%============================================================================ %% decode Numeric Printable Teletex Videotex Visible IA5 Graphic General strings %%============================================================================ diff --git a/lib/asn1/src/asn1rtt_ext.erl b/lib/asn1/src/asn1rtt_ext.erl index 46adb2007d..f3eee1cdd5 100644 --- a/lib/asn1/src/asn1rtt_ext.erl +++ b/lib/asn1/src/asn1rtt_ext.erl @@ -38,7 +38,7 @@ transform_to_EXTERNAL1990([{'context-negotiation',Context_negot}|Rest], Acc) -> transform_to_EXTERNAL1990([asn1_NOVALUE|Rest], Acc) -> transform_to_EXTERNAL1990(Rest, [asn1_NOVALUE|Acc]); transform_to_EXTERNAL1990([Data_val_desc,Data_value], Acc) - when is_list(Data_value)-> + when is_list(Data_value); is_binary(Data_value) -> list_to_tuple(lists:reverse([{'octet-aligned',Data_value}, Data_val_desc|Acc])); transform_to_EXTERNAL1990([Data_val_desc,Data_value], Acc) diff --git a/lib/asn1/test/asn1_SUITE.erl b/lib/asn1/test/asn1_SUITE.erl index ac61187ed4..1c4eb583cf 100644 --- a/lib/asn1/test/asn1_SUITE.erl +++ b/lib/asn1/test/asn1_SUITE.erl @@ -817,7 +817,8 @@ testImport(Config, Rule, Opts) -> testMegaco(Config) -> test(Config, fun testMegaco/3). testMegaco(Config, Rule, Opts) -> - {ok, Module1, Module2} = testMegaco:compile(Config, Rule, Opts), + {ok, Module1, Module2} = testMegaco:compile(Config, Rule, + [legacy_erlang_types|Opts]), ok = testMegaco:main(Module1, Config), ok = testMegaco:main(Module2, Config). @@ -898,7 +899,8 @@ specialized_decodes(Config, Rule, Opts) -> "PartialDecMyHTTP.asn", "MEDIA-GATEWAY-CONTROL.asn", "P-Record"], - Config, [Rule, asn1config|Opts]), + Config, + [Rule,legacy_erlang_types,asn1config|Opts]), test_partial_incomplete_decode:test(Config), test_selective_decode:test(). diff --git a/lib/asn1/test/asn1_SUITE_data/TCAPPackage_msg.erl b/lib/asn1/test/asn1_SUITE_data/TCAPPackage_msg.erl index 06eba8b6eb..0bf4425263 100644 --- a/lib/asn1/test/asn1_SUITE_data/TCAPPackage_msg.erl +++ b/lib/asn1/test/asn1_SUITE_data/TCAPPackage_msg.erl @@ -47,7 +47,7 @@ val('TransactionPDU') -> dialoguePortion=val('DialoguePortion'), componentPortion=val('ComponentSequence')}; val('TransactionID') -> - "OCTET STRING"; + <<"OCTET STRING">>; val('DialoguePortion') -> #'DialoguePortion'{version=val('ProtocolVersion'), applicationContext={integerApplicationId,12}, @@ -57,23 +57,23 @@ val('DialoguePortion') -> val('Confidentiality') -> #'Confidentiality'{confidentialityId={integerConfidentialityId,14}}; val('ProtocolVersion') -> - "K"; + <<"K">>; val('UserInformation') -> [val('EXTERNAL'),val('EXTERNAL')]; val('EXTERNAL') -> #'EXTERNAL'{'direct-reference'={0,1,2}, - encoding={'single-ASN1-type',[1,2,3,4]}}; + encoding={'single-ASN1-type',<<1,2,3,4>>}}; val('ComponentSequence') -> [val('ComponentPDU',1),val('ComponentPDU',2),val('ComponentPDU',3)]; val('Invoke') -> - #'Invoke'{componentIDs="AB", + #'Invoke'{componentIDs = <<"AB">>, opcode={local,-2}, parameter=running}; val('ReturnResult') -> - #'ReturnResult'{componentID="C", + #'ReturnResult'{componentID = <<"C">>, parameter=[1,2,3,4]}; val('ReturnError') -> - #'ReturnError'{componentID="D", + #'ReturnError'{componentID = <<"D">>, errorCode={local,21}, parameter=true}; val('Abort') -> @@ -87,8 +87,8 @@ val(Type) -> check_result('PackageType',unidirectional,Res) -> {unidirectional, {'UniTransactionPDU', - "OCTET STRING", - {'DialoguePortion',"K", + <<"OCTET STRING">>, + {'DialoguePortion',<<"K">>, {integerApplicationId,12}, [_,%{'EXTERNAL',{syntax,{0,1,2}},asn1_NOVALUE,OTVal}, _],%{'EXTERNAL',{syntax,{0,1,2}},asn1_NOVALUE,OTVal}], @@ -96,14 +96,14 @@ check_result('PackageType',unidirectional,Res) -> {'Confidentiality', {integerConfidentialityId,14}}}, [{invokeLast, - {_,"AB",{local,-2},running}}, - {returnResultLast,{_,"C",_}}, - {returnError,{_,"D",{local,21},true}}]}} = Res, + {_,<<"AB">>,{local,-2},running}}, + {returnResultLast,{_,<<"C">>,_}}, + {returnError,{_,<<"D">>,{local,21},true}}]}} = Res, ok; %% check_OT_val(OTVal); check_result('PackageType',abort,Res)-> - {abort,{'Abort',"OCTET STRING", - {'DialoguePortion',"K", + {abort,{'Abort',<<"OCTET STRING">>, + {'DialoguePortion',<<"K">>, {integerApplicationId,12}, [_,%{'EXTERNAL',{syntax,{0,1,2}},asn1_NOVALUE,OTVal}, _],%{'EXTERNAL',{syntax,{0,1,2}},asn1_NOVALUE,OTVal}], @@ -114,9 +114,9 @@ check_result('PackageType',abort,Res)-> ok; %% check_OT_val(OTVal); check_result('PackageType',response,Res) -> - {response,{'TransactionPDU',"OCTET STRING", + {response,{'TransactionPDU',<<"OCTET STRING">>, {'DialoguePortion', - "K", + <<"K">>, {integerApplicationId,12}, [_,%{'EXTERNAL',{syntax,{0,1,2}},asn1_NOVALUE,OTVal}, _],%{'EXTERNAL',{syntax,{0,1,2}},asn1_NOVALUE,OTVal}], @@ -124,11 +124,11 @@ check_result('PackageType',response,Res) -> {'Confidentiality', {integerConfidentialityId,14}}}, [{invokeLast, - {_,"AB",{local,-2},running}}, + {_,<<"AB">>,{local,-2},running}}, {returnResultLast, - {_,"C",_}}, + {_,<<"C">>,_}}, {returnError, - {_,"D",{local,21},true}}]}} = Res, + {_,<<"D">>,{local,21},true}}]}} = Res, ok. %% check_OT_val(OTVal). diff --git a/lib/asn1/test/asn1_SUITE_data/extensionAdditionGroup.erl b/lib/asn1/test/asn1_SUITE_data/extensionAdditionGroup.erl index 8e21e6ca84..a1e563f6be 100644 --- a/lib/asn1/test/asn1_SUITE_data/extensionAdditionGroup.erl +++ b/lib/asn1/test/asn1_SUITE_data/extensionAdditionGroup.erl @@ -67,8 +67,8 @@ run3(Erule) -> asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE, asn1_NOVALUE,asn1_NOVALUE}, asn1_NOVALUE, - [[80,66,0,5,10,0,5,0,24,11,7,84,54,33,0,1,1,0,0,0,1,39,5,66,127,0,0,1], - []], + [<<80,66,0,5,10,0,5,0,24,11,7,84,54,33,0,1,1,0,0,0,1,39,5,66,127,0,0,1>>, + <<>>], {'RRC-RadioResourceConfigDedicated', [{'RRC-SRB-ToAddMod',1, {explicitValue, diff --git a/lib/asn1/test/h323test.erl b/lib/asn1/test/h323test.erl index 3baaa994ea..7577928493 100644 --- a/lib/asn1/test/h323test.erl +++ b/lib/asn1/test/h323test.erl @@ -42,7 +42,7 @@ alerting_val() -> {'TerminalInfo',asn1_NOVALUE}, false,false}, asn1_NOVALUE, - {'CallIdentifier',[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}, + {'CallIdentifier',<<0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0>>}, asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE}}, asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE}, asn1_NOVALUE}. @@ -57,18 +57,18 @@ connect_val() -> {'Connect-UUIE', {0,0,8,2250,0,2}, {ipAddress, - {'TransportAddress_ipAddress',[136,225,41,58],1187}}, + {'TransportAddress_ipAddress',<<136,225,41,58>>,1187}}, {'EndpointType',asn1_NOVALUE, {'VendorIdentifier', {'H221NonStandard',181,0,21324}, - [77,105,99,114,111,115,111,102,116,174,32,78,101,116, - 77,101,100,116,105,110,103,174,0], - [51,46,48,0]}, + <<77,105,99,114,111,115,111,102,116,174,32,78,101,116, + 77,101,100,116,105,110,103,174,0>>, + <<51,46,48,0>>}, asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE, {'TerminalInfo',asn1_NOVALUE}, false,false}, - [22,137,237,197,191,35,211,17,140,45,0,192,79,75,28,208], - {'CallIdentifier',[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}, + <<22,137,237,197,191,35,211,17,140,45,0,192,79,75,28,208>>, + {'CallIdentifier',<<0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0>>}, asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE}}, asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE}, asn1_NOVALUE}. diff --git a/lib/asn1/test/testChoExtension.erl b/lib/asn1/test/testChoExtension.erl index e54cbe825b..09e19ceebb 100644 --- a/lib/asn1/test/testChoExtension.erl +++ b/lib/asn1/test/testChoExtension.erl @@ -31,13 +31,13 @@ extension(_Rules) -> %% A trick to encode with another compatible CHOICE type to test reception %% extension alternative - roundtrip('ChoExt1x', {str,"abc"}), + roundtrip('ChoExt1x', {str,<<"abc">>}), roundtrip('ChoExt2', {bool,true}), roundtrip('ChoExt2', {int,33}), roundtrip('ChoExt3', {bool,true}), roundtrip('ChoExt3', {int,33}), - roundtrip('ChoExt4', {str,"abc"}), + roundtrip('ChoExt4', {str,<<"abc">>}), roundtrip('ChoEmptyRoot', {bool,false}), roundtrip('ChoEmptyRoot', {bool,true}), diff --git a/lib/asn1/test/testChoExternal.erl b/lib/asn1/test/testChoExternal.erl index 12abdbb2bc..0914d54f33 100644 --- a/lib/asn1/test/testChoExternal.erl +++ b/lib/asn1/test/testChoExternal.erl @@ -31,16 +31,16 @@ external(_Rules) -> roundtrip('ChoXBool', {xboolImp,true}), roundtrip('ChoXBool', {xboolExp,true}), - roundtrip('NT', {os,"kalle"}), - roundtrip('Exp', {os,"kalle"}), - roundtrip('NTNT', {os,"kalle"}), - roundtrip('NTExp', {os,"kalle"}), - roundtrip('ExpNT', {os,"kalle"}), - roundtrip('ExpExp', {os,"kalle"}), - roundtrip('XNTNT', {os,"kalle"}), - roundtrip('XNTExp', {os,"kalle"}), - roundtrip('XExpNT', {os,"kalle"}), - roundtrip('XExpExp', {os,"kalle"}), + roundtrip('NT', {os,<<"kalle">>}), + roundtrip('Exp', {os,<<"kalle">>}), + roundtrip('NTNT', {os,<<"kalle">>}), + roundtrip('NTExp', {os,<<"kalle">>}), + roundtrip('ExpNT', {os,<<"kalle">>}), + roundtrip('ExpExp', {os,<<"kalle">>}), + roundtrip('XNTNT', {os,<<"kalle">>}), + roundtrip('XNTExp', {os,<<"kalle">>}), + roundtrip('XExpNT', {os,<<"kalle">>}), + roundtrip('XExpExp', {os,<<"kalle">>}), ok. diff --git a/lib/asn1/test/testChoOptional.erl b/lib/asn1/test/testChoOptional.erl index f5e77cb721..71a7346e3f 100644 --- a/lib/asn1/test/testChoOptional.erl +++ b/lib/asn1/test/testChoOptional.erl @@ -27,16 +27,20 @@ run() -> roundtrip('Seq1', #'Seq1'{bool=true,int=asn1_NOVALUE,cho=asn1_NOVALUE}), roundtrip('Seq1', #'Seq1'{bool=true,int=233,cho=asn1_NOVALUE}), - roundtrip('Seq1', #'Seq1'{bool=true,int=asn1_NOVALUE,cho={vsCho,"Vs Str"}}), - roundtrip('Seq1', #'Seq1'{bool=true,int=asn1_NOVALUE,cho={ocStrCho,"Oct Str"}}), + roundtrip('Seq1', #'Seq1'{bool=true,int=asn1_NOVALUE, + cho={vsCho,"Vs Str"}}), + roundtrip('Seq1', #'Seq1'{bool=true,int=asn1_NOVALUE, + cho={ocStrCho,<<"Oct Str">>}}), roundtrip('Seq2', #'Seq2'{int=asn1_NOVALUE,cho=asn1_NOVALUE,bool=true}), roundtrip('Seq2', #'Seq2'{int=233,cho=asn1_NOVALUE,bool=true}), roundtrip('Seq2', #'Seq2'{int=asn1_NOVALUE,cho={vsCho,"Vs Str"},bool=true}), - roundtrip('Seq2', #'Seq2'{int=asn1_NOVALUE,cho={ocStrCho,"Oct Str"},bool=true}), + roundtrip('Seq2', #'Seq2'{int=asn1_NOVALUE,cho={ocStrCho,<<"Oct Str">>}, + bool=true}), roundtrip('Seq3', #'Seq3'{cho=asn1_NOVALUE,int=asn1_NOVALUE,bool=true}), roundtrip('Seq3', #'Seq3'{cho=asn1_NOVALUE,int=233,bool=true}), roundtrip('Seq3', #'Seq3'{cho={vsCho,"Vs Str"},int=asn1_NOVALUE,bool=true}), - roundtrip('Seq3', #'Seq3'{cho={ocStrCho,"Oct Str"},int=asn1_NOVALUE,bool=true}), + roundtrip('Seq3', #'Seq3'{cho={ocStrCho,<<"Oct Str">>}, + int=asn1_NOVALUE,bool=true}), ok. roundtrip(Type, Value) -> diff --git a/lib/asn1/test/testChoRecursive.erl b/lib/asn1/test/testChoRecursive.erl index 593b845949..ccd60c2897 100644 --- a/lib/asn1/test/testChoRecursive.erl +++ b/lib/asn1/test/testChoRecursive.erl @@ -31,13 +31,13 @@ recursive(_Rules) -> roundtrip('ChoRec', {something, #'ChoRec_something'{a = 77, - b = "some octets here", + b = <<"some octets here">>, c = {nothing,'NULL'}}}), roundtrip('ChoRec', {nothing,'NULL'}), roundtrip('ChoRec2', {something, #'ChoRec2_something'{a = 77, - b = "some octets here", + b = <<"some octets here">>, c = {nothing,'NULL'}}}), roundtrip('ChoRec2', {nothing,'NULL'}), ok. diff --git a/lib/asn1/test/testChoTypeRefCho.erl b/lib/asn1/test/testChoTypeRefCho.erl index cd2672add0..636c301403 100644 --- a/lib/asn1/test/testChoTypeRefCho.erl +++ b/lib/asn1/test/testChoTypeRefCho.erl @@ -30,7 +30,7 @@ choice(_Rules) -> roundtrip('ChoTRcho', {'choChoE-E',{choInt,88}}), roundtrip('ChoChoInline', {bool1,true}), roundtrip('ChoChoInline', {choCho,{bool,true}}), - roundtrip('ChoChoInline', {choCho,{octStr,"kk"}}), + roundtrip('ChoChoInline', {choCho,{octStr,<<"kk">>}}), roundtrip('ChoChoInline', {choCho,{int,55}}), ok. diff --git a/lib/asn1/test/testChoTypeRefPrim.erl b/lib/asn1/test/testChoTypeRefPrim.erl index 8a2bc7bd8e..747baeddd8 100644 --- a/lib/asn1/test/testChoTypeRefPrim.erl +++ b/lib/asn1/test/testChoTypeRefPrim.erl @@ -25,18 +25,18 @@ prim(_Rules) -> roundtrip('ChoTR', {bool,true}), - roundtrip('ChoTR', {octStr,[11,12,13,14,15,16,17]}), + roundtrip('ChoTR', {octStr,<<11,12,13,14,15,16,17>>}), roundtrip('ChoTR', {int,233}), - roundtrip('ChoTR', {octStr,"Stringing in the rain"}), - roundtrip('ChoTR2', {octStr,"A string"}), - roundtrip('ChoTR2', {octStrI,"A string"}), - roundtrip('ChoTR2', {octStrE,"A string"}), - roundtrip('ChoTR2', {'octStr-I',"A string"}), - roundtrip('ChoTR2', {'octStrI-I',"A string"}), - roundtrip('ChoTR2', {'octStrE-I',"A string"}), - roundtrip('ChoTR2', {'octStr-E',"A string"}), - roundtrip('ChoTR2', {'octStrI-E',"A string"}), - roundtrip('ChoTR2', {'octStrE-E',"A string"}), + roundtrip('ChoTR', {octStr,<<"Stringing in the rain">>}), + roundtrip('ChoTR2', {octStr,<<"A string">>}), + roundtrip('ChoTR2', {octStrI,<<"A string">>}), + roundtrip('ChoTR2', {octStrE,<<"A string">>}), + roundtrip('ChoTR2', {'octStr-I',<<"A string">>}), + roundtrip('ChoTR2', {'octStrI-I',<<"A string">>}), + roundtrip('ChoTR2', {'octStrE-I',<<"A string">>}), + roundtrip('ChoTR2', {'octStr-E',<<"A string">>}), + roundtrip('ChoTR2', {'octStrI-E',<<"A string">>}), + roundtrip('ChoTR2', {'octStrE-E',<<"A string">>}), ok. roundtrip(Type, Value) -> diff --git a/lib/asn1/test/testChoTypeRefSeq.erl b/lib/asn1/test/testChoTypeRefSeq.erl index 86c22619aa..91d0b45e89 100644 --- a/lib/asn1/test/testChoTypeRefSeq.erl +++ b/lib/asn1/test/testChoTypeRefSeq.erl @@ -28,15 +28,24 @@ -record('ChoSeqExp', {seqInt, seqOs}). seq(_Rules) -> - roundtrip('ChoTRseq', {choSeq,#'ChoSeq'{seqInt=88,seqOs="A string"}}), - roundtrip('ChoTRseq', {choSeqI,#'ChoSeq'{seqInt=88,seqOs="A string"}}), - roundtrip('ChoTRseq', {choSeqE,#'ChoSeq'{seqInt=88,seqOs="A string"}}), - roundtrip('ChoTRseq', {'choSeq-I',#'ChoSeqImp'{seqInt=88,seqOs="A string"}}), - roundtrip('ChoTRseq', {'choSeqI-I',#'ChoSeqImp'{seqInt=88,seqOs="A string"}}), - roundtrip('ChoTRseq', {'choSeqE-I',#'ChoSeqImp'{seqInt=88,seqOs="A string"}}), - roundtrip('ChoTRseq', {'choSeq-E',#'ChoSeqExp'{seqInt=88,seqOs="A string"}}), - roundtrip('ChoTRseq', {'choSeqI-E',#'ChoSeqExp'{seqInt=88,seqOs="A string"}}), - roundtrip('ChoTRseq', {'choSeqE-E',#'ChoSeqExp'{seqInt=88,seqOs="A string"}}), + roundtrip('ChoTRseq', {choSeq,#'ChoSeq'{seqInt=88, + seqOs = <<"A string">>}}), + roundtrip('ChoTRseq', {choSeqI,#'ChoSeq'{seqInt=88, + seqOs = <<"A string">>}}), + roundtrip('ChoTRseq', {choSeqE,#'ChoSeq'{seqInt=88, + seqOs = <<"A string">>}}), + roundtrip('ChoTRseq', {'choSeq-I',#'ChoSeqImp'{seqInt=88, + seqOs = <<"A string">>}}), + roundtrip('ChoTRseq', {'choSeqI-I',#'ChoSeqImp'{seqInt=88, + seqOs = <<"A string">>}}), + roundtrip('ChoTRseq', {'choSeqE-I',#'ChoSeqImp'{seqInt=88, + seqOs = <<"A string">>}}), + roundtrip('ChoTRseq', {'choSeq-E',#'ChoSeqExp'{seqInt=88, + seqOs = <<"A string">>}}), + roundtrip('ChoTRseq', {'choSeqI-E',#'ChoSeqExp'{seqInt=88, + seqOs = <<"A string">>}}), + roundtrip('ChoTRseq', {'choSeqE-E',#'ChoSeqExp'{seqInt=88, + seqOs = <<"A string">>}}), ok. roundtrip(Type, Value) -> diff --git a/lib/asn1/test/testChoTypeRefSet.erl b/lib/asn1/test/testChoTypeRefSet.erl index fd3d75cbcb..bd9068b53e 100644 --- a/lib/asn1/test/testChoTypeRefSet.erl +++ b/lib/asn1/test/testChoTypeRefSet.erl @@ -28,15 +28,24 @@ -record('ChoSetExp', {setInt, setOs}). set(_Rules) -> - roundtrip('ChoTRset', {choSet,#'ChoSet'{setInt=88,setOs="A string"}}), - roundtrip('ChoTRset', {choSetI,#'ChoSet'{setInt=88,setOs="A string"}}), - roundtrip('ChoTRset', {choSetE,#'ChoSet'{setInt=88,setOs="A string"}}), - roundtrip('ChoTRset', {'choSet-I',#'ChoSetImp'{setInt=88,setOs="A string"}}), - roundtrip('ChoTRset', {'choSetI-I',#'ChoSetImp'{setInt=88,setOs="A string"}}), - roundtrip('ChoTRset', {'choSetE-I',#'ChoSetImp'{setInt=88,setOs="A string"}}), - roundtrip('ChoTRset', {'choSet-E',#'ChoSetExp'{setInt=88,setOs="A string"}}), - roundtrip('ChoTRset', {'choSetI-E',#'ChoSetExp'{setInt=88,setOs="A string"}}), - roundtrip('ChoTRset', {'choSetE-E',#'ChoSetExp'{setInt=88,setOs="A string"}}), + roundtrip('ChoTRset', {choSet,#'ChoSet'{setInt=88, + setOs = <<"A string">>}}), + roundtrip('ChoTRset', {choSetI,#'ChoSet'{setInt=88, + setOs = <<"A string">>}}), + roundtrip('ChoTRset', {choSetE,#'ChoSet'{setInt=88, + setOs = <<"A string">>}}), + roundtrip('ChoTRset', {'choSet-I',#'ChoSetImp'{setInt=88, + setOs = <<"A string">>}}), + roundtrip('ChoTRset', {'choSetI-I',#'ChoSetImp'{setInt=88, + setOs = <<"A string">>}}), + roundtrip('ChoTRset', {'choSetE-I',#'ChoSetImp'{setInt=88, + setOs = <<"A string">>}}), + roundtrip('ChoTRset', {'choSet-E',#'ChoSetExp'{setInt=88, + setOs = <<"A string">>}}), + roundtrip('ChoTRset', {'choSetI-E',#'ChoSetExp'{setInt=88, + setOs = <<"A string">>}}), + roundtrip('ChoTRset', {'choSetE-E',#'ChoSetExp'{setInt=88, + setOs = <<"A string">>}}), ok. roundtrip(Type, Value) -> diff --git a/lib/asn1/test/testConstraints.erl b/lib/asn1/test/testConstraints.erl index 54ba748519..3ccf883bd6 100644 --- a/lib/asn1/test/testConstraints.erl +++ b/lib/asn1/test/testConstraints.erl @@ -208,14 +208,14 @@ int_constraints(Rules) -> %% More SIZE Constraints %%========================================================== - roundtrip('FixedSize', "0123456789"), - roundtrip('FixedSize2', "0123456789"), - roundtrip('FixedSize2', "0123456789abcdefghij"), + roundtrip('FixedSize', <<"0123456789">>), + roundtrip('FixedSize2', <<"0123456789">>), + roundtrip('FixedSize2', <<"0123456789abcdefghij">>), range_error(Rules, 'FixedSize', "short"), range_error(Rules, 'FixedSize2', "short"), - [roundtrip('VariableSize', lists:seq($A, $A+L-1)) || + [roundtrip('VariableSize', list_to_binary(lists:seq($A, $A+L-1))) || L <- lists:seq(1, 10)], roundtrip_enc('ShorterExt', "a", shorter_ext(Rules, "a")), diff --git a/lib/asn1/test/testFragmented.erl b/lib/asn1/test/testFragmented.erl index 8d5fa07a5b..35b21f90a9 100644 --- a/lib/asn1/test/testFragmented.erl +++ b/lib/asn1/test/testFragmented.erl @@ -22,10 +22,10 @@ -export([main/1]). main(_Erule) -> - roundtrip('PDU', {'PDU',1,false,["abc","def"]}), + roundtrip('PDU', {'PDU',1,false,[<<"abc">>,<<"def">>]}), B256 = lists:seq(0, 255), K1 = lists:duplicate(4, B256), - K8 = binary_to_list(iolist_to_binary(lists:duplicate(8, K1))), + K8 = iolist_to_binary(lists:duplicate(8, K1)), roundtrip('PDU', {'PDU',1,false,[K8,K8]}), roundtrip('PDU', {'PDU',1,false,[K8,K8,K8,K8]}), roundtrip('PDU', {'PDU',1,false,[K8,K8,K8,K8,K8,K8]}), diff --git a/lib/asn1/test/testInfObj.erl b/lib/asn1/test/testInfObj.erl index cd335e1023..311595cfda 100644 --- a/lib/asn1/test/testInfObj.erl +++ b/lib/asn1/test/testInfObj.erl @@ -49,7 +49,7 @@ main(_Erule) -> roundtrip('RANAPextract1', 'InitiatingMessage2', Val3), roundtrip('InfObj', 'MyPdu', {'MyPdu',42,12,false,"string"}), - roundtrip('InfObj', 'MyPdu', {'MyPdu',{'Seq',1023,"hello"}, + roundtrip('InfObj', 'MyPdu', {'MyPdu',{'Seq',1023,<<"hello">>}, 42,true,"longer string"}), roundtrip('InfObj', 'MyPdu', {'MyPdu',"75712346",43,true,"string"}), @@ -110,11 +110,11 @@ main(_Erule) -> enc_dec('InfObj', 'DefaultInSeq', {'DefaultInSeq',3,asn1_DEFAULT}), roundtrip('InfObj', 'Multiple-Optionals', - {'Multiple-Optionals',1,42,true,"abc"}), + {'Multiple-Optionals',1,42,true,<<"abc">>}), roundtrip('InfObj', 'Multiple-Optionals', - {'Multiple-Optionals',1,asn1_NOVALUE,true,"abc"}), + {'Multiple-Optionals',1,asn1_NOVALUE,true,<<"abc">>}), roundtrip('InfObj', 'Multiple-Optionals', - {'Multiple-Optionals',1,42,asn1_NOVALUE,"abc"}), + {'Multiple-Optionals',1,42,asn1_NOVALUE,<<"abc">>}), roundtrip('InfObj', 'Multiple-Optionals', {'Multiple-Optionals',1,42,true,asn1_NOVALUE}), roundtrip('InfObj', 'Multiple-Optionals', diff --git a/lib/asn1/test/testMergeCompile.erl b/lib/asn1/test/testMergeCompile.erl index 7cda71c441..b6532b338e 100644 --- a/lib/asn1/test/testMergeCompile.erl +++ b/lib/asn1/test/testMergeCompile.erl @@ -30,7 +30,7 @@ main(Erule) -> %% test of module MS.set.asn that tests OTP-4492: different tagdefault in %% modules and types with same name in modules - MSVal = {'Type4M2',8,true,three,"OCTET STRING"}, + MSVal = {'Type4M2',8,true,three,<<"OCTET STRING">>}, asn1_test_lib:roundtrip('MS', 'Type4M2', MSVal), %% test of RANAP.set.asn1 @@ -142,7 +142,40 @@ test('InsertSubscriberDataArg') -> ok. test(mvrasn6,'InsertSubscriberDataArg') -> - Val = {'InsertSubscriberDataArg',"IMSI","Address","C",serviceGranted,["abc","cde"],["tele","serv","ice"],asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE,{'NAEA-PreferredCI',"NCC",asn1_NOVALUE},{'GPRSSubscriptionData','NULL',[{'PDP-Context',49,"PT","PDP-Address","QoS",'NULL',"APN",asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE}],asn1_NOVALUE},'NULL',onlyMSC,{'LSAInformation','NULL',accessOutsideLSAsAllowed,[{'LSAData',"LSA","L",'NULL',asn1_NOVALUE},{'LSAData',"LSA","L",'NULL',asn1_NOVALUE}],asn1_NOVALUE},'NULL',{'LCSInformation',["Addr","ess","string"],[{'LCS-PrivacyClass',"S","ExtSS",notifyLocationAllowed,[{'ExternalClient',{'LCSClientExternalID',"Addr",asn1_NOVALUE},asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE}],[broadcastService,anonymousLocation,targetMSsubscribedService],asn1_NOVALUE}],asn1_NOVALUE},100,"age",{'MC-SS-Info',"S","ExtSS",5,4,asn1_NOVALUE},"C",{'SGSN-CAMEL-SubscriptionInfo',{'GPRS-CSI',[{'GPRS-CamelTDPData',attach,13,"Addr",continueTransaction,asn1_NOVALUE}],11,asn1_NOVALUE,'NULL','NULL'},{'SMS-CSI',[{'SMS-CAMEL-TDP-DataList','sms-CollectedInfo',13,"Addr",continueTransaction,asn1_NOVALUE}],11,asn1_NOVALUE,'NULL','NULL'},asn1_NOVALUE},"ON"}, - {ok,Bytes} = 'Mvrasn6':encode('InsertSubscriberDataArg', Val), - {ok,_} = 'Mvrasn6':decode('InsertSubscriberDataArg', Bytes), + Val = {'InsertSubscriberDataArg',<<"IMSI">>,<<"Address">>,<<"C">>, + serviceGranted,[<<"abc">>,<<"cde">>], + [<<"tele">>,<<"serv">>,<<"ice">>], + asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE, + asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE, + {'NAEA-PreferredCI',<<"NCC">>,asn1_NOVALUE}, + {'GPRSSubscriptionData','NULL', + [{'PDP-Context',49,<<"PT">>,<<"PDP-Address">>,<<"QoS">>, + 'NULL',<<"APN">>,asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE}], + asn1_NOVALUE},'NULL',onlyMSC, + {'LSAInformation','NULL',accessOutsideLSAsAllowed, + [{'LSAData',<<"LSA">>,<<"L">>,'NULL',asn1_NOVALUE}, + {'LSAData',<<"LSA">>,<<"L">>,'NULL',asn1_NOVALUE}], + asn1_NOVALUE},'NULL', + {'LCSInformation',[<<"Addr">>,<<"ess">>,<<"string">>], + [{'LCS-PrivacyClass',<<"S">>,<<"ExtSS">>,notifyLocationAllowed, + [{'ExternalClient', + {'LCSClientExternalID',<<"Addr">>,asn1_NOVALUE}, + asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE}], + [broadcastService,anonymousLocation,targetMSsubscribedService], + asn1_NOVALUE}],asn1_NOVALUE}, + 100,<<"age">>, + {'MC-SS-Info',<<"S">>,<<"ExtSS">>,5,4,asn1_NOVALUE}, + <<"C">>, + {'SGSN-CAMEL-SubscriptionInfo', + {'GPRS-CSI', + [{'GPRS-CamelTDPData',attach,13,<<"Addr">>, + continueTransaction,asn1_NOVALUE}], + 11,asn1_NOVALUE,'NULL','NULL'}, + {'SMS-CSI', + [{'SMS-CAMEL-TDP-Data','sms-CollectedInfo', + 13,<<"Addr">>,continueTransaction,asn1_NOVALUE}], + 11,asn1_NOVALUE,'NULL','NULL'}, + asn1_NOVALUE}, + <<"ON">>}, + asn1_test_lib:roundtrip('Mvrasn6', 'InsertSubscriberDataArg', Val), ok. diff --git a/lib/asn1/test/testParameterizedInfObj.erl b/lib/asn1/test/testParameterizedInfObj.erl index f3b4f9b170..17abbdb102 100644 --- a/lib/asn1/test/testParameterizedInfObj.erl +++ b/lib/asn1/test/testParameterizedInfObj.erl @@ -72,8 +72,8 @@ param(Erule) -> {error,_Reason2} = 'Param':decode('OS2',[4,4,1,2,3,4]), {ok,_Val4} = 'Param':decode('OS1',[4,2,1,2]); _ -> %per/uper - roundtrip('OS1', [1,2]), - {error,_Reason3} = 'Param':encode('OS1', [1,2,3,4]) + roundtrip('OS1', <<1,2>>), + {error,_Reason3} = 'Param':encode('OS1', <<1,2,3,4>>) end, roundtrip('Scl', {'Scl',42,{a,9738654}}), @@ -102,11 +102,11 @@ ranap(_Erule) -> param2(Config, Erule) -> roundtrip2('HandoverRequired', {'HandoverRequired', - [{'ProtocolIE-Field',1,"ABC"}, + [{'ProtocolIE-Field',1,<<"ABC">>}, {'ProtocolIE-Field',2,577799}]}), Enc = roundtrip2('HandoverRequired', {'HandoverRequired', - [{'ProtocolIE-Field',1,"ABC"}, + [{'ProtocolIE-Field',1,<<"ABC">>}, {'ProtocolIE-Field',2,-42}, {'ProtocolIE-Field',100,533}, {'ProtocolIE-Field',101,true}]}), @@ -127,7 +127,7 @@ param2(Config, Erule) -> [{i,DataDir},{outdir,CaseDir},Erule]), %% Decompile extended data. - {ok,{'HandoverRequired',[{'ProtocolIE-Field',1,"ABC"}, + {ok,{'HandoverRequired',[{'ProtocolIE-Field',1,<<"ABC">>}, {'ProtocolIE-Field',2,-42}, {'ProtocolIE-Field',100,Open100}, {'ProtocolIE-Field',101,Open101}]}} = @@ -137,7 +137,7 @@ param2(Config, Erule) -> %% Test single root. roundtrip2('SingleRoot', - {'SingleRoot',[{'ProtocolIE-Field',1,"ABC"}, + {'SingleRoot',[{'ProtocolIE-Field',1,<<"ABC">>}, {'ProtocolIE-Field',2,9999}]}), ok. diff --git a/lib/asn1/test/testPrimExternal.erl b/lib/asn1/test/testPrimExternal.erl index 07a1de931f..a03760976d 100644 --- a/lib/asn1/test/testPrimExternal.erl +++ b/lib/asn1/test/testPrimExternal.erl @@ -45,6 +45,6 @@ external(_Rules) -> 'XExpNT', 'XExpImp', 'XExpExp'], - _ = [asn1_test_lib:roundtrip('PrimExternal', T, "kalle") || + _ = [asn1_test_lib:roundtrip('PrimExternal', T, <<"kalle">>) || T <- Types], ok. diff --git a/lib/asn1/test/testPrimStrings.erl b/lib/asn1/test/testPrimStrings.erl index 2e133e184a..3262d61a4d 100644 --- a/lib/asn1/test/testPrimStrings.erl +++ b/lib/asn1/test/testPrimStrings.erl @@ -34,7 +34,10 @@ fragmented(Rules) -> Lens = fragmented_lengths(), - fragmented_octet_string(Rules, Lens), + case 'PrimStrings':legacy_erlang_types() of + false -> fragmented_octet_string(Rules, Lens); + true -> ok + end, fragmented_strings(Lens). fragmented_strings(Lens) -> @@ -347,61 +350,62 @@ octet_string(Rules) -> %% Os ::= OCTET STRING %%========================================================== + Legacy = 'PrimStrings':legacy_erlang_types(), case Rules of - ber -> - {ok,"Jones"} = + ber when not Legacy -> + {ok,<<"Jones">>} = 'PrimStrings':decode('Os', <<4,5,16#4A,16#6F,16#6E,16#65,16#73>>), - {ok,"Jones"} = + {ok,<<"Jones">>} = 'PrimStrings':decode('Os', <<36,9,4,3,16#4A,16#6F,16#6E,4,2,16#65,16#73>>), - {ok,"Jones"} = + {ok,<<"Jones">>} = 'PrimStrings':decode('Os', <<36,128,4,3,16#4A,16#6F,16#6E,4,2,16#65,16#73,0,0>>), ok; _ -> ok end, - roundtrip('Os', [47,23,99,255,1]), - roundtrip('OsCon', [47,23,99,255,1]), - roundtrip('OsPri', [47,23,99,255,1]), - roundtrip('OsApp', [47,23,99,255,1]), + os_roundtrip('Os', <<47,23,99,255,1>>), + os_roundtrip('OsCon', <<47,23,99,255,1>>), + os_roundtrip('OsPri', <<47,23,99,255,1>>), + os_roundtrip('OsApp', <<47,23,99,255,1>>), - roundtrip('OsExpCon', [47,23,99,255,1]), - roundtrip('OsExpPri', [47,23,99,255,1]), - roundtrip('OsExpApp', [47,23,99,255,1]), + os_roundtrip('OsExpCon', <<47,23,99,255,1>>), + os_roundtrip('OsExpPri', <<47,23,99,255,1>>), + os_roundtrip('OsExpApp', <<47,23,99,255,1>>), - roundtrip('Os', []), - roundtrip('OsApp', []), - roundtrip('OsExpApp',[]), + os_roundtrip('Os', <<>>), + os_roundtrip('OsApp', <<>>), + os_roundtrip('OsExpApp', <<>>), - OsR = "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", + OsR = <<"12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890">>, - roundtrip('Os', OsR), - roundtrip('OsCon', OsR), - roundtrip('OsExpApp', OsR), + os_roundtrip('Os', OsR), + os_roundtrip('OsCon', OsR), + os_roundtrip('OsExpApp', OsR), case Rules of - ber -> - {ok,"Jones"} = 'PrimStrings':decode('OsExpApp', <<127,62,7,4,5,16#4A,16#6F,16#6E,16#65,16#73>>), - {ok,"Jones"} = 'PrimStrings':decode('OsExpApp', <<127,62,11,36,9,4,3,16#4A,16#6F,16#6E,4,2,16#65,16#73>>), - {ok,"Jones"} = 'PrimStrings':decode('OsExpApp', <<127,62,13,36,128,4,3,16#4A,16#6F,16#6E,4,2,16#65,16#73,0,0>>), - {ok,"Jones"} = 'PrimStrings':decode('OsExpApp', <<127,62,128,36,128,4,3,16#4A,16#6F,16#6E,4,2,16#65,16#73,0,0,0,0>>), - {ok,"JonesJones"} = 'PrimStrings':decode('OsExpApp', <<127,62,128,36,128,4,3,16#4A,16#6F,16#6E,4,2,16#65,16#73,0,0,36,128,4,3,16#4A,16#6F,16#6E,4,2,16#65,16#73,0,0,0,0>>), + ber when not Legacy -> + {ok,<<"Jones">>} = 'PrimStrings':decode('OsExpApp', <<127,62,7,4,5,16#4A,16#6F,16#6E,16#65,16#73>>), + {ok,<<"Jones">>} = 'PrimStrings':decode('OsExpApp', <<127,62,11,36,9,4,3,16#4A,16#6F,16#6E,4,2,16#65,16#73>>), + {ok,<<"Jones">>} = 'PrimStrings':decode('OsExpApp', <<127,62,13,36,128,4,3,16#4A,16#6F,16#6E,4,2,16#65,16#73,0,0>>), + {ok,<<"Jones">>} = 'PrimStrings':decode('OsExpApp', <<127,62,128,36,128,4,3,16#4A,16#6F,16#6E,4,2,16#65,16#73,0,0,0,0>>), + {ok,<<"JonesJones">>} = 'PrimStrings':decode('OsExpApp', <<127,62,128,36,128,4,3,16#4A,16#6F,16#6E,4,2,16#65,16#73,0,0,36,128,4,3,16#4A,16#6F,16#6E,4,2,16#65,16#73,0,0,0,0>>), ok; - - _-> + _ -> ok end, S255 = lists:seq(1, 255), - Strings = {type,true,"","1","12","345",true, - S255,[$a|S255],[$a,$b|S255],397}, - p_roundtrip('OsFixedStrings', Strings), - p_roundtrip('OsFixedStringsExt', Strings), - p_roundtrip('OsVarStringsExt', Strings), + Strings = {type,true,<<"">>,<<"1">>,<<"12">>,<<"345">>,true, + list_to_binary(S255),list_to_binary([$a|S255]), + list_to_binary([$a,$b|S255]),397}, + p_os_roundtrip('OsFixedStrings', Strings), + p_os_roundtrip('OsFixedStringsExt', Strings), + p_os_roundtrip('OsVarStringsExt', Strings), ShortenedStrings = shorten_by_two(Strings), - p_roundtrip('OsFixedStringsExt', ShortenedStrings), - p_roundtrip('OsVarStringsExt', ShortenedStrings), + p_os_roundtrip('OsFixedStringsExt', ShortenedStrings), + p_os_roundtrip('OsVarStringsExt', ShortenedStrings), ok. fragmented_octet_string(Erules, Lens) -> @@ -430,13 +434,14 @@ fragmented_octet_string(Erules, Types, L) -> ok. enc_frag(Erules, Type, Value) -> - {ok,Encoded} = 'PrimStrings':encode(Type, Value), + M = 'PrimStrings', + {ok,Encoded} = M:encode(Type, Value), case Erules of ber -> Encoded; _ -> %% Validate encoding with our own encoder. - Encoded = enc_frag_1(<<>>, list_to_binary(Value)) + Encoded = enc_frag_1(<<>>, Value) end. enc_frag_1(Res, Bin0) -> @@ -455,12 +460,12 @@ enc_frag_1(Res, Bin0) -> end. make_value(L) -> - make_value(L, 0, []). + make_value(L, 0, <<>>). make_value(0, _, Acc) -> Acc; make_value(N, Byte, Acc) when Byte =< 255 -> - make_value(N-1, Byte+7, [Byte|Acc]); + make_value(N-1, Byte+7, <<Acc/binary,Byte:8>>); make_value(N, Byte, Acc) -> make_value(N, Byte band 16#FF, Acc). @@ -758,10 +763,32 @@ utf8_string(_Rules) -> shorten_by_two(Tuple) -> L = [case E of [_,_|T] -> T; + <<_:16,T/binary>> -> T; _ -> E end || E <- tuple_to_list(Tuple)], list_to_tuple(L). +p_os_roundtrip(Type, Value0) -> + Value = setelement(1, Value0, Type), + p_os_roundtrip_1(Type, Value). + +p_os_roundtrip_1(Type, Value) -> + M = 'PrimStrings', + case M:legacy_erlang_types() of + false -> + asn1_test_lib:roundtrip(M, Type, Value); + true -> + {ok,Encoded} = M:encode(Type, Value), + Es0 = tuple_to_list(Value), + Es1 = [if + is_binary(E) -> binary_to_list(E); + true -> E + end || E <- Es0], + ListValue = list_to_tuple(Es1), + {ok,Encoded} = M:encode(Type, ListValue), + {ok,ListValue} = M:decode(Type, Encoded) + end. + p_roundtrip(Type, Value0) -> Value = setelement(1, Value0, Type), roundtrip(Type, Value). @@ -775,6 +802,18 @@ roundtrip(Type, Value, Expected) -> bs_roundtrip(Type, Value) -> bs_roundtrip(Type, Value, Value). +os_roundtrip(Type, Bin) when is_binary(Bin) -> + M = 'PrimStrings', + case M:legacy_erlang_types() of + false -> + asn1_test_lib:roundtrip(M, Type, Bin); + true -> + {ok,Encoded} = M:encode(Type, Bin), + List = binary_to_list(Bin), + {ok,Encoded} = M:encode(Type, List), + {ok,List} = M:decode(Type, Encoded) + end. + bs_roundtrip(Type, Value, Expected) when is_bitstring(Value) -> M = 'PrimStrings', case M:legacy_erlang_types() of diff --git a/lib/asn1/test/testSeqExtension.erl b/lib/asn1/test/testSeqExtension.erl index 8473459c36..c16e9fcd4c 100644 --- a/lib/asn1/test/testSeqExtension.erl +++ b/lib/asn1/test/testSeqExtension.erl @@ -44,7 +44,7 @@ main(Erule, DataDir, Opts) -> roundtrip('SeqExt4', #'SeqExt4'{bool=true,int=12345}), roundtrip('SeqExt4', #'SeqExt4'{bool=false,int=123456}), - roundtrip('SeqExt5', #'SeqExt5'{name="Arne",shoesize=47}), + roundtrip('SeqExt5', #'SeqExt5'{name = <<"Arne">>,shoesize=47}), %% Encode a value with this version of the specification. BigInt = 128638468966, @@ -52,7 +52,7 @@ main(Erule, DataDir, Opts) -> s2=#'SeqExt2'{bool=true,int=2345}, s3=#'SeqExt3'{bool=false,int=17}, s4=#'SeqExt4'{bool=true,int=38739739}, - s5=#'SeqExt5'{name="Arne",shoesize=47}, + s5=#'SeqExt5'{name = <<"Arne">>,shoesize=47}, s6=#'SeqExt6'{i1=531,i2=601,i3=999, i4=777,i5=11953, i6=13553,i7=77777}, diff --git a/lib/asn1/test/testSeqExternal.erl b/lib/asn1/test/testSeqExternal.erl index a8e0902244..0b1d305054 100644 --- a/lib/asn1/test/testSeqExternal.erl +++ b/lib/asn1/test/testSeqExternal.erl @@ -29,15 +29,15 @@ -record('SeqXSet3',{bool, int, set}). main(_Rules) -> - roundtrip('XNTNT', #'XSeqNT'{os="kalle",bool=true}), - roundtrip('XImpNT', #'XSeqNT'{os="kalle",bool=true}), - roundtrip('XExpNT', #'XSeqNT'{os="kalle",bool=true}), - roundtrip('XNTImp', #'XSeqImp'{os="kalle",bool=true}), - roundtrip('XImpImp', #'XSeqImp'{os="kalle",bool=true}), - roundtrip('XExpImp', #'XSeqImp'{os="kalle",bool=true}), - roundtrip('XNTExp', #'XSeqExp'{os="kalle",bool=true}), - roundtrip('XImpExp', #'XSeqExp'{os="kalle",bool=true}), - roundtrip('XExpExp', #'XSeqExp'{os="kalle",bool=true}), + roundtrip('XNTNT', #'XSeqNT'{os = <<"kalle">>,bool=true}), + roundtrip('XImpNT', #'XSeqNT'{os = <<"kalle">>,bool=true}), + roundtrip('XExpNT', #'XSeqNT'{os = <<"kalle">>,bool=true}), + roundtrip('XNTImp', #'XSeqImp'{os = <<"kalle">>,bool=true}), + roundtrip('XImpImp', #'XSeqImp'{os = <<"kalle">>,bool=true}), + roundtrip('XExpImp', #'XSeqImp'{os = <<"kalle">>,bool=true}), + roundtrip('XNTExp', #'XSeqExp'{os = <<"kalle">>,bool=true}), + roundtrip('XImpExp', #'XSeqExp'{os = <<"kalle">>,bool=true}), + roundtrip('XExpExp', #'XSeqExp'{os = <<"kalle">>,bool=true}), roundtrip('SeqXSet1', #'SeqXSet1'{set=#'XSet1'{bool1=true,int1=77, set1=#'XSetIn'{boolIn=false,intIn=88}}, diff --git a/lib/asn1/test/testSeqOf.erl b/lib/asn1/test/testSeqOf.erl index 7f8f4079b4..25059d6052 100644 --- a/lib/asn1/test/testSeqOf.erl +++ b/lib/asn1/test/testSeqOf.erl @@ -85,10 +85,10 @@ main(_Rules) -> seq43=SeqIn3}), roundtrip('Seq5', {'Seq5',true,[],77}), - roundtrip('Seq5', {'Seq5',true,[""],77}), - roundtrip('Seq5', {'Seq5',true,["a"],77}), - roundtrip('Seq5', {'Seq5',true,["ab"],77}), - roundtrip('Seq5', {'Seq5',true,["abc"],77}), + roundtrip('Seq5', {'Seq5',true,[<<"">>],77}), + roundtrip('Seq5', {'Seq5',true,[<<"a">>],77}), + roundtrip('Seq5', {'Seq5',true,[<<"ab">>],77}), + roundtrip('Seq5', {'Seq5',true,[<<"abc">>],77}), roundtrip('Seq6', {'Seq6',[],[],101}), roundtrip('Seq6', {'Seq6',[],[7],101}), @@ -100,15 +100,15 @@ main(_Rules) -> roundtrip('Seq8', {'Seq8',[],37}), roundtrip('Seq9', {'Seq9',true,[],97}), - roundtrip('Seq9', {'Seq9',true,[""],97}), - roundtrip('Seq9', {'Seq9',true,["x"],97}), - roundtrip('Seq9', {'Seq9',true,["xy"],97}), - roundtrip('Seq9', {'Seq9',true,["xyz"],97}), - - roundtrip('Seq10', {'Seq10',true,[""],97}), - roundtrip('Seq10', {'Seq10',true,["a"],97}), - roundtrip('Seq10', {'Seq10',true,["a","b"],97}), - roundtrip('Seq10', {'Seq10',true,["a","b","c"],97}), + roundtrip('Seq9', {'Seq9',true,[<<"">>],97}), + roundtrip('Seq9', {'Seq9',true,[<<"x">>],97}), + roundtrip('Seq9', {'Seq9',true,[<<"xy">>],97}), + roundtrip('Seq9', {'Seq9',true,[<<"xyz">>],97}), + + roundtrip('Seq10', {'Seq10',true,[<<"">>],97}), + roundtrip('Seq10', {'Seq10',true,[<<"a">>],97}), + roundtrip('Seq10', {'Seq10',true,[<<"a">>,<<"b">>],97}), + roundtrip('Seq10', {'Seq10',true,[<<"a">>,<<"b">>,<<"c">>],97}), roundtrip('SeqEmp', #'SeqEmp'{seq1=[#'Empty'{}]}), diff --git a/lib/asn1/test/testSeqOfExternal.erl b/lib/asn1/test/testSeqOfExternal.erl index 2e60f441c1..38b9f0ce7c 100644 --- a/lib/asn1/test/testSeqOfExternal.erl +++ b/lib/asn1/test/testSeqOfExternal.erl @@ -29,50 +29,59 @@ main(_Rules) -> roundtrip('NTNT', - [#'NT'{os="kalle",bool=true},#'NT'{os="kalle",bool=true}]), + [#'NT'{os = <<"kalle">>,bool=true}, + #'NT'{os = <<"kalle">>,bool=true}]), roundtrip('ImpNT', - [#'NT'{os="kalle",bool=true},#'NT'{os="kalle",bool=true}]), + [#'NT'{os = <<"kalle">>,bool=true}, + #'NT'{os = <<"kalle">>,bool=true}]), roundtrip('ExpNT', - [#'NT'{os="kalle",bool=true},#'NT'{os="kalle",bool=true}]), + [#'NT'{os = <<"kalle">>,bool=true}, + #'NT'{os = <<"kalle">>,bool=true}]), roundtrip('NTImp', - [#'Imp'{os="kalle",bool=true},#'Imp'{os="kalle",bool=true}]), + [#'Imp'{os = <<"kalle">>,bool=true}, + #'Imp'{os = <<"kalle">>,bool=true}]), roundtrip('ImpImp', - [#'Imp'{os="kalle",bool=true},#'Imp'{os="kalle",bool=true}]), + [#'Imp'{os = <<"kalle">>,bool=true}, + #'Imp'{os = <<"kalle">>,bool=true}]), roundtrip('ExpImp', - [#'Imp'{os="kalle",bool=true},#'Imp'{os="kalle",bool=true}]), + [#'Imp'{os = <<"kalle">>,bool=true}, + #'Imp'{os = <<"kalle">>,bool=true}]), roundtrip('NTExp', - [#'Exp'{os="kalle",bool=true},#'Exp'{os="kalle",bool=true}]), + [#'Exp'{os = <<"kalle">>,bool=true}, + #'Exp'{os = <<"kalle">>,bool=true}]), roundtrip('ImpExp', - [#'Exp'{os="kalle",bool=true},#'Exp'{os="kalle",bool=true}]), + [#'Exp'{os = <<"kalle">>,bool=true}, + #'Exp'{os = <<"kalle">>,bool=true}]), roundtrip('ExpExp', - [#'Exp'{os="kalle",bool=true},#'Exp'{os="kalle",bool=true}]), + [#'Exp'{os = <<"kalle">>,bool=true}, + #'Exp'{os = <<"kalle">>,bool=true}]), roundtrip('XNTNT', - [#'XSeqNT'{os="kalle",bool=true}, - #'XSeqNT'{os="kalle",bool=true}]), + [#'XSeqNT'{os = <<"kalle">>,bool=true}, + #'XSeqNT'{os = <<"kalle">>,bool=true}]), roundtrip('XImpNT', - [#'XSeqNT'{os="kalle",bool=true}, - #'XSeqNT'{os="kalle",bool=true}]), + [#'XSeqNT'{os = <<"kalle">>,bool=true}, + #'XSeqNT'{os = <<"kalle">>,bool=true}]), roundtrip('XExpNT', - [#'XSeqNT'{os="kalle",bool=true}, - #'XSeqNT'{os="kalle",bool=true}]), + [#'XSeqNT'{os = <<"kalle">>,bool=true}, + #'XSeqNT'{os = <<"kalle">>,bool=true}]), roundtrip('XNTImp', - [#'XSeqImp'{os="kalle",bool=true}, - #'XSeqImp'{os="kalle",bool=true}]), + [#'XSeqImp'{os = <<"kalle">>,bool=true}, + #'XSeqImp'{os = <<"kalle">>,bool=true}]), roundtrip('XImpImp', - [#'XSeqImp'{os="kalle",bool=true}, - #'XSeqImp'{os="kalle",bool=true}]), + [#'XSeqImp'{os = <<"kalle">>,bool=true}, + #'XSeqImp'{os = <<"kalle">>,bool=true}]), roundtrip('XExpImp', - [#'XSeqImp'{os="kalle",bool=true}, - #'XSeqImp'{os="kalle",bool=true}]), + [#'XSeqImp'{os = <<"kalle">>,bool=true}, + #'XSeqImp'{os = <<"kalle">>,bool=true}]), roundtrip('XNTExp', - [#'XSeqExp'{os="kalle",bool=true}, - #'XSeqExp'{os="kalle",bool=true}]), + [#'XSeqExp'{os = <<"kalle">>,bool=true}, + #'XSeqExp'{os = <<"kalle">>,bool=true}]), roundtrip('XImpExp', - [#'XSeqExp'{os="kalle",bool=true}, - #'XSeqExp'{os="kalle",bool=true}]), + [#'XSeqExp'{os = <<"kalle">>,bool=true}, + #'XSeqExp'{os = <<"kalle">>,bool=true}]), roundtrip('XExpExp', - [#'XSeqExp'{os="kalle",bool=true}, - #'XSeqExp'{os="kalle",bool=true}]), + [#'XSeqExp'{os = <<"kalle">>,bool=true}, + #'XSeqExp'{os = <<"kalle">>,bool=true}]), ok. roundtrip(T, V) -> diff --git a/lib/asn1/test/testSeqOfTag.erl b/lib/asn1/test/testSeqOfTag.erl index 38c1dcb90f..f66e29e91d 100644 --- a/lib/asn1/test/testSeqOfTag.erl +++ b/lib/asn1/test/testSeqOfTag.erl @@ -44,47 +44,47 @@ -record('Exp',{os, bool}). main(_Rules) -> - roundtrip('SeqTagNt', #'SeqTagNt'{nt=[#'NT'{os="kalle",bool=true}, - #'NT'{os="kalle",bool=true}]}), - roundtrip('SeqTagNtI', #'SeqTagNtI'{imp=[#'Imp'{os="kalle",bool=true}, - #'Imp'{os="kalle",bool=true}]}), - roundtrip('SeqTagNtE', #'SeqTagNtE'{exp=[#'Exp'{os="kalle",bool=true}, - #'Exp'{os="kalle",bool=true}]}), - roundtrip('SeqTagI', #'SeqTagI'{nt=[#'NT'{os="kalle",bool=true}, - #'NT'{os="kalle",bool=true}]}), - roundtrip('SeqTagII', #'SeqTagII'{imp=[#'Imp'{os="kalle",bool=true}, - #'Imp'{os="kalle",bool=true}]}), - roundtrip('SeqTagIE', #'SeqTagIE'{exp=[#'Exp'{os="kalle",bool=true}, - #'Exp'{os="kalle",bool=true}]}), - roundtrip('SeqTagE', #'SeqTagE'{nt=[#'NT'{os="kalle",bool=true}, - #'NT'{os="kalle",bool=true}]}), - roundtrip('SeqTagEI', #'SeqTagEI'{imp=[#'Imp'{os="kalle",bool=true}, - #'Imp'{os="kalle",bool=true}]}), - roundtrip('SeqTagEE', #'SeqTagEE'{exp=[#'Exp'{os="kalle",bool=true}, - #'Exp'{os="kalle",bool=true}]}), + roundtrip('SeqTagNt', #'SeqTagNt'{nt=[#'NT'{os = <<"kalle">>,bool=true}, + #'NT'{os = <<"kalle">>,bool=true}]}), + roundtrip('SeqTagNtI', #'SeqTagNtI'{imp=[#'Imp'{os = <<"kalle">>,bool=true}, + #'Imp'{os = <<"kalle">>,bool=true}]}), + roundtrip('SeqTagNtE', #'SeqTagNtE'{exp=[#'Exp'{os = <<"kalle">>,bool=true}, + #'Exp'{os = <<"kalle">>,bool=true}]}), + roundtrip('SeqTagI', #'SeqTagI'{nt=[#'NT'{os = <<"kalle">>,bool=true}, + #'NT'{os = <<"kalle">>,bool=true}]}), + roundtrip('SeqTagII', #'SeqTagII'{imp=[#'Imp'{os = <<"kalle">>,bool=true}, + #'Imp'{os = <<"kalle">>,bool=true}]}), + roundtrip('SeqTagIE', #'SeqTagIE'{exp=[#'Exp'{os = <<"kalle">>,bool=true}, + #'Exp'{os = <<"kalle">>,bool=true}]}), + roundtrip('SeqTagE', #'SeqTagE'{nt=[#'NT'{os = <<"kalle">>,bool=true}, + #'NT'{os = <<"kalle">>,bool=true}]}), + roundtrip('SeqTagEI', #'SeqTagEI'{imp=[#'Imp'{os = <<"kalle">>,bool=true}, + #'Imp'{os = <<"kalle">>,bool=true}]}), + roundtrip('SeqTagEE', #'SeqTagEE'{exp=[#'Exp'{os = <<"kalle">>,bool=true}, + #'Exp'{os = <<"kalle">>,bool=true}]}), roundtrip('SeqTagXNt', - #'SeqTagXNt'{xnt=[#'XSeqNT'{os="kalle",bool=true}, - #'XSeqNT'{os="kalle",bool=true}]}), + #'SeqTagXNt'{xnt=[#'XSeqNT'{os = <<"kalle">>,bool=true}, + #'XSeqNT'{os = <<"kalle">>,bool=true}]}), roundtrip('SeqTagXI', - #'SeqTagXI'{ximp=[#'XSeqImp'{os="kalle",bool=true}, - #'XSeqImp'{os="kalle",bool=true}]}), + #'SeqTagXI'{ximp=[#'XSeqImp'{os = <<"kalle">>,bool=true}, + #'XSeqImp'{os = <<"kalle">>,bool=true}]}), roundtrip('SeqTagXE', - #'SeqTagXE'{xexp=[#'XSeqExp'{os="kalle",bool=true}, - #'XSeqExp'{os="kalle",bool=true}]}), + #'SeqTagXE'{xexp=[#'XSeqExp'{os = <<"kalle">>,bool=true}, + #'XSeqExp'{os = <<"kalle">>,bool=true}]}), roundtrip('SeqTagImpX', - #'SeqTagImpX'{xnt=[#'XSeqNT'{os="kalle",bool=true}, - #'XSeqNT'{os="kalle",bool=true}], - ximp=[#'XSeqImp'{os="kalle",bool=true}, - #'XSeqImp'{os="kalle",bool=true}], - xexp=[#'XSeqExp'{os="kalle",bool=true}, - #'XSeqExp'{os="kalle",bool=true}]}), + #'SeqTagImpX'{xnt=[#'XSeqNT'{os = <<"kalle">>,bool=true}, + #'XSeqNT'{os = <<"kalle">>,bool=true}], + ximp=[#'XSeqImp'{os = <<"kalle">>,bool=true}, + #'XSeqImp'{os = <<"kalle">>,bool=true}], + xexp=[#'XSeqExp'{os = <<"kalle">>,bool=true}, + #'XSeqExp'{os = <<"kalle">>,bool=true}]}), roundtrip('SeqTagExpX', - #'SeqTagExpX'{xnt=[#'XSeqNT'{os="kalle",bool=true}, - #'XSeqNT'{os="kalle",bool=true}], - ximp=[#'XSeqImp'{os="kalle",bool=true}, - #'XSeqImp'{os="kalle",bool=true}], - xexp=[#'XSeqExp'{os="kalle",bool=true}, - #'XSeqExp'{os="kalle",bool=true}]}), + #'SeqTagExpX'{xnt=[#'XSeqNT'{os = <<"kalle">>,bool=true}, + #'XSeqNT'{os = <<"kalle">>,bool=true}], + ximp=[#'XSeqImp'{os = <<"kalle">>,bool=true}, + #'XSeqImp'{os = <<"kalle">>,bool=true}], + xexp=[#'XSeqExp'{os = <<"kalle">>,bool=true}, + #'XSeqExp'{os = <<"kalle">>,bool=true}]}), ok. roundtrip(T, V) -> diff --git a/lib/asn1/test/testSeqPrim.erl b/lib/asn1/test/testSeqPrim.erl index 46bac77910..7f3ef86ac5 100644 --- a/lib/asn1/test/testSeqPrim.erl +++ b/lib/asn1/test/testSeqPrim.erl @@ -36,9 +36,9 @@ main(_Rules) -> roundtrip('Seq', #'Seq'{bool=false,boolCon=true,boolPri=false,boolApp=true, boolExpCon=false,boolExpPri=true,boolExpApp=false}), roundtrip('Empty', #'Empty'{}), - roundtrip('Big', #'Big'{os1=lists:duplicate(120, 16#A5), - os2=lists:duplicate(128, 16#A7), - os3=lists:duplicate(17777, 16#F5)}), + roundtrip('Big', #'Big'{os1=list_to_binary(lists:duplicate(120, 16#A5)), + os2=list_to_binary(lists:duplicate(128, 16#A7)), + os3=list_to_binary(lists:duplicate(17777, 16#F5))}), ok. roundtrip(Type, Value) -> diff --git a/lib/asn1/test/testSeqSetDefaultVal.erl b/lib/asn1/test/testSeqSetDefaultVal.erl index 044099199f..79992a0a94 100644 --- a/lib/asn1/test/testSeqSetDefaultVal.erl +++ b/lib/asn1/test/testSeqSetDefaultVal.erl @@ -162,7 +162,7 @@ main(Rule, Opts) -> {#'SeqOS'{}, [{#'SeqOS'.a, [asn1_DEFAULT, - [172]]}]}, + <<172>>]}]}, {#'SeqOI'{}, [{#'SeqOI'.a, @@ -314,17 +314,10 @@ der() -> c=[second], d = <<>>}), roundtrip(<<48,0>>, 'SeqOS', - #'SeqOS'{a=[172],b=[16#A8,16#A0],c='NULL'}), - roundtrip(<<48,0>>, - 'SeqOS', - #'SeqOS'{a=172,b=43168,c='NULL'}, - #'SeqOS'{a=[172],b=[16#A8,16#A0],c='NULL'}), + #'SeqOS'{a = <<172>>,b = <<16#A8,16#A0>>,c='NULL'}), - roundtrip(<<49,0>>, 'SetOS', #'SetOS'{a=[172],b=[16#A8,16#A0],c='NULL'}), - roundtrip(<<49,0>>, - 'SetOS', - #'SetOS'{a=172,b=43168,c='NULL'}, - #'SetOS'{a=[172],b=[16#A8,16#A0],c='NULL'}), + roundtrip(<<49,0>>, 'SetOS', + #'SetOS'{a = <<172>>,b = <<16#A8,16#A0>>,c='NULL'}), roundtrip(<<48,0>>, 'SeqOI', diff --git a/lib/asn1/test/testSeqTag.erl b/lib/asn1/test/testSeqTag.erl index 2f127b3e97..6bacca6808 100644 --- a/lib/asn1/test/testSeqTag.erl +++ b/lib/asn1/test/testSeqTag.erl @@ -35,24 +35,24 @@ -record('Exp',{os, bool}). main(_Rules) -> - roundtrip('SeqTag', #'SeqTag'{nt=#'NT'{os="kalle",bool=true}, - imp=#'Imp'{os="kalle",bool=true}, - exp=#'Exp'{os="kalle",bool=true}}), - roundtrip('SeqTagImp', #'SeqTagImp'{nt=#'NT'{os="kalle",bool=true}, - imp=#'Imp'{os="kalle",bool=true}, - exp=#'Exp'{os="kalle",bool=true}}), - roundtrip('SeqTagExp', #'SeqTagExp'{nt=#'NT'{os="kalle",bool=true}, - imp=#'Imp'{os="kalle",bool=true}, - exp=#'Exp'{os="kalle",bool=true}}), - roundtrip('SeqTagX', #'SeqTagX'{xnt=#'XSeqNT'{os="kalle",bool=true}, - ximp=#'XSeqImp'{os="kalle",bool=true}, - xexp=#'XSeqExp'{os="kalle",bool=true}}), - roundtrip('SeqTagImpX', #'SeqTagImpX'{xnt=#'XSeqNT'{os="kalle",bool=true}, - ximp=#'XSeqImp'{os="kalle",bool=true}, - xexp=#'XSeqExp'{os="kalle",bool=true}}), - roundtrip('SeqTagExpX', #'SeqTagExpX'{xnt=#'XSeqNT'{os="kalle",bool=true}, - ximp=#'XSeqImp'{os="kalle",bool=true}, - xexp=#'XSeqExp'{os="kalle",bool=true}}), + roundtrip('SeqTag', #'SeqTag'{nt=#'NT'{os = <<"kalle">>,bool=true}, + imp=#'Imp'{os = <<"kalle">>,bool=true}, + exp=#'Exp'{os = <<"kalle">>,bool=true}}), + roundtrip('SeqTagImp', #'SeqTagImp'{nt=#'NT'{os = <<"kalle">>,bool=true}, + imp=#'Imp'{os = <<"kalle">>,bool=true}, + exp=#'Exp'{os = <<"kalle">>,bool=true}}), + roundtrip('SeqTagExp', #'SeqTagExp'{nt=#'NT'{os = <<"kalle">>,bool=true}, + imp=#'Imp'{os = <<"kalle">>,bool=true}, + exp=#'Exp'{os = <<"kalle">>,bool=true}}), + roundtrip('SeqTagX', #'SeqTagX'{xnt=#'XSeqNT'{os = <<"kalle">>,bool=true}, + ximp=#'XSeqImp'{os = <<"kalle">>,bool=true}, + xexp=#'XSeqExp'{os = <<"kalle">>,bool=true}}), + roundtrip('SeqTagImpX', #'SeqTagImpX'{xnt=#'XSeqNT'{os = <<"kalle">>,bool=true}, + ximp=#'XSeqImp'{os = <<"kalle">>,bool=true}, + xexp=#'XSeqExp'{os = <<"kalle">>,bool=true}}), + roundtrip('SeqTagExpX', #'SeqTagExpX'{xnt=#'XSeqNT'{os = <<"kalle">>,bool=true}, + ximp=#'XSeqImp'{os = <<"kalle">>,bool=true}, + xexp=#'XSeqExp'{os = <<"kalle">>,bool=true}}), ok. roundtrip(T, V) -> diff --git a/lib/asn1/test/testSeqTypeRefCho.erl b/lib/asn1/test/testSeqTypeRefCho.erl index b008bc46b8..1a921c6f38 100644 --- a/lib/asn1/test/testSeqTypeRefCho.erl +++ b/lib/asn1/test/testSeqTypeRefCho.erl @@ -28,10 +28,10 @@ main(_Rules) -> roundtrip('SeqTRcho', - #'SeqTRcho'{'seqCho' = {choOs,"A string 1"}, - 'seqChoE' = {choOs,"A string 3"}, - 'seqCho-E' = {choOs,"A string 7"}, - 'seqChoE-E' = {choOs,"A string 9"}}), + #'SeqTRcho'{'seqCho' = {choOs,<<"A string 1">>}, + 'seqChoE' = {choOs,<<"A string 3">>}, + 'seqCho-E' = {choOs,<<"A string 7">>}, + 'seqChoE-E' = {choOs,<<"A string 9">>}}), ok. roundtrip(T, V) -> diff --git a/lib/asn1/test/testSeqTypeRefPrim.erl b/lib/asn1/test/testSeqTypeRefPrim.erl index b63882ae99..d66d1ebcfe 100644 --- a/lib/asn1/test/testSeqTypeRefPrim.erl +++ b/lib/asn1/test/testSeqTypeRefPrim.erl @@ -26,15 +26,15 @@ main(_Rules) -> roundtrip('SeqTR', - #'SeqTR'{'octStr' = "A string 1", - 'octStrI' = "A string 2", - 'octStrE' = "A string 3", - 'octStr-I' = "A string 4", - 'octStrI-I' = "A string 5", - 'octStrE-I' = "A string 6", - 'octStr-E' = "A string 7", - 'octStrI-E' = "A string 8", - 'octStrE-E' = "A string 9"}), + #'SeqTR'{'octStr' = <<"A string 1">>, + 'octStrI' = <<"A string 2">>, + 'octStrE' = <<"A string 3">>, + 'octStr-I' = <<"A string 4">>, + 'octStrI-I' = <<"A string 5">>, + 'octStrE-I' = <<"A string 6">>, + 'octStr-E' = <<"A string 7">>, + 'octStrI-E' = <<"A string 8">>, + 'octStrE-E' = <<"A string 9">>}), ok. roundtrip(T, V) -> diff --git a/lib/asn1/test/testSeqTypeRefSeq.erl b/lib/asn1/test/testSeqTypeRefSeq.erl index fc2e0a67c9..3288511f0a 100644 --- a/lib/asn1/test/testSeqTypeRefSeq.erl +++ b/lib/asn1/test/testSeqTypeRefSeq.erl @@ -71,15 +71,15 @@ main(_Rules) -> seqS2=#'SeqSTag_seqS2'{b2=true,i2=22}, seqS3=#'SeqSTag_seqS3'{b3=true,i3=33}}), roundtrip('SeqTRseq', - #'SeqTRseq'{seqSeq=#'SeqSeq'{seqInt=2,seqOs="A1"}, - seqSeqI=#'SeqSeq'{seqInt=2,seqOs="A2"}, - seqSeqE=#'SeqSeq'{seqInt=2,seqOs="A3"}, - 'seqSeq-I'=#'SeqSeqImp'{seqInt=2,seqOs="A4"}, - 'seqSeqI-I'=#'SeqSeqImp'{seqInt=2,seqOs="A5"}, - 'seqSeqE-I'=#'SeqSeqImp'{seqInt=2,seqOs="A6"}, - 'seqSeq-E'=#'SeqSeqExp'{seqInt=2,seqOs="A7"}, - 'seqSeqI-E'=#'SeqSeqExp'{seqInt=2,seqOs="A8"}, - 'seqSeqE-E'=#'SeqSeqExp'{seqInt=2,seqOs="A9"}}), + #'SeqTRseq'{seqSeq=#'SeqSeq'{seqInt=2,seqOs = <<"A1">>}, + seqSeqI=#'SeqSeq'{seqInt=2,seqOs = <<"A2">>}, + seqSeqE=#'SeqSeq'{seqInt=2,seqOs = <<"A3">>}, + 'seqSeq-I'=#'SeqSeqImp'{seqInt=2,seqOs = <<"A4">>}, + 'seqSeqI-I'=#'SeqSeqImp'{seqInt=2,seqOs = <<"A5">>}, + 'seqSeqE-I'=#'SeqSeqImp'{seqInt=2,seqOs = <<"A6">>}, + 'seqSeq-E'=#'SeqSeqExp'{seqInt=2,seqOs = <<"A7">>}, + 'seqSeqI-E'=#'SeqSeqExp'{seqInt=2,seqOs = <<"A8">>}, + 'seqSeqE-E'=#'SeqSeqExp'{seqInt=2,seqOs = <<"A9">>}}), ok. roundtrip(T, V) -> diff --git a/lib/asn1/test/testSeqTypeRefSet.erl b/lib/asn1/test/testSeqTypeRefSet.erl index 911a4b7a47..d73423284b 100644 --- a/lib/asn1/test/testSeqTypeRefSet.erl +++ b/lib/asn1/test/testSeqTypeRefSet.erl @@ -32,15 +32,15 @@ main(_Rules) -> roundtrip('SeqTRset', - #'SeqTRset'{seqSet=#'SeqSet'{setInt=2,setOs="A1"}, - seqSetI=#'SeqSet'{setInt=2,setOs="A2"}, - seqSetE=#'SeqSet'{setInt=2,setOs="A3"}, - 'seqSet-I'=#'SeqSetImp'{setInt=2,setOs="A4"}, - 'seqSetI-I'=#'SeqSetImp'{setInt=2,setOs="A5"}, - 'seqSetE-I'=#'SeqSetImp'{setInt=2,setOs="A6"}, - 'seqSet-E'=#'SeqSetExp'{setInt=2,setOs="A7"}, - 'seqSetI-E'=#'SeqSetExp'{setInt=2,setOs="A8"}, - 'seqSetE-E'=#'SeqSetExp'{setInt=2,setOs="A9"}}), + #'SeqTRset'{seqSet=#'SeqSet'{setInt=2,setOs = <<"A1">>}, + seqSetI=#'SeqSet'{setInt=2,setOs = <<"A2">>}, + seqSetE=#'SeqSet'{setInt=2,setOs = <<"A3">>}, + 'seqSet-I'=#'SeqSetImp'{setInt=2,setOs = <<"A4">>}, + 'seqSetI-I'=#'SeqSetImp'{setInt=2,setOs = <<"A5">>}, + 'seqSetE-I'=#'SeqSetImp'{setInt=2,setOs = <<"A6">>}, + 'seqSet-E'=#'SeqSetExp'{setInt=2,setOs = <<"A7">>}, + 'seqSetI-E'=#'SeqSetExp'{setInt=2,setOs = <<"A8">>}, + 'seqSetE-E'=#'SeqSetExp'{setInt=2,setOs = <<"A9">>}}), ok. roundtrip(T, V) -> diff --git a/lib/asn1/test/testSetExternal.erl b/lib/asn1/test/testSetExternal.erl index e17d7053aa..626adc5822 100644 --- a/lib/asn1/test/testSetExternal.erl +++ b/lib/asn1/test/testSetExternal.erl @@ -28,15 +28,15 @@ -record('SetXSeq3',{bool, int, seq}). main(_Rules) -> - roundtrip('XNTNT', #'XSetNT'{os="kalle",bool=true}), - roundtrip('XImpNT', #'XSetNT'{os="kalle",bool=true}), - roundtrip('XExpNT', #'XSetNT'{os="kalle",bool=true}), - roundtrip('XNTImp', #'XSetImp'{os="kalle",bool=true}), - roundtrip('XImpImp', #'XSetImp'{os="kalle",bool=true}), - roundtrip('XExpImp', #'XSetImp'{os="kalle",bool=true}), - roundtrip('XNTExp', #'XSetExp'{os="kalle",bool=true}), - roundtrip('XImpExp', #'XSetExp'{os="kalle",bool=true}), - roundtrip('XExpExp', #'XSetExp'{os="kalle",bool=true}), + roundtrip('XNTNT', #'XSetNT'{os = <<"kalle">>,bool=true}), + roundtrip('XImpNT', #'XSetNT'{os = <<"kalle">>,bool=true}), + roundtrip('XExpNT', #'XSetNT'{os = <<"kalle">>,bool=true}), + roundtrip('XNTImp', #'XSetImp'{os = <<"kalle">>,bool=true}), + roundtrip('XImpImp', #'XSetImp'{os = <<"kalle">>,bool=true}), + roundtrip('XExpImp', #'XSetImp'{os = <<"kalle">>,bool=true}), + roundtrip('XNTExp', #'XSetExp'{os = <<"kalle">>,bool=true}), + roundtrip('XImpExp', #'XSetExp'{os = <<"kalle">>,bool=true}), + roundtrip('XExpExp', #'XSetExp'{os = <<"kalle">>,bool=true}), roundtrip('SetXSeq1', #'SetXSeq1'{seq=#'XSeq1'{bool1=true,int1=77, seq1=#'XSeqIn'{boolIn=false,intIn=88}}, bool=true,int=66}), diff --git a/lib/asn1/test/testSetOf.erl b/lib/asn1/test/testSetOf.erl index 54c42c1f21..0f82a14625 100644 --- a/lib/asn1/test/testSetOf.erl +++ b/lib/asn1/test/testSetOf.erl @@ -121,9 +121,9 @@ main(_Rules) -> #'SetIn'{boolIn=false,intIn=125}, #'SetIn'{boolIn=false,intIn=225}]}), - roundtrip('SetOs', ["First","Second","Third"]), - roundtrip('SetOsImp', ["First","Second","Third"]), - roundtrip('SetOsExp', ["First","Second","Third"]), + roundtrip('SetOs', [<<"First">>,<<"Second">>,<<"Third">>]), + roundtrip('SetOsImp', [<<"First">>,<<"Second">>,<<"Third">>]), + roundtrip('SetOsExp', [<<"First">>,<<"Second">>,<<"Third">>]), roundtrip('SetEmp', #'SetEmp'{set1=[#'Empty'{}]}), ok. diff --git a/lib/asn1/test/testSetOfExternal.erl b/lib/asn1/test/testSetOfExternal.erl index a380ba5ac1..cc5fe10710 100644 --- a/lib/asn1/test/testSetOfExternal.erl +++ b/lib/asn1/test/testSetOfExternal.erl @@ -28,24 +28,42 @@ -record('Exp',{os, bool}). main(_Rules) -> - roundtrip('NTNT', [#'NT'{os="kalle",bool=true},#'NT'{os="kalle",bool=true}]), - roundtrip('ImpNT', [#'NT'{os="kalle",bool=true},#'NT'{os="kalle",bool=true}]), - roundtrip('ExpNT', [#'NT'{os="kalle",bool=true},#'NT'{os="kalle",bool=true}]), - roundtrip('NTImp', [#'Imp'{os="kalle",bool=true},#'Imp'{os="kalle",bool=true}]), - roundtrip('ImpImp', [#'Imp'{os="kalle",bool=true},#'Imp'{os="kalle",bool=true}]), - roundtrip('ExpImp', [#'Imp'{os="kalle",bool=true},#'Imp'{os="kalle",bool=true}]), - roundtrip('NTExp', [#'Exp'{os="kalle",bool=true},#'Exp'{os="kalle",bool=true}]), - roundtrip('ImpExp', [#'Exp'{os="kalle",bool=true},#'Exp'{os="kalle",bool=true}]), - roundtrip('ExpExp', [#'Exp'{os="kalle",bool=true},#'Exp'{os="kalle",bool=true}]), - roundtrip('XNTNT', [#'XSetNT'{os="kalle",bool=true},#'XSetNT'{os="kalle",bool=true}]), - roundtrip('XImpNT', [#'XSetNT'{os="kalle",bool=true},#'XSetNT'{os="kalle",bool=true}]), - roundtrip('XExpNT', [#'XSetNT'{os="kalle",bool=true},#'XSetNT'{os="kalle",bool=true}]), - roundtrip('XNTImp', [#'XSetImp'{os="kalle",bool=true},#'XSetImp'{os="kalle",bool=true}]), - roundtrip('XImpImp', [#'XSetImp'{os="kalle",bool=true},#'XSetImp'{os="kalle",bool=true}]), - roundtrip('XExpImp', [#'XSetImp'{os="kalle",bool=true},#'XSetImp'{os="kalle",bool=true}]), - roundtrip('XNTExp', [#'XSetExp'{os="kalle",bool=true},#'XSetExp'{os="kalle",bool=true}]), - roundtrip('XImpExp', [#'XSetExp'{os="kalle",bool=true},#'XSetExp'{os="kalle",bool=true}]), - roundtrip('XExpExp', [#'XSetExp'{os="kalle",bool=true},#'XSetExp'{os="kalle",bool=true}]), + roundtrip('NTNT', [#'NT'{os = <<"kalle">>,bool=true}, + #'NT'{os = <<"kalle">>,bool=true}]), + roundtrip('ImpNT', [#'NT'{os = <<"kalle">>,bool=true}, + #'NT'{os = <<"kalle">>,bool=true}]), + roundtrip('ExpNT', [#'NT'{os = <<"kalle">>,bool=true}, + #'NT'{os = <<"kalle">>,bool=true}]), + roundtrip('NTImp', [#'Imp'{os = <<"kalle">>,bool=true}, + #'Imp'{os = <<"kalle">>,bool=true}]), + roundtrip('ImpImp', [#'Imp'{os = <<"kalle">>,bool=true}, + #'Imp'{os = <<"kalle">>,bool=true}]), + roundtrip('ExpImp', [#'Imp'{os = <<"kalle">>,bool=true}, + #'Imp'{os = <<"kalle">>,bool=true}]), + roundtrip('NTExp', [#'Exp'{os = <<"kalle">>,bool=true}, + #'Exp'{os = <<"kalle">>,bool=true}]), + roundtrip('ImpExp', [#'Exp'{os = <<"kalle">>,bool=true}, + #'Exp'{os = <<"kalle">>,bool=true}]), + roundtrip('ExpExp', [#'Exp'{os = <<"kalle">>,bool=true}, + #'Exp'{os = <<"kalle">>,bool=true}]), + roundtrip('XNTNT', [#'XSetNT'{os = <<"kalle">>,bool=true}, + #'XSetNT'{os = <<"kalle">>,bool=true}]), + roundtrip('XImpNT', [#'XSetNT'{os = <<"kalle">>,bool=true}, + #'XSetNT'{os = <<"kalle">>,bool=true}]), + roundtrip('XExpNT', [#'XSetNT'{os = <<"kalle">>,bool=true}, + #'XSetNT'{os = <<"kalle">>,bool=true}]), + roundtrip('XNTImp', [#'XSetImp'{os = <<"kalle">>,bool=true}, + #'XSetImp'{os = <<"kalle">>,bool=true}]), + roundtrip('XImpImp', [#'XSetImp'{os = <<"kalle">>,bool=true}, + #'XSetImp'{os = <<"kalle">>,bool=true}]), + roundtrip('XExpImp', [#'XSetImp'{os = <<"kalle">>,bool=true}, + #'XSetImp'{os = <<"kalle">>,bool=true}]), + roundtrip('XNTExp', [#'XSetExp'{os = <<"kalle">>,bool=true}, + #'XSetExp'{os = <<"kalle">>,bool=true}]), + roundtrip('XImpExp', [#'XSetExp'{os = <<"kalle">>,bool=true}, + #'XSetExp'{os = <<"kalle">>,bool=true}]), + roundtrip('XExpExp', [#'XSetExp'{os = <<"kalle">>,bool=true}, + #'XSetExp'{os = <<"kalle">>,bool=true}]), ok. roundtrip(T, V) -> diff --git a/lib/asn1/test/testSetOfTag.erl b/lib/asn1/test/testSetOfTag.erl index 81bc467abb..0d656f05a6 100644 --- a/lib/asn1/test/testSetOfTag.erl +++ b/lib/asn1/test/testSetOfTag.erl @@ -42,42 +42,42 @@ -record('Exp',{os, bool}). main(_Rules) -> - roundtrip('SetTagNt', #'SetTagNt'{nt=[#'NT'{os="kalle",bool=true}, - #'NT'{os="kalle",bool=true}]}), - roundtrip('SetTagNtI', #'SetTagNtI'{imp=[#'Imp'{os="kalle",bool=true}, - #'Imp'{os="kalle",bool=true}]}), - roundtrip('SetTagNtE', #'SetTagNtE'{exp=[#'Exp'{os="kalle",bool=true}, - #'Exp'{os="kalle",bool=true}]}), - roundtrip('SetTagI', #'SetTagI'{nt=[#'NT'{os="kalle",bool=true}, - #'NT'{os="kalle",bool=true}]}), - roundtrip('SetTagII', #'SetTagII'{imp=[#'Imp'{os="kalle",bool=true}, - #'Imp'{os="kalle",bool=true}]}), - roundtrip('SetTagIE', #'SetTagIE'{exp=[#'Exp'{os="kalle",bool=true}, - #'Exp'{os="kalle",bool=true}]}), - roundtrip('SetTagE', #'SetTagE'{nt=[#'NT'{os="kalle",bool=true}, - #'NT'{os="kalle",bool=true}]}), - roundtrip('SetTagEI', #'SetTagEI'{imp=[#'Imp'{os="kalle",bool=true}, - #'Imp'{os="kalle",bool=true}]}), - roundtrip('SetTagEE', #'SetTagEE'{exp=[#'Exp'{os="kalle",bool=true}, - #'Exp'{os="kalle",bool=true}]}), - roundtrip('SetTagXNt', #'SetTagXNt'{xnt=[#'XSetNT'{os="kalle",bool=true}, - #'XSetNT'{os="kalle",bool=true}]}), - roundtrip('SetTagXI', #'SetTagXI'{ximp=[#'XSetImp'{os="kalle",bool=true}, - #'XSetImp'{os="kalle",bool=true}]}), - roundtrip('SetTagXE', #'SetTagXE'{xexp=[#'XSetExp'{os="kalle",bool=true}, - #'XSetExp'{os="kalle",bool=true}]}), - roundtrip('SetTagImpX', #'SetTagImpX'{xnt=[#'XSetNT'{os="kalle",bool=true}, - #'XSetNT'{os="kalle",bool=true}], - ximp=[#'XSetImp'{os="kalle",bool=true}, - #'XSetImp'{os="kalle",bool=true}], - xexp=[#'XSetExp'{os="kalle",bool=true}, - #'XSetExp'{os="kalle",bool=true}]}), - roundtrip('SetTagExpX', #'SetTagExpX'{xnt=[#'XSetNT'{os="kalle",bool=true}, - #'XSetNT'{os="kalle",bool=true}], - ximp=[#'XSetImp'{os="kalle",bool=true}, - #'XSetImp'{os="kalle",bool=true}], - xexp=[#'XSetExp'{os="kalle",bool=true}, - #'XSetExp'{os="kalle",bool=true}]}), + roundtrip('SetTagNt', #'SetTagNt'{nt=[#'NT'{os = <<"kalle">>,bool=true}, + #'NT'{os = <<"kalle">>,bool=true}]}), + roundtrip('SetTagNtI', #'SetTagNtI'{imp=[#'Imp'{os = <<"kalle">>,bool=true}, + #'Imp'{os = <<"kalle">>,bool=true}]}), + roundtrip('SetTagNtE', #'SetTagNtE'{exp=[#'Exp'{os = <<"kalle">>,bool=true}, + #'Exp'{os = <<"kalle">>,bool=true}]}), + roundtrip('SetTagI', #'SetTagI'{nt=[#'NT'{os = <<"kalle">>,bool=true}, + #'NT'{os = <<"kalle">>,bool=true}]}), + roundtrip('SetTagII', #'SetTagII'{imp=[#'Imp'{os = <<"kalle">>,bool=true}, + #'Imp'{os = <<"kalle">>,bool=true}]}), + roundtrip('SetTagIE', #'SetTagIE'{exp=[#'Exp'{os = <<"kalle">>,bool=true}, + #'Exp'{os = <<"kalle">>,bool=true}]}), + roundtrip('SetTagE', #'SetTagE'{nt=[#'NT'{os = <<"kalle">>,bool=true}, + #'NT'{os = <<"kalle">>,bool=true}]}), + roundtrip('SetTagEI', #'SetTagEI'{imp=[#'Imp'{os = <<"kalle">>,bool=true}, + #'Imp'{os = <<"kalle">>,bool=true}]}), + roundtrip('SetTagEE', #'SetTagEE'{exp=[#'Exp'{os = <<"kalle">>,bool=true}, + #'Exp'{os = <<"kalle">>,bool=true}]}), + roundtrip('SetTagXNt', #'SetTagXNt'{xnt=[#'XSetNT'{os = <<"kalle">>,bool=true}, + #'XSetNT'{os = <<"kalle">>,bool=true}]}), + roundtrip('SetTagXI', #'SetTagXI'{ximp=[#'XSetImp'{os = <<"kalle">>,bool=true}, + #'XSetImp'{os = <<"kalle">>,bool=true}]}), + roundtrip('SetTagXE', #'SetTagXE'{xexp=[#'XSetExp'{os = <<"kalle">>,bool=true}, + #'XSetExp'{os = <<"kalle">>,bool=true}]}), + roundtrip('SetTagImpX', #'SetTagImpX'{xnt=[#'XSetNT'{os = <<"kalle">>,bool=true}, + #'XSetNT'{os = <<"kalle">>,bool=true}], + ximp=[#'XSetImp'{os = <<"kalle">>,bool=true}, + #'XSetImp'{os = <<"kalle">>,bool=true}], + xexp=[#'XSetExp'{os = <<"kalle">>,bool=true}, + #'XSetExp'{os = <<"kalle">>,bool=true}]}), + roundtrip('SetTagExpX', #'SetTagExpX'{xnt=[#'XSetNT'{os = <<"kalle">>,bool=true}, + #'XSetNT'{os = <<"kalle">>,bool=true}], + ximp=[#'XSetImp'{os = <<"kalle">>,bool=true}, + #'XSetImp'{os = <<"kalle">>,bool=true}], + xexp=[#'XSetExp'{os = <<"kalle">>,bool=true}, + #'XSetExp'{os = <<"kalle">>,bool=true}]}), ok. roundtrip(T, V) -> diff --git a/lib/asn1/test/testSetTag.erl b/lib/asn1/test/testSetTag.erl index 5863a149b9..fa1d84f50d 100644 --- a/lib/asn1/test/testSetTag.erl +++ b/lib/asn1/test/testSetTag.erl @@ -34,24 +34,24 @@ -record('Exp',{os, bool}). main(_Rules) -> - roundtrip('SetTag', #'SetTag'{nt=#'NT'{os="kalle",bool=true}, - imp=#'Imp'{os="kalle",bool=true}, - exp=#'Exp'{os="kalle",bool=true}}), - roundtrip('SetTagImp', #'SetTagImp'{nt=#'NT'{os="kalle",bool=true}, - imp=#'Imp'{os="kalle",bool=true}, - exp=#'Exp'{os="kalle",bool=true}}), - roundtrip('SetTagExp', #'SetTagExp'{nt=#'NT'{os="kalle",bool=true}, - imp=#'Imp'{os="kalle",bool=true}, - exp=#'Exp'{os="kalle",bool=true}}), - roundtrip('SetTagX', #'SetTagX'{xnt=#'XSetNT'{os="kalle",bool=true}, - ximp=#'XSetImp'{os="kalle",bool=true}, - xexp=#'XSetExp'{os="kalle",bool=true}}), - roundtrip('SetTagImpX', #'SetTagImpX'{xnt=#'XSetNT'{os="kalle",bool=true}, - ximp=#'XSetImp'{os="kalle",bool=true}, - xexp=#'XSetExp'{os="kalle",bool=true}}), - roundtrip('SetTagExpX', #'SetTagExpX'{xnt=#'XSetNT'{os="kalle",bool=true}, - ximp=#'XSetImp'{os="kalle",bool=true}, - xexp=#'XSetExp'{os="kalle",bool=true}}), + roundtrip('SetTag', #'SetTag'{nt=#'NT'{os = <<"kalle">>,bool=true}, + imp=#'Imp'{os = <<"kalle">>,bool=true}, + exp=#'Exp'{os = <<"kalle">>,bool=true}}), + roundtrip('SetTagImp', #'SetTagImp'{nt=#'NT'{os = <<"kalle">>,bool=true}, + imp=#'Imp'{os = <<"kalle">>,bool=true}, + exp=#'Exp'{os = <<"kalle">>,bool=true}}), + roundtrip('SetTagExp', #'SetTagExp'{nt=#'NT'{os = <<"kalle">>,bool=true}, + imp=#'Imp'{os = <<"kalle">>,bool=true}, + exp=#'Exp'{os = <<"kalle">>,bool=true}}), + roundtrip('SetTagX', #'SetTagX'{xnt=#'XSetNT'{os = <<"kalle">>,bool=true}, + ximp=#'XSetImp'{os = <<"kalle">>,bool=true}, + xexp=#'XSetExp'{os = <<"kalle">>,bool=true}}), + roundtrip('SetTagImpX', #'SetTagImpX'{xnt=#'XSetNT'{os = <<"kalle">>,bool=true}, + ximp=#'XSetImp'{os = <<"kalle">>,bool=true}, + xexp=#'XSetExp'{os = <<"kalle">>,bool=true}}), + roundtrip('SetTagExpX', #'SetTagExpX'{xnt=#'XSetNT'{os = <<"kalle">>,bool=true}, + ximp=#'XSetImp'{os = <<"kalle">>,bool=true}, + xexp=#'XSetExp'{os = <<"kalle">>,bool=true}}), ok. roundtrip(T, V) -> diff --git a/lib/asn1/test/testSetTypeRefCho.erl b/lib/asn1/test/testSetTypeRefCho.erl index 8d62f45bfa..97bbd557e0 100644 --- a/lib/asn1/test/testSetTypeRefCho.erl +++ b/lib/asn1/test/testSetTypeRefCho.erl @@ -29,10 +29,10 @@ main(_Rules) -> roundtrip('SetTRcho', - #'SetTRcho'{'setCho' = {choOs,"A string 1"}, - 'setChoE' = {choOs,"A string 3"}, - 'setCho-E' = {choOs,"A string 7"}, - 'setChoE-E' = {choOs,"A string 9"}}), + #'SetTRcho'{'setCho' = {choOs,<<"A string 1">>}, + 'setChoE' = {choOs,<<"A string 3">>}, + 'setCho-E' = {choOs,<<"A string 7">>}, + 'setChoE-E' = {choOs,<<"A string 9">>}}), ok. roundtrip(T, V) -> diff --git a/lib/asn1/test/testSetTypeRefPrim.erl b/lib/asn1/test/testSetTypeRefPrim.erl index cc2e157e68..d441fb789d 100644 --- a/lib/asn1/test/testSetTypeRefPrim.erl +++ b/lib/asn1/test/testSetTypeRefPrim.erl @@ -28,15 +28,15 @@ main(_Rules) -> roundtrip('SetTR', - #'SetTR'{'octStr' = "A string 1", - 'octStrI' = "A string 2", - 'octStrE' = "A string 3", - 'octStr-I' = "A string 4", - 'octStrI-I' = "A string 5", - 'octStrE-I' = "A string 6", - 'octStr-E' = "A string 7", - 'octStrI-E' = "A string 8", - 'octStrE-E' = "A string 9"}), + #'SetTR'{'octStr' = <<"A string 1">>, + 'octStrI' = <<"A string 2">>, + 'octStrE' = <<"A string 3">>, + 'octStr-I' = <<"A string 4">>, + 'octStrI-I' = <<"A string 5">>, + 'octStrE-I' = <<"A string 6">>, + 'octStr-E' = <<"A string 7">>, + 'octStrI-E' = <<"A string 8">>, + 'octStrE-E' = <<"A string 9">>}), ok. roundtrip(T, V) -> diff --git a/lib/asn1/test/testSetTypeRefSeq.erl b/lib/asn1/test/testSetTypeRefSeq.erl index 17af5c2922..a2b5f5745e 100644 --- a/lib/asn1/test/testSetTypeRefSeq.erl +++ b/lib/asn1/test/testSetTypeRefSeq.erl @@ -30,23 +30,23 @@ main(_Rules) -> roundtrip('SetTRseq', - #'SetTRseq'{'setSeq' = #'SetSeq'{seqOs = "A1", + #'SetTRseq'{'setSeq' = #'SetSeq'{seqOs = <<"A1">>, seqInt = 2}, - 'setSeqI' = #'SetSeq'{seqOs = "A2", + 'setSeqI' = #'SetSeq'{seqOs = <<"A2">>, seqInt = 2}, - 'setSeqE' = #'SetSeq'{seqOs = "A3", + 'setSeqE' = #'SetSeq'{seqOs = <<"A3">>, seqInt = 2}, - 'setSeq-I' = #'SetSeqImp'{seqOs = "A4", + 'setSeq-I' = #'SetSeqImp'{seqOs = <<"A4">>, seqInt = 2}, - 'setSeqI-I' = #'SetSeqImp'{seqOs = "A5", + 'setSeqI-I' = #'SetSeqImp'{seqOs = <<"A5">>, seqInt = 2}, - 'setSeqE-I' = #'SetSeqImp'{seqOs = "A6", + 'setSeqE-I' = #'SetSeqImp'{seqOs = <<"A6">>, seqInt = 2}, - 'setSeq-E' = #'SetSeqExp'{seqOs = "A7", + 'setSeq-E' = #'SetSeqExp'{seqOs = <<"A7">>, seqInt = 2}, - 'setSeqI-E' = #'SetSeqExp'{seqOs = "A8", + 'setSeqI-E' = #'SetSeqExp'{seqOs = <<"A8">>, seqInt = 2}, - 'setSeqE-E' = #'SetSeqExp'{seqOs = "A9", + 'setSeqE-E' = #'SetSeqExp'{seqOs = <<"A9">>, seqInt = 2}}), ok. diff --git a/lib/asn1/test/testSetTypeRefSet.erl b/lib/asn1/test/testSetTypeRefSet.erl index 8786e0fb4d..80a6be58c9 100644 --- a/lib/asn1/test/testSetTypeRefSet.erl +++ b/lib/asn1/test/testSetTypeRefSet.erl @@ -71,15 +71,15 @@ main(_Rules) -> setS2=#'SetSTag_setS2'{b2=true,i2=22}, setS3=#'SetSTag_setS3'{b3=true,i3=33}}), roundtrip('SetTRset', - #'SetTRset'{setSet=#'SetSet'{setInt=2,setOs="A1"}, - setSetI=#'SetSet'{setInt=2,setOs="A2"}, - setSetE=#'SetSet'{setInt=2,setOs="A3"}, - 'setSet-I'=#'SetSetImp'{setInt=2,setOs="A4"}, - 'setSetI-I'=#'SetSetImp'{setInt=2,setOs="A5"}, - 'setSetE-I'=#'SetSetImp'{setInt=2,setOs="A6"}, - 'setSet-E'=#'SetSetExp'{setInt=2,setOs="A7"}, - 'setSetI-E'=#'SetSetExp'{setInt=2,setOs="A8"}, - 'setSetE-E'=#'SetSetExp'{setInt=2,setOs="A9"}}), + #'SetTRset'{setSet=#'SetSet'{setInt=2,setOs = <<"A1">>}, + setSetI=#'SetSet'{setInt=2,setOs = <<"A2">>}, + setSetE=#'SetSet'{setInt=2,setOs = <<"A3">>}, + 'setSet-I'=#'SetSetImp'{setInt=2,setOs = <<"A4">>}, + 'setSetI-I'=#'SetSetImp'{setInt=2,setOs = <<"A5">>}, + 'setSetE-I'=#'SetSetImp'{setInt=2,setOs = <<"A6">>}, + 'setSet-E'=#'SetSetExp'{setInt=2,setOs = <<"A7">>}, + 'setSetI-E'=#'SetSetExp'{setInt=2,setOs = <<"A8">>}, + 'setSetE-E'=#'SetSetExp'{setInt=2,setOs = <<"A9">>}}), ok. diff --git a/lib/asn1/test/testTimer.erl b/lib/asn1/test/testTimer.erl index 9f1b775226..89bc2b463d 100644 --- a/lib/asn1/test/testTimer.erl +++ b/lib/asn1/test/testTimer.erl @@ -32,97 +32,97 @@ val() -> {'EndpointType', {'NonStandardParameter', {object,{0,9,237}}, - "O"}, + <<"O">>}, {'VendorIdentifier', {'H221NonStandard',62,63,16282}, - "OC", - "OC"}, + <<"OC">>, + <<"OC">>}, {'GatekeeperInfo', {'NonStandardParameter', {object,{0,10,260}}, - "O"}}, + <<"O">>}}, {'GatewayInfo', [{h320, {'H320Caps', {'NonStandardParameter', {object,{0,11,282}}, - "O"}, + <<"O">>}, [{'DataRate', {'NonStandardParameter', {object, {0,11,295}}, - "O"}, + <<"O">>}, 1290470518, 78}], [{'SupportedPrefix', {'NonStandardParameter', {object, {0,12,312}}, - "O"}, + <<"O">>}, {'h323-ID',"BM"}}]}}], {'NonStandardParameter', {object,{0,13,326}}, - "O"}}, + <<"O">>}}, {'McuInfo', {'NonStandardParameter', {object,{1,13,340,340}}, - "OC"}}, + <<"OC">>}}, {'TerminalInfo', {'NonStandardParameter', {object,{1,14,353,354}}, - "OC"}}, + <<"OC">>}}, true, true}, {ipxAddress, {'TransportAddress_ipxAddress', - "OCTET ", - "OCTE", - "OC"}}, - {'CallIdentifier',"OCTET STRINGOCTE"}, + <<"OCTET ">>, + <<"OCTE">>, + <<"OC">>}}, + {'CallIdentifier',<<"OCTET STRINGOCTE">>}, {noSecurity,'NULL'}, [{'ClearToken', 1667517741, "BM", {'DHset',<<1:1>>,<<1:1>>,<<1:1>>}, - "OCTET STR", + <<"OCTET STR">>, -26430296, {'TypedCertificate', {1,16,405,406}, - "OC"}, + <<"OC">>}, "BMP", {'NonStandardParameter', {1,16,414,415}, - "OC"}}, + <<"OC">>}}, {'ClearToken', 1817656756, "BMP", {'DHset',<<1:1>>,<<1:1>>,<<1:1>>}, - "OCTET STRI", + <<"OCTET STRI">>, -16356110, {'TypedCertificate', {1,17,442,443}, - "OC"}, + <<"OC">>}, "BMP", {'NonStandardParameter', {1,18,452,452}, - "OC"}}], + <<"OC">>}}], [{cryptoGKPwdEncr, {'CryptoH323Token_cryptoGKPwdEncr', {1,18,467,467}, - {'Params',-7477016,"OCTET ST"}, - "OC"}}, + {'Params',-7477016,<<"OCTET ST">>}, + <<"OC">>}}, {cryptoGKPwdEncr, {'CryptoH323Token_cryptoGKPwdEncr', {1,19,486,486}, - {'Params',-2404513,"OCTET ST"}, - []}}], + {'Params',-2404513,<<"OCTET ST">>}, + <<>>}}], []}}, - {'NonStandardParameter',{object,{0,3,84}},[]}, + {'NonStandardParameter',{object,{0,3,84}},<<>>}, [], true, [], []}, - {'H323-UserInformation_user-data',24,"O"}}. + {'H323-UserInformation_user-data',24,<<"O">>}}. go() -> diff --git a/lib/asn1/test/testTypeValueNotation.erl b/lib/asn1/test/testTypeValueNotation.erl index b46d7177f5..2b5f3f74c1 100644 --- a/lib/asn1/test/testTypeValueNotation.erl +++ b/lib/asn1/test/testTypeValueNotation.erl @@ -24,7 +24,7 @@ -record('Seq', {octstr, int, bool, enum, bitstr, null, oid, vstr}). main(_Rule, _Option) -> - Value = #'Seq'{octstr = [1, 2, 3, 4], + Value = #'Seq'{octstr = <<1,2,3,4>>, int = 12, bool = true, enum = a, diff --git a/lib/megaco/src/binary/depend.mk b/lib/megaco/src/binary/depend.mk index b9b86d3183..4225bc69dc 100644 --- a/lib/megaco/src/binary/depend.mk +++ b/lib/megaco/src/binary/depend.mk @@ -28,7 +28,7 @@ # This means that the ASN.1 runtime library will be inlined. # -ASN1_CT_OPTS += +noobj +ASN1_CT_OPTS += +noobj +legacy_erlang_types ifeq ($(MEGACO_INLINE_ASN1_RT),true) # We need atleast version 1.4.6 of the ANS.1 application ASN1_CT_OPTS += +inline |