From 078a3a2ffc64572dc6483cc00c9e772c268e103e Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Fri, 23 Oct 2015 10:27:10 +0200 Subject: Recompile with a new version (18) --- ACSE-1.erl | 2394 +++-- ACSE-1.hrl | 6 +- CSTA-application-context-information-csta3.erl | 1178 ++- CSTA-application-context-information-csta3.hrl | 6 +- KME-specific-types.erl | 11488 +++++++++++++---------- KME-specific-types.hrl | 6 +- 6 files changed, 8422 insertions(+), 6656 deletions(-) diff --git a/ACSE-1.erl b/ACSE-1.erl index 86fec8b..f543e7f 100644 --- a/ACSE-1.erl +++ b/ACSE-1.erl @@ -1,14 +1,22 @@ -%% Generated by the Erlang ASN.1 BER-compiler version:1.7 +%% Generated by the Erlang ASN.1 BER_V2-compiler version, utilizing bit-syntax:4.0 %% Purpose: encoder and decoder to the types in mod ACSE-1 -module('ACSE-1'). +-compile(nowarn_unused_vars). -include("ACSE-1.hrl"). --define('RT_BER',asn1rt_ber_bin). --asn1_info([{vsn,'1.7'}, +-asn1_info([{vsn,'4.0'}, {module,'ACSE-1'}, - {options,[{i,[47,104,111,109,101,47,113,117,97,120,47,101,114,108,47,97,115,110]},warnings,ber,errors,{cwd,[47,104,111,109,101,47,113,117,97,120,47,101,114,108,47,97,115,110]},{outdir,[47,104,111,109,101,47,113,117,97,120,47,101,114,108,47,97,115,110]},{i,[46]},{i,[47,104,111,109,101,47,113,117,97,120,47,101,114,108,47,97,115,110,47,97,99,115,101]}]}]). - --export([encoding_rule/0]). + {options,[{i,"/Users/quax/erl"}, + warnings,ber,errors, + {cwd,"/Users/quax/erl"}, + {outdir,"/Users/quax/erl"}, + {i,"/Users/quax/erl/acse"}, + {i,"/Users/quax/erl/csta"}, + {i,"."}]}]). + +-export([encoding_rule/0,bit_string_format/0, + legacy_erlang_types/0]). +-export(['dialyzer-suppressions'/1]). -export([ 'enc_ACSE-apdu'/2, 'enc_AARQ-apdu'/2, @@ -77,1142 +85,1166 @@ 'dec_EXTERNAL'/2 ]). --export([ -'dec_ACSE-apdu'/3, -'dec_AARQ-apdu'/3, -'dec_AARE-apdu'/3, -'dec_RLRQ-apdu'/3, -'dec_RLRE-apdu'/3, -'dec_ABRT-apdu'/3, -'dec_ABRT-diagnostic'/3, -'dec_ABRT-source'/3, -'dec_ACSE-requirements'/3, -'dec_Application-context-name-list'/3, -'dec_Application-context-name'/3, -'dec_AP-title'/3, -'dec_AE-qualifier'/3, -'dec_AP-title-form1'/3, -'dec_AE-qualifier-form1'/3, -'dec_AP-title-form2'/3, -'dec_AE-qualifier-form2'/3, -'dec_AE-title'/3, -'dec_AE-title-form1'/3, -'dec_AE-title-form2'/3, -'dec_AE-invocation-identifier'/3, -'dec_AP-invocation-identifier'/3, -'dec_Associate-result'/3, -'dec_Associate-source-diagnostic'/3, -'dec_Association-information'/3, -'dec_Authentication-value'/3, -'dec_Implementation-data'/3, -'dec_Mechanism-name'/3, -'dec_Release-request-reason'/3, -'dec_Release-response-reason'/3, -'dec_EXTERNAL'/3 -]). - -export([ 'acse-as-id'/0, 'aCSE-id'/0 ]). -export([ -'getenc_ObjectSet'/2 +'getenc_ObjectSet'/1 ]). -export([ -'getdec_ObjectSet'/2 +'getdec_ObjectSet'/1 ]). -export([info/0]). --export([encode/2,decode/2,encode_disp/2,decode_disp/2]). +-export([encode/2,decode/2]). + +encoding_rule() -> ber. -encoding_rule() -> - ber. +bit_string_format() -> bitstring. -encode(Type,Data) -> -case catch encode_disp(Type,Data) of - {'EXIT',{error,Reason}} -> - {error,Reason}; - {'EXIT',Reason} -> - {error,{asn1,Reason}}; - {Bytes,_Len} -> - {ok,wrap_encode(Bytes)}; +legacy_erlang_types() -> false. + +encode(Type, Data) -> +try iolist_to_binary(element(1, encode_disp(Type, Data))) of Bytes -> - {ok,wrap_encode(Bytes)} + {ok,Bytes} + catch + Class:Exception when Class =:= error; Class =:= exit -> + case Exception of + {error,Reason}=Error -> + Error; + Reason -> + {error,{asn1,Reason}} + end end. decode(Type,Data) -> -case catch decode_disp(Type,wrap_decode(Data)) of - {'EXIT',{error,Reason}} -> - {error,Reason}; - {'EXIT',Reason} -> - {error,{asn1,Reason}}; - {X,_Rest} -> - {ok,X}; - {X,_Rest,_Len} -> - {ok,X} +try decode_disp(Type, element(1, ber_decode_nif(Data))) of + Result -> + {ok,Result} + catch + Class:Exception when Class =:= error; Class =:= exit -> + case Exception of + {error,Reason}=Error -> + Error; + Reason -> + {error,{asn1,Reason}} + end end. -encode_disp('ACSE-apdu',Data) -> 'enc_ACSE-apdu'(Data,[]); -encode_disp('AARQ-apdu',Data) -> 'enc_AARQ-apdu'(Data,[]); -encode_disp('AARE-apdu',Data) -> 'enc_AARE-apdu'(Data,[]); -encode_disp('RLRQ-apdu',Data) -> 'enc_RLRQ-apdu'(Data,[]); -encode_disp('RLRE-apdu',Data) -> 'enc_RLRE-apdu'(Data,[]); -encode_disp('ABRT-apdu',Data) -> 'enc_ABRT-apdu'(Data,[]); -encode_disp('ABRT-diagnostic',Data) -> 'enc_ABRT-diagnostic'(Data,[]); -encode_disp('ABRT-source',Data) -> 'enc_ABRT-source'(Data,[]); -encode_disp('ACSE-requirements',Data) -> 'enc_ACSE-requirements'(Data,[]); -encode_disp('Application-context-name-list',Data) -> 'enc_Application-context-name-list'(Data,[]); -encode_disp('Application-context-name',Data) -> 'enc_Application-context-name'(Data,[]); -encode_disp('AP-title',Data) -> 'enc_AP-title'(Data,[]); -encode_disp('AE-qualifier',Data) -> 'enc_AE-qualifier'(Data,[]); -encode_disp('AP-title-form1',Data) -> 'enc_AP-title-form1'(Data,[]); -encode_disp('AE-qualifier-form1',Data) -> 'enc_AE-qualifier-form1'(Data,[]); -encode_disp('AP-title-form2',Data) -> 'enc_AP-title-form2'(Data,[]); -encode_disp('AE-qualifier-form2',Data) -> 'enc_AE-qualifier-form2'(Data,[]); -encode_disp('AE-title',Data) -> 'enc_AE-title'(Data,[]); -encode_disp('AE-title-form1',Data) -> 'enc_AE-title-form1'(Data,[]); -encode_disp('AE-title-form2',Data) -> 'enc_AE-title-form2'(Data,[]); -encode_disp('AE-invocation-identifier',Data) -> 'enc_AE-invocation-identifier'(Data,[]); -encode_disp('AP-invocation-identifier',Data) -> 'enc_AP-invocation-identifier'(Data,[]); -encode_disp('Associate-result',Data) -> 'enc_Associate-result'(Data,[]); -encode_disp('Associate-source-diagnostic',Data) -> 'enc_Associate-source-diagnostic'(Data,[]); -encode_disp('Association-information',Data) -> 'enc_Association-information'(Data,[]); -encode_disp('Authentication-value',Data) -> 'enc_Authentication-value'(Data,[]); -encode_disp('Implementation-data',Data) -> 'enc_Implementation-data'(Data,[]); -encode_disp('Mechanism-name',Data) -> 'enc_Mechanism-name'(Data,[]); -encode_disp('Release-request-reason',Data) -> 'enc_Release-request-reason'(Data,[]); -encode_disp('Release-response-reason',Data) -> 'enc_Release-response-reason'(Data,[]); -encode_disp('EXTERNAL',Data) -> 'enc_EXTERNAL'(Data,[]); +encode_disp('ACSE-apdu',Data) -> 'enc_ACSE-apdu'(Data); +encode_disp('AARQ-apdu',Data) -> 'enc_AARQ-apdu'(Data); +encode_disp('AARE-apdu',Data) -> 'enc_AARE-apdu'(Data); +encode_disp('RLRQ-apdu',Data) -> 'enc_RLRQ-apdu'(Data); +encode_disp('RLRE-apdu',Data) -> 'enc_RLRE-apdu'(Data); +encode_disp('ABRT-apdu',Data) -> 'enc_ABRT-apdu'(Data); +encode_disp('ABRT-diagnostic',Data) -> 'enc_ABRT-diagnostic'(Data); +encode_disp('ABRT-source',Data) -> 'enc_ABRT-source'(Data); +encode_disp('ACSE-requirements',Data) -> 'enc_ACSE-requirements'(Data); +encode_disp('Application-context-name-list',Data) -> 'enc_Application-context-name-list'(Data); +encode_disp('Application-context-name',Data) -> 'enc_Application-context-name'(Data); +encode_disp('AP-title',Data) -> 'enc_AP-title'(Data); +encode_disp('AE-qualifier',Data) -> 'enc_AE-qualifier'(Data); +encode_disp('AP-title-form1',Data) -> 'enc_AP-title-form1'(Data); +encode_disp('AE-qualifier-form1',Data) -> 'enc_AE-qualifier-form1'(Data); +encode_disp('AP-title-form2',Data) -> 'enc_AP-title-form2'(Data); +encode_disp('AE-qualifier-form2',Data) -> 'enc_AE-qualifier-form2'(Data); +encode_disp('AE-title',Data) -> 'enc_AE-title'(Data); +encode_disp('AE-title-form1',Data) -> 'enc_AE-title-form1'(Data); +encode_disp('AE-title-form2',Data) -> 'enc_AE-title-form2'(Data); +encode_disp('AE-invocation-identifier',Data) -> 'enc_AE-invocation-identifier'(Data); +encode_disp('AP-invocation-identifier',Data) -> 'enc_AP-invocation-identifier'(Data); +encode_disp('Associate-result',Data) -> 'enc_Associate-result'(Data); +encode_disp('Associate-source-diagnostic',Data) -> 'enc_Associate-source-diagnostic'(Data); +encode_disp('Association-information',Data) -> 'enc_Association-information'(Data); +encode_disp('Authentication-value',Data) -> 'enc_Authentication-value'(Data); +encode_disp('Implementation-data',Data) -> 'enc_Implementation-data'(Data); +encode_disp('Mechanism-name',Data) -> 'enc_Mechanism-name'(Data); +encode_disp('Release-request-reason',Data) -> 'enc_Release-request-reason'(Data); +encode_disp('Release-response-reason',Data) -> 'enc_Release-response-reason'(Data); +encode_disp('EXTERNAL',Data) -> 'enc_EXTERNAL'(Data); encode_disp(Type,_Data) -> exit({error,{asn1,{undefined_type,Type}}}). -decode_disp('ACSE-apdu',Data) -> 'dec_ACSE-apdu'(Data,mandatory); -decode_disp('AARQ-apdu',Data) -> 'dec_AARQ-apdu'(Data,mandatory); -decode_disp('AARE-apdu',Data) -> 'dec_AARE-apdu'(Data,mandatory); -decode_disp('RLRQ-apdu',Data) -> 'dec_RLRQ-apdu'(Data,mandatory); -decode_disp('RLRE-apdu',Data) -> 'dec_RLRE-apdu'(Data,mandatory); -decode_disp('ABRT-apdu',Data) -> 'dec_ABRT-apdu'(Data,mandatory); -decode_disp('ABRT-diagnostic',Data) -> 'dec_ABRT-diagnostic'(Data,mandatory); -decode_disp('ABRT-source',Data) -> 'dec_ABRT-source'(Data,mandatory); -decode_disp('ACSE-requirements',Data) -> 'dec_ACSE-requirements'(Data,mandatory); -decode_disp('Application-context-name-list',Data) -> 'dec_Application-context-name-list'(Data,mandatory); -decode_disp('Application-context-name',Data) -> 'dec_Application-context-name'(Data,mandatory); -decode_disp('AP-title',Data) -> 'dec_AP-title'(Data,mandatory); -decode_disp('AE-qualifier',Data) -> 'dec_AE-qualifier'(Data,mandatory); -decode_disp('AP-title-form1',Data) -> 'dec_AP-title-form1'(Data,mandatory); -decode_disp('AE-qualifier-form1',Data) -> 'dec_AE-qualifier-form1'(Data,mandatory); -decode_disp('AP-title-form2',Data) -> 'dec_AP-title-form2'(Data,mandatory); -decode_disp('AE-qualifier-form2',Data) -> 'dec_AE-qualifier-form2'(Data,mandatory); -decode_disp('AE-title',Data) -> 'dec_AE-title'(Data,mandatory); -decode_disp('AE-title-form1',Data) -> 'dec_AE-title-form1'(Data,mandatory); -decode_disp('AE-title-form2',Data) -> 'dec_AE-title-form2'(Data,mandatory); -decode_disp('AE-invocation-identifier',Data) -> 'dec_AE-invocation-identifier'(Data,mandatory); -decode_disp('AP-invocation-identifier',Data) -> 'dec_AP-invocation-identifier'(Data,mandatory); -decode_disp('Associate-result',Data) -> 'dec_Associate-result'(Data,mandatory); -decode_disp('Associate-source-diagnostic',Data) -> 'dec_Associate-source-diagnostic'(Data,mandatory); -decode_disp('Association-information',Data) -> 'dec_Association-information'(Data,mandatory); -decode_disp('Authentication-value',Data) -> 'dec_Authentication-value'(Data,mandatory); -decode_disp('Implementation-data',Data) -> 'dec_Implementation-data'(Data,mandatory); -decode_disp('Mechanism-name',Data) -> 'dec_Mechanism-name'(Data,mandatory); -decode_disp('Release-request-reason',Data) -> 'dec_Release-request-reason'(Data,mandatory); -decode_disp('Release-response-reason',Data) -> 'dec_Release-response-reason'(Data,mandatory); -decode_disp('EXTERNAL',Data) -> 'dec_EXTERNAL'(Data,mandatory); +decode_disp('ACSE-apdu',Data) -> 'dec_ACSE-apdu'(Data); +decode_disp('AARQ-apdu',Data) -> 'dec_AARQ-apdu'(Data); +decode_disp('AARE-apdu',Data) -> 'dec_AARE-apdu'(Data); +decode_disp('RLRQ-apdu',Data) -> 'dec_RLRQ-apdu'(Data); +decode_disp('RLRE-apdu',Data) -> 'dec_RLRE-apdu'(Data); +decode_disp('ABRT-apdu',Data) -> 'dec_ABRT-apdu'(Data); +decode_disp('ABRT-diagnostic',Data) -> 'dec_ABRT-diagnostic'(Data); +decode_disp('ABRT-source',Data) -> 'dec_ABRT-source'(Data); +decode_disp('ACSE-requirements',Data) -> 'dec_ACSE-requirements'(Data); +decode_disp('Application-context-name-list',Data) -> 'dec_Application-context-name-list'(Data); +decode_disp('Application-context-name',Data) -> 'dec_Application-context-name'(Data); +decode_disp('AP-title',Data) -> 'dec_AP-title'(Data); +decode_disp('AE-qualifier',Data) -> 'dec_AE-qualifier'(Data); +decode_disp('AP-title-form1',Data) -> 'dec_AP-title-form1'(Data); +decode_disp('AE-qualifier-form1',Data) -> 'dec_AE-qualifier-form1'(Data); +decode_disp('AP-title-form2',Data) -> 'dec_AP-title-form2'(Data); +decode_disp('AE-qualifier-form2',Data) -> 'dec_AE-qualifier-form2'(Data); +decode_disp('AE-title',Data) -> 'dec_AE-title'(Data); +decode_disp('AE-title-form1',Data) -> 'dec_AE-title-form1'(Data); +decode_disp('AE-title-form2',Data) -> 'dec_AE-title-form2'(Data); +decode_disp('AE-invocation-identifier',Data) -> 'dec_AE-invocation-identifier'(Data); +decode_disp('AP-invocation-identifier',Data) -> 'dec_AP-invocation-identifier'(Data); +decode_disp('Associate-result',Data) -> 'dec_Associate-result'(Data); +decode_disp('Associate-source-diagnostic',Data) -> 'dec_Associate-source-diagnostic'(Data); +decode_disp('Association-information',Data) -> 'dec_Association-information'(Data); +decode_disp('Authentication-value',Data) -> 'dec_Authentication-value'(Data); +decode_disp('Implementation-data',Data) -> 'dec_Implementation-data'(Data); +decode_disp('Mechanism-name',Data) -> 'dec_Mechanism-name'(Data); +decode_disp('Release-request-reason',Data) -> 'dec_Release-request-reason'(Data); +decode_disp('Release-response-reason',Data) -> 'dec_Release-response-reason'(Data); +decode_disp('EXTERNAL',Data) -> 'dec_EXTERNAL'(Data); decode_disp(Type,_Data) -> exit({error,{asn1,{undefined_type,Type}}}). -wrap_encode(Bytes) when is_list(Bytes) -> - binary_to_list(list_to_binary(Bytes)); -wrap_encode(Bytes) when is_binary(Bytes) -> - binary_to_list(Bytes); -wrap_encode(Bytes) -> Bytes. - -wrap_decode(Bytes) when is_list(Bytes) -> - list_to_binary(Bytes); -wrap_decode(Bytes) -> Bytes. - info() -> - case ?MODULE:module_info() of - MI when is_list(MI) -> - case lists:keysearch(attributes,1,MI) of - {value,{_,Attributes}} when is_list(Attributes) -> - case lists:keysearch(asn1_info,1,Attributes) of - {value,{_,Info}} when is_list(Info) -> - Info; - _ -> - [] - end; - _ -> - [] - end + case ?MODULE:module_info(attributes) of + Attributes when is_list(Attributes) -> + case lists:keyfind(asn1_info, 1, Attributes) of + {_,Info} when is_list(Info) -> + Info; + _ -> + [] + end; + _ -> + [] end. %%================================ %% ACSE-apdu %%================================ - -'enc_ACSE-apdu'({'ACSE-apdu',Val}, TagIn) -> - 'enc_ACSE-apdu'(Val, TagIn); +'enc_ACSE-apdu'(Val) -> + 'enc_ACSE-apdu'(Val, []). 'enc_ACSE-apdu'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of aarq -> - 'enc_AARQ-apdu'(element(2,Val), []); + 'enc_AARQ-apdu'(element(2,Val), [<<96>>]); aare -> - 'enc_AARE-apdu'(element(2,Val), []); + 'enc_AARE-apdu'(element(2,Val), [<<97>>]); rlrq -> - 'enc_RLRQ-apdu'(element(2,Val), []); + 'enc_RLRQ-apdu'(element(2,Val), [<<98>>]); rlre -> - 'enc_RLRE-apdu'(element(2,Val), []); + 'enc_RLRE-apdu'(element(2,Val), [<<99>>]); abrt -> - 'enc_ABRT-apdu'(element(2,Val), []); + 'enc_ABRT-apdu'(element(2,Val), [<<100>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). +encode_tags(TagIn, EncBytes, EncLen). -'dec_ACSE-apdu'(Bytes, OptOrMand) -> - 'dec_ACSE-apdu'(Bytes, OptOrMand, []). +'dec_ACSE-apdu'(Tlv) -> + 'dec_ACSE-apdu'(Tlv, []). -'dec_ACSE-apdu'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of +'dec_ACSE-apdu'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of %% 'aarq' - <<1:2,_:1,0:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_AARQ-apdu'(Bytes1, mandatory, []), - {{aarq, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {65536, V1} -> + {aarq, 'dec_AARQ-apdu'(V1, [])}; %% 'aare' - <<1:2,_:1,1:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_AARE-apdu'(Bytes1, mandatory, []), - {{aare, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {65537, V1} -> + {aare, 'dec_AARE-apdu'(V1, [])}; %% 'rlrq' - <<1:2,_:1,2:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_RLRQ-apdu'(Bytes1, mandatory, []), - {{rlrq, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {65538, V1} -> + {rlrq, 'dec_RLRQ-apdu'(V1, [])}; %% 'rlre' - <<1:2,_:1,3:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_RLRE-apdu'(Bytes1, mandatory, []), - {{rlre, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {65539, V1} -> + {rlre, 'dec_RLRE-apdu'(V1, [])}; %% 'abrt' - <<1:2,_:1,4:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_ABRT-apdu'(Bytes1, mandatory, []), - {{abrt, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {65540, V1} -> + {abrt, 'dec_ABRT-apdu'(V1, [])}; - _ -> - {{asn1_ExtAlt,Bytes1},<<>>, RbExp} - end. + Else -> + {asn1_ExtAlt,ber_encode(Else)} + end +. %%================================ %% AARQ-apdu %%================================ +'enc_AARQ-apdu'(Val) -> + 'enc_AARQ-apdu'(Val, [<<96>>]). + 'enc_AARQ-apdu'(Val, TagIn) -> +{_,Cindex1, Cindex2, Cindex3, Cindex4, Cindex5, Cindex6, Cindex7, Cindex8, Cindex9, Cindex10, Cindex11, Cindex12, Cindex13, Cindex14, Cindex15, Cindex16} = Val, %%------------------------------------------------- -%% attribute number 1 with type BIT STRING DEFAULT = [version1] +%% attribute protocol-version(1) with type BIT STRING DEFAULT = [version1] %%------------------------------------------------- - {EncBytes1,EncLen1} = case ?RT_BER:cindex(2,Val,'protocol-version') of + {EncBytes1,EncLen1} = case Cindex1 of asn1_DEFAULT -> {<<>>,0}; [version1] -> {<<>>,0}; _ -> - ?RT_BER:encode_bit_string([], ?RT_BER:cindex(2,Val,'protocol-version'), [{version1,0}], [{tag,128,0,'IMPLICIT',32}]) + encode_named_bit_string(Cindex1, [{version1,0}], [<<128>>]) end, %%------------------------------------------------- -%% attribute number 2 with type OBJECT IDENTIFIER +%% attribute application-context-name(2) with type OBJECT IDENTIFIER %%------------------------------------------------- - {EncBytes2,EncLen2} = ?RT_BER:encode_object_identifier(?RT_BER:cindex(3,Val,'application-context-name'), [{tag,128,1,'EXPLICIT',32}]), + {EncBytes2,EncLen2} = encode_object_identifier(Cindex2, [<<6>>,<<161>>]), %%------------------------------------------------- -%% attribute number 3 External ACSE-1:AP-title OPTIONAL +%% attribute called-AP-title(3) External ACSE-1:AP-title OPTIONAL %%------------------------------------------------- - {EncBytes3,EncLen3} = case ?RT_BER:cindex(4,Val,'called-AP-title') of + {EncBytes3,EncLen3} = case Cindex3 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_AP-title'(?RT_BER:cindex(4,Val,'called-AP-title'), [{tag,128,2,'EXPLICIT',32}]) + 'enc_AP-title'(Cindex3, [<<162>>]) end, %%------------------------------------------------- -%% attribute number 4 External ACSE-1:AE-qualifier OPTIONAL +%% attribute called-AE-qualifier(4) External ACSE-1:AE-qualifier OPTIONAL %%------------------------------------------------- - {EncBytes4,EncLen4} = case ?RT_BER:cindex(5,Val,'called-AE-qualifier') of + {EncBytes4,EncLen4} = case Cindex4 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_AE-qualifier'(?RT_BER:cindex(5,Val,'called-AE-qualifier'), [{tag,128,3,'EXPLICIT',32}]) + 'enc_AE-qualifier'(Cindex4, [<<163>>]) end, %%------------------------------------------------- -%% attribute number 5 with type INTEGER OPTIONAL +%% attribute called-AP-invocation-identifier(5) with type INTEGER OPTIONAL %%------------------------------------------------- - {EncBytes5,EncLen5} = case ?RT_BER:cindex(6,Val,'called-AP-invocation-identifier') of + {EncBytes5,EncLen5} = case Cindex5 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_integer([], ?RT_BER:cindex(6,Val,'called-AP-invocation-identifier'), [{tag,128,4,'EXPLICIT',32}]) + encode_integer(Cindex5, [<<2>>,<<164>>]) end, %%------------------------------------------------- -%% attribute number 6 with type INTEGER OPTIONAL +%% attribute called-AE-invocation-identifier(6) with type INTEGER OPTIONAL %%------------------------------------------------- - {EncBytes6,EncLen6} = case ?RT_BER:cindex(7,Val,'called-AE-invocation-identifier') of + {EncBytes6,EncLen6} = case Cindex6 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_integer([], ?RT_BER:cindex(7,Val,'called-AE-invocation-identifier'), [{tag,128,5,'EXPLICIT',32}]) + encode_integer(Cindex6, [<<2>>,<<165>>]) end, %%------------------------------------------------- -%% attribute number 7 External ACSE-1:AP-title OPTIONAL +%% attribute calling-AP-title(7) External ACSE-1:AP-title OPTIONAL %%------------------------------------------------- - {EncBytes7,EncLen7} = case ?RT_BER:cindex(8,Val,'calling-AP-title') of + {EncBytes7,EncLen7} = case Cindex7 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_AP-title'(?RT_BER:cindex(8,Val,'calling-AP-title'), [{tag,128,6,'EXPLICIT',32}]) + 'enc_AP-title'(Cindex7, [<<166>>]) end, %%------------------------------------------------- -%% attribute number 8 External ACSE-1:AE-qualifier OPTIONAL +%% attribute calling-AE-qualifier(8) External ACSE-1:AE-qualifier OPTIONAL %%------------------------------------------------- - {EncBytes8,EncLen8} = case ?RT_BER:cindex(9,Val,'calling-AE-qualifier') of + {EncBytes8,EncLen8} = case Cindex8 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_AE-qualifier'(?RT_BER:cindex(9,Val,'calling-AE-qualifier'), [{tag,128,7,'EXPLICIT',32}]) + 'enc_AE-qualifier'(Cindex8, [<<167>>]) end, %%------------------------------------------------- -%% attribute number 9 with type INTEGER OPTIONAL +%% attribute calling-AP-invocation-identifier(9) with type INTEGER OPTIONAL %%------------------------------------------------- - {EncBytes9,EncLen9} = case ?RT_BER:cindex(10,Val,'calling-AP-invocation-identifier') of + {EncBytes9,EncLen9} = case Cindex9 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_integer([], ?RT_BER:cindex(10,Val,'calling-AP-invocation-identifier'), [{tag,128,8,'EXPLICIT',32}]) + encode_integer(Cindex9, [<<2>>,<<168>>]) end, %%------------------------------------------------- -%% attribute number 10 with type INTEGER OPTIONAL +%% attribute calling-AE-invocation-identifier(10) with type INTEGER OPTIONAL %%------------------------------------------------- - {EncBytes10,EncLen10} = case ?RT_BER:cindex(11,Val,'calling-AE-invocation-identifier') of + {EncBytes10,EncLen10} = case Cindex10 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_integer([], ?RT_BER:cindex(11,Val,'calling-AE-invocation-identifier'), [{tag,128,9,'EXPLICIT',32}]) + encode_integer(Cindex10, [<<2>>,<<169>>]) end, %%------------------------------------------------- -%% attribute number 11 with type BIT STRING OPTIONAL +%% attribute sender-acse-requirements(11) with type BIT STRING OPTIONAL %%------------------------------------------------- - {EncBytes11,EncLen11} = case ?RT_BER:cindex(12,Val,'sender-acse-requirements') of + {EncBytes11,EncLen11} = case Cindex11 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_bit_string([], ?RT_BER:cindex(12,Val,'sender-acse-requirements'), [{authentication,0},{'application-context-negotiation',1}], [{tag,128,10,'IMPLICIT',32}]) + encode_named_bit_string(Cindex11, [{authentication,0},{'application-context-negotiation',1}], [<<138>>]) end, %%------------------------------------------------- -%% attribute number 12 with type OBJECT IDENTIFIER OPTIONAL +%% attribute mechanism-name(12) with type OBJECT IDENTIFIER OPTIONAL %%------------------------------------------------- - {EncBytes12,EncLen12} = case ?RT_BER:cindex(13,Val,'mechanism-name') of + {EncBytes12,EncLen12} = case Cindex12 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_object_identifier(?RT_BER:cindex(13,Val,'mechanism-name'), [{tag,128,11,'IMPLICIT',32}]) + encode_object_identifier(Cindex12, [<<139>>]) end, %%------------------------------------------------- -%% attribute number 13 External ACSE-1:Authentication-value OPTIONAL +%% attribute calling-authentication-value(13) External ACSE-1:Authentication-value OPTIONAL %%------------------------------------------------- - {EncBytes13,EncLen13} = case ?RT_BER:cindex(14,Val,'calling-authentication-value') of + {EncBytes13,EncLen13} = case Cindex13 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_Authentication-value'(?RT_BER:cindex(14,Val,'calling-authentication-value'), [{tag,128,12,'EXPLICIT',32}]) + 'enc_Authentication-value'(Cindex13, [<<172>>]) end, %%------------------------------------------------- -%% attribute number 14 External ACSE-1:Application-context-name-list OPTIONAL +%% attribute application-context-name-list(14) External ACSE-1:Application-context-name-list OPTIONAL %%------------------------------------------------- - {EncBytes14,EncLen14} = case ?RT_BER:cindex(15,Val,'application-context-name-list') of + {EncBytes14,EncLen14} = case Cindex14 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_Application-context-name-list'(?RT_BER:cindex(15,Val,'application-context-name-list'), [{tag,128,13,'IMPLICIT',32}]) + 'enc_Application-context-name-list'(Cindex14, [<<173>>]) end, %%------------------------------------------------- -%% attribute number 15 with type GraphicString OPTIONAL +%% attribute implementation-information(15) with type GraphicString OPTIONAL %%------------------------------------------------- - {EncBytes15,EncLen15} = case ?RT_BER:cindex(16,Val,'implementation-information') of + {EncBytes15,EncLen15} = case Cindex15 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_restricted_string([], ?RT_BER:cindex(16,Val,'implementation-information'), 25, [{tag,128,29,'IMPLICIT',32}]) + encode_restricted_string(Cindex15, [<<157>>]) end, %%------------------------------------------------- -%% attribute number 16 External ACSE-1:Association-information OPTIONAL +%% attribute user-information(16) External ACSE-1:Association-information OPTIONAL %%------------------------------------------------- - {EncBytes16,EncLen16} = case ?RT_BER:cindex(17,Val,'user-information') of + {EncBytes16,EncLen16} = case Cindex16 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_Association-information'(?RT_BER:cindex(17,Val,'user-information'), [{tag,128,30,'IMPLICIT',32}]) + 'enc_Association-information'(Cindex16, [<<190>>]) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4, EncBytes5, EncBytes6, EncBytes7, EncBytes8, EncBytes9, EncBytes10, EncBytes11, EncBytes12, EncBytes13, EncBytes14, EncBytes15, EncBytes16], - LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5 + EncLen6 + EncLen7 + EncLen8 + EncLen9 + EncLen10 + EncLen11 + EncLen12 + EncLen13 + EncLen14 + EncLen15 + EncLen16, - ?RT_BER:encode_tags(TagIn ++ [{tag,64,0,'IMPLICIT',32},{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5 + EncLen6 + EncLen7 + EncLen8 + EncLen9 + EncLen10 + EncLen11 + EncLen12 + EncLen13 + EncLen14 + EncLen15 + EncLen16, +encode_tags(TagIn, BytesSoFar, LenSoFar). -'dec_AARQ-apdu'(Bytes, OptOrMand) -> - 'dec_AARQ-apdu'(Bytes, OptOrMand, []). +'dec_AARQ-apdu'(Tlv) -> + 'dec_AARQ-apdu'(Tlv, [65536]). -'dec_AARQ-apdu'(Bytes, OptOrMand, TagIn) -> +'dec_AARQ-apdu'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,64,0,'IMPLICIT',32},{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 with type BIT STRING DEFAULT = [version1] +%% attribute protocol-version(1) with type BIT STRING DEFAULT = [version1] %%------------------------------------------------- - {Term1,Bytes3,Rb2} = case Bytes2 of -<<2:2,_:1,0:5,_/binary>> -> -?RT_BER:decode_bit_string(Bytes2,[],[{version1,0}],[{tag,128,0,'IMPLICIT',32}], no_length, mandatory); -_ -> -{[version1],Bytes2, 0 } +{Term1,Tlv2} = case Tlv1 of +[{131072,V1}|TempTlv2] -> + {decode_named_bit_string(V1, [{version1,0}], []), TempTlv2}; + _ -> + {[version1],Tlv1} end, %%------------------------------------------------- -%% attribute number 2 with type OBJECT IDENTIFIER +%% attribute application-context-name(2) with type OBJECT IDENTIFIER %%------------------------------------------------- - {Term2,Bytes4,Rb3} = ?RT_BER:decode_object_identifier(Bytes3,[{tag,128,1,'EXPLICIT',32}], mandatory), +[V2|Tlv3] = Tlv2, +Term2 = decode_object_identifier(V2, [131073,6]), %%------------------------------------------------- -%% attribute number 3 External ACSE-1:AP-title OPTIONAL +%% attribute called-AP-title(3) External ACSE-1:AP-title OPTIONAL %%------------------------------------------------- - {Term3,Bytes5,Rb4} = case Bytes4 of -<<2:2,_:1,2:5,_/binary>> -> -'dec_AP-title'(Bytes4, opt_or_default, [{tag,128,2,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes4, 0 } +{Term3,Tlv4} = case Tlv3 of +[{131074,V3}|TempTlv4] -> + {'dec_AP-title'(V3, []), TempTlv4}; + _ -> + { asn1_NOVALUE, Tlv3} end, %%------------------------------------------------- -%% attribute number 4 External ACSE-1:AE-qualifier OPTIONAL +%% attribute called-AE-qualifier(4) External ACSE-1:AE-qualifier OPTIONAL %%------------------------------------------------- - {Term4,Bytes6,Rb5} = case Bytes5 of -<<2:2,_:1,3:5,_/binary>> -> -'dec_AE-qualifier'(Bytes5, opt_or_default, [{tag,128,3,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes5, 0 } +{Term4,Tlv5} = case Tlv4 of +[{131075,V4}|TempTlv5] -> + {'dec_AE-qualifier'(V4, []), TempTlv5}; + _ -> + { asn1_NOVALUE, Tlv4} end, %%------------------------------------------------- -%% attribute number 5 with type INTEGER OPTIONAL +%% attribute called-AP-invocation-identifier(5) with type INTEGER OPTIONAL %%------------------------------------------------- - {Term5,Bytes7,Rb6} = case Bytes6 of -<<2:2,_:1,4:5,_/binary>> -> -?RT_BER:decode_integer(Bytes6,[],[{tag,128,4,'EXPLICIT',32}], mandatory); -_ -> -{ asn1_NOVALUE, Bytes6, 0 } +{Term5,Tlv6} = case Tlv5 of +[{131076,V5}|TempTlv6] -> + {decode_integer(V5, [2]), TempTlv6}; + _ -> + { asn1_NOVALUE, Tlv5} end, %%------------------------------------------------- -%% attribute number 6 with type INTEGER OPTIONAL +%% attribute called-AE-invocation-identifier(6) with type INTEGER OPTIONAL %%------------------------------------------------- - {Term6,Bytes8,Rb7} = case Bytes7 of -<<2:2,_:1,5:5,_/binary>> -> -?RT_BER:decode_integer(Bytes7,[],[{tag,128,5,'EXPLICIT',32}], mandatory); -_ -> -{ asn1_NOVALUE, Bytes7, 0 } +{Term6,Tlv7} = case Tlv6 of +[{131077,V6}|TempTlv7] -> + {decode_integer(V6, [2]), TempTlv7}; + _ -> + { asn1_NOVALUE, Tlv6} end, %%------------------------------------------------- -%% attribute number 7 External ACSE-1:AP-title OPTIONAL +%% attribute calling-AP-title(7) External ACSE-1:AP-title OPTIONAL %%------------------------------------------------- - {Term7,Bytes9,Rb8} = case Bytes8 of -<<2:2,_:1,6:5,_/binary>> -> -'dec_AP-title'(Bytes8, opt_or_default, [{tag,128,6,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes8, 0 } +{Term7,Tlv8} = case Tlv7 of +[{131078,V7}|TempTlv8] -> + {'dec_AP-title'(V7, []), TempTlv8}; + _ -> + { asn1_NOVALUE, Tlv7} end, %%------------------------------------------------- -%% attribute number 8 External ACSE-1:AE-qualifier OPTIONAL +%% attribute calling-AE-qualifier(8) External ACSE-1:AE-qualifier OPTIONAL %%------------------------------------------------- - {Term8,Bytes10,Rb9} = case Bytes9 of -<<2:2,_:1,7:5,_/binary>> -> -'dec_AE-qualifier'(Bytes9, opt_or_default, [{tag,128,7,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes9, 0 } +{Term8,Tlv9} = case Tlv8 of +[{131079,V8}|TempTlv9] -> + {'dec_AE-qualifier'(V8, []), TempTlv9}; + _ -> + { asn1_NOVALUE, Tlv8} end, %%------------------------------------------------- -%% attribute number 9 with type INTEGER OPTIONAL +%% attribute calling-AP-invocation-identifier(9) with type INTEGER OPTIONAL %%------------------------------------------------- - {Term9,Bytes11,Rb10} = case Bytes10 of -<<2:2,_:1,8:5,_/binary>> -> -?RT_BER:decode_integer(Bytes10,[],[{tag,128,8,'EXPLICIT',32}], mandatory); -_ -> -{ asn1_NOVALUE, Bytes10, 0 } +{Term9,Tlv10} = case Tlv9 of +[{131080,V9}|TempTlv10] -> + {decode_integer(V9, [2]), TempTlv10}; + _ -> + { asn1_NOVALUE, Tlv9} end, %%------------------------------------------------- -%% attribute number 10 with type INTEGER OPTIONAL +%% attribute calling-AE-invocation-identifier(10) with type INTEGER OPTIONAL %%------------------------------------------------- - {Term10,Bytes12,Rb11} = case Bytes11 of -<<2:2,_:1,9:5,_/binary>> -> -?RT_BER:decode_integer(Bytes11,[],[{tag,128,9,'EXPLICIT',32}], mandatory); -_ -> -{ asn1_NOVALUE, Bytes11, 0 } +{Term10,Tlv11} = case Tlv10 of +[{131081,V10}|TempTlv11] -> + {decode_integer(V10, [2]), TempTlv11}; + _ -> + { asn1_NOVALUE, Tlv10} end, %%------------------------------------------------- -%% attribute number 11 with type BIT STRING OPTIONAL +%% attribute sender-acse-requirements(11) with type BIT STRING OPTIONAL %%------------------------------------------------- - {Term11,Bytes13,Rb12} = case Bytes12 of -<<2:2,_:1,10:5,_/binary>> -> -?RT_BER:decode_bit_string(Bytes12,[],[{authentication,0},{'application-context-negotiation',1}],[{tag,128,10,'IMPLICIT',32}], no_length, mandatory); -_ -> -{ asn1_NOVALUE, Bytes12, 0 } +{Term11,Tlv12} = case Tlv11 of +[{131082,V11}|TempTlv12] -> + {decode_named_bit_string(V11, [{authentication,0},{'application-context-negotiation',1}], []), TempTlv12}; + _ -> + { asn1_NOVALUE, Tlv11} end, %%------------------------------------------------- -%% attribute number 12 with type OBJECT IDENTIFIER OPTIONAL +%% attribute mechanism-name(12) with type OBJECT IDENTIFIER OPTIONAL %%------------------------------------------------- - {Term12,Bytes14,Rb13} = case Bytes13 of -<<2:2,_:1,11:5,_/binary>> -> -?RT_BER:decode_object_identifier(Bytes13,[{tag,128,11,'IMPLICIT',32}], mandatory); -_ -> -{ asn1_NOVALUE, Bytes13, 0 } +{Term12,Tlv13} = case Tlv12 of +[{131083,V12}|TempTlv13] -> + {decode_object_identifier(V12, []), TempTlv13}; + _ -> + { asn1_NOVALUE, Tlv12} end, %%------------------------------------------------- -%% attribute number 13 External ACSE-1:Authentication-value OPTIONAL +%% attribute calling-authentication-value(13) External ACSE-1:Authentication-value OPTIONAL %%------------------------------------------------- - {Term13,Bytes15,Rb14} = case Bytes14 of -<<2:2,_:1,12:5,_/binary>> -> -'dec_Authentication-value'(Bytes14, opt_or_default, [{tag,128,12,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes14, 0 } +{Term13,Tlv14} = case Tlv13 of +[{131084,V13}|TempTlv14] -> + {'dec_Authentication-value'(V13, []), TempTlv14}; + _ -> + { asn1_NOVALUE, Tlv13} end, %%------------------------------------------------- -%% attribute number 14 External ACSE-1:Application-context-name-list OPTIONAL +%% attribute application-context-name-list(14) External ACSE-1:Application-context-name-list OPTIONAL %%------------------------------------------------- - {Term14,Bytes16,Rb15} = case Bytes15 of -<<2:2,_:1,13:5,_/binary>> -> -'dec_Application-context-name-list'(Bytes15, opt_or_default, [{tag,128,13,'IMPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes15, 0 } +{Term14,Tlv15} = case Tlv14 of +[{131085,V14}|TempTlv15] -> + {'dec_Application-context-name-list'(V14, []), TempTlv15}; + _ -> + { asn1_NOVALUE, Tlv14} end, %%------------------------------------------------- -%% attribute number 15 with type GraphicString OPTIONAL +%% attribute implementation-information(15) with type GraphicString OPTIONAL %%------------------------------------------------- - {Term15,Bytes17,Rb16} = case Bytes16 of -<<2:2,_:1,29:5,_/binary>> -> -?RT_BER:decode_restricted_string(Bytes16,[],25,[{tag,128,29,'IMPLICIT',32}], no_length, mandatory); -_ -> -{ asn1_NOVALUE, Bytes16, 0 } +{Term15,Tlv16} = case Tlv15 of +[{131101,V15}|TempTlv16] -> + {begin +binary_to_list(decode_restricted_string(V15, [])) +end +, TempTlv16}; + _ -> + { asn1_NOVALUE, Tlv15} end, - {Bytes18, Rb17} = ?RT_BER:skip_ExtensionAdditions(Bytes17, [{tag,128,30,'IMPLICIT',32}]), +Tlv17 = skip_ExtensionAdditions(Tlv16, [131102]), %%------------------------------------------------- -%% attribute number 15 External ACSE-1:Association-information OPTIONAL +%% attribute user-information(15) External ACSE-1:Association-information OPTIONAL %%------------------------------------------------- - {Term16,Bytes19,Rb18} = case Bytes18 of -<<2:2,_:1,30:5,_/binary>> -> -'dec_Association-information'(Bytes18, opt_or_default, [{tag,128,30,'IMPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes18, 0 } +{Term16,Tlv18} = case Tlv17 of +[{131102,V16}|TempTlv18] -> + {'dec_Association-information'(V16, []), TempTlv18}; + _ -> + { asn1_NOVALUE, Tlv17} +end, + +case Tlv18 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv18}}}) % extra fields not allowed end, + {'AARQ-apdu', Term1, Term2, Term3, Term4, Term5, Term6, Term7, Term8, Term9, Term10, Term11, Term12, Term13, Term14, Term15, Term16}. - {Bytes20,Rb19} = ?RT_BER:restbytes2(RemBytes, Bytes19,noext), - {{'AARQ-apdu', Term1, Term2, Term3, Term4, Term5, Term6, Term7, Term8, Term9, Term10, Term11, Term12, Term13, Term14, Term15, Term16}, Bytes20, Rb1+Rb2+Rb3+Rb4+Rb5+Rb6+Rb7+Rb8+Rb9+Rb10+Rb11+Rb12+Rb13+Rb14+Rb15+Rb16+Rb17+Rb18+Rb19}. %%================================ %% AARE-apdu %%================================ +'enc_AARE-apdu'(Val) -> + 'enc_AARE-apdu'(Val, [<<97>>]). + 'enc_AARE-apdu'(Val, TagIn) -> +{_,Cindex1, Cindex2, Cindex3, Cindex4, Cindex5, Cindex6, Cindex7, Cindex8, Cindex9, Cindex10, Cindex11, Cindex12, Cindex13, Cindex14} = Val, %%------------------------------------------------- -%% attribute number 1 with type BIT STRING DEFAULT = [version1] +%% attribute protocol-version(1) with type BIT STRING DEFAULT = [version1] %%------------------------------------------------- - {EncBytes1,EncLen1} = case ?RT_BER:cindex(2,Val,'protocol-version') of + {EncBytes1,EncLen1} = case Cindex1 of asn1_DEFAULT -> {<<>>,0}; [version1] -> {<<>>,0}; _ -> - ?RT_BER:encode_bit_string([], ?RT_BER:cindex(2,Val,'protocol-version'), [{version1,0}], [{tag,128,0,'IMPLICIT',32}]) + encode_named_bit_string(Cindex1, [{version1,0}], [<<128>>]) end, %%------------------------------------------------- -%% attribute number 2 with type OBJECT IDENTIFIER +%% attribute application-context-name(2) with type OBJECT IDENTIFIER %%------------------------------------------------- - {EncBytes2,EncLen2} = ?RT_BER:encode_object_identifier(?RT_BER:cindex(3,Val,'application-context-name'), [{tag,128,1,'EXPLICIT',32}]), + {EncBytes2,EncLen2} = encode_object_identifier(Cindex2, [<<6>>,<<161>>]), %%------------------------------------------------- -%% attribute number 3 with type INTEGER +%% attribute result(3) with type INTEGER %%------------------------------------------------- - {EncBytes3,EncLen3} = ?RT_BER:encode_integer([], ?RT_BER:cindex(4,Val,result), [{accepted,0},{'rejected-permanent',1},{'rejected-transient',2}], [{tag,128,2,'EXPLICIT',32}]), + {EncBytes3,EncLen3} = encode_integer(Cindex3, [{accepted,0},{'rejected-permanent',1},{'rejected-transient',2}], [<<2>>,<<162>>]), %%------------------------------------------------- -%% attribute number 4 External ACSE-1:Associate-source-diagnostic +%% attribute result-source-diagnostic(4) External ACSE-1:Associate-source-diagnostic %%------------------------------------------------- - {EncBytes4,EncLen4} = 'enc_Associate-source-diagnostic'(?RT_BER:cindex(5,Val,'result-source-diagnostic'), [{tag,128,3,'EXPLICIT',32}]), + {EncBytes4,EncLen4} = 'enc_Associate-source-diagnostic'(Cindex4, [<<163>>]), %%------------------------------------------------- -%% attribute number 5 External ACSE-1:AP-title OPTIONAL +%% attribute responding-AP-title(5) External ACSE-1:AP-title OPTIONAL %%------------------------------------------------- - {EncBytes5,EncLen5} = case ?RT_BER:cindex(6,Val,'responding-AP-title') of + {EncBytes5,EncLen5} = case Cindex5 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_AP-title'(?RT_BER:cindex(6,Val,'responding-AP-title'), [{tag,128,4,'EXPLICIT',32}]) + 'enc_AP-title'(Cindex5, [<<164>>]) end, %%------------------------------------------------- -%% attribute number 6 External ACSE-1:AE-qualifier OPTIONAL +%% attribute responding-AE-qualifier(6) External ACSE-1:AE-qualifier OPTIONAL %%------------------------------------------------- - {EncBytes6,EncLen6} = case ?RT_BER:cindex(7,Val,'responding-AE-qualifier') of + {EncBytes6,EncLen6} = case Cindex6 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_AE-qualifier'(?RT_BER:cindex(7,Val,'responding-AE-qualifier'), [{tag,128,5,'EXPLICIT',32}]) + 'enc_AE-qualifier'(Cindex6, [<<165>>]) end, %%------------------------------------------------- -%% attribute number 7 with type INTEGER OPTIONAL +%% attribute responding-AP-invocation-identifier(7) with type INTEGER OPTIONAL %%------------------------------------------------- - {EncBytes7,EncLen7} = case ?RT_BER:cindex(8,Val,'responding-AP-invocation-identifier') of + {EncBytes7,EncLen7} = case Cindex7 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_integer([], ?RT_BER:cindex(8,Val,'responding-AP-invocation-identifier'), [{tag,128,6,'EXPLICIT',32}]) + encode_integer(Cindex7, [<<2>>,<<166>>]) end, %%------------------------------------------------- -%% attribute number 8 with type INTEGER OPTIONAL +%% attribute responding-AE-invocation-identifier(8) with type INTEGER OPTIONAL %%------------------------------------------------- - {EncBytes8,EncLen8} = case ?RT_BER:cindex(9,Val,'responding-AE-invocation-identifier') of + {EncBytes8,EncLen8} = case Cindex8 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_integer([], ?RT_BER:cindex(9,Val,'responding-AE-invocation-identifier'), [{tag,128,7,'EXPLICIT',32}]) + encode_integer(Cindex8, [<<2>>,<<167>>]) end, %%------------------------------------------------- -%% attribute number 9 with type BIT STRING OPTIONAL +%% attribute responder-acse-requirements(9) with type BIT STRING OPTIONAL %%------------------------------------------------- - {EncBytes9,EncLen9} = case ?RT_BER:cindex(10,Val,'responder-acse-requirements') of + {EncBytes9,EncLen9} = case Cindex9 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_bit_string([], ?RT_BER:cindex(10,Val,'responder-acse-requirements'), [{authentication,0},{'application-context-negotiation',1}], [{tag,128,8,'IMPLICIT',32}]) + encode_named_bit_string(Cindex9, [{authentication,0},{'application-context-negotiation',1}], [<<136>>]) end, %%------------------------------------------------- -%% attribute number 10 with type OBJECT IDENTIFIER OPTIONAL +%% attribute mechanism-name(10) with type OBJECT IDENTIFIER OPTIONAL %%------------------------------------------------- - {EncBytes10,EncLen10} = case ?RT_BER:cindex(11,Val,'mechanism-name') of + {EncBytes10,EncLen10} = case Cindex10 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_object_identifier(?RT_BER:cindex(11,Val,'mechanism-name'), [{tag,128,9,'IMPLICIT',32}]) + encode_object_identifier(Cindex10, [<<137>>]) end, %%------------------------------------------------- -%% attribute number 11 External ACSE-1:Authentication-value OPTIONAL +%% attribute responding-authentication-value(11) External ACSE-1:Authentication-value OPTIONAL %%------------------------------------------------- - {EncBytes11,EncLen11} = case ?RT_BER:cindex(12,Val,'responding-authentication-value') of + {EncBytes11,EncLen11} = case Cindex11 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_Authentication-value'(?RT_BER:cindex(12,Val,'responding-authentication-value'), [{tag,128,10,'EXPLICIT',32}]) + 'enc_Authentication-value'(Cindex11, [<<170>>]) end, %%------------------------------------------------- -%% attribute number 12 External ACSE-1:Application-context-name-list OPTIONAL +%% attribute application-context-name-list(12) External ACSE-1:Application-context-name-list OPTIONAL %%------------------------------------------------- - {EncBytes12,EncLen12} = case ?RT_BER:cindex(13,Val,'application-context-name-list') of + {EncBytes12,EncLen12} = case Cindex12 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_Application-context-name-list'(?RT_BER:cindex(13,Val,'application-context-name-list'), [{tag,128,11,'IMPLICIT',32}]) + 'enc_Application-context-name-list'(Cindex12, [<<171>>]) end, %%------------------------------------------------- -%% attribute number 13 with type GraphicString OPTIONAL +%% attribute implementation-information(13) with type GraphicString OPTIONAL %%------------------------------------------------- - {EncBytes13,EncLen13} = case ?RT_BER:cindex(14,Val,'implementation-information') of + {EncBytes13,EncLen13} = case Cindex13 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_restricted_string([], ?RT_BER:cindex(14,Val,'implementation-information'), 25, [{tag,128,29,'IMPLICIT',32}]) + encode_restricted_string(Cindex13, [<<157>>]) end, %%------------------------------------------------- -%% attribute number 14 External ACSE-1:Association-information OPTIONAL +%% attribute user-information(14) External ACSE-1:Association-information OPTIONAL %%------------------------------------------------- - {EncBytes14,EncLen14} = case ?RT_BER:cindex(15,Val,'user-information') of + {EncBytes14,EncLen14} = case Cindex14 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_Association-information'(?RT_BER:cindex(15,Val,'user-information'), [{tag,128,30,'IMPLICIT',32}]) + 'enc_Association-information'(Cindex14, [<<190>>]) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4, EncBytes5, EncBytes6, EncBytes7, EncBytes8, EncBytes9, EncBytes10, EncBytes11, EncBytes12, EncBytes13, EncBytes14], - LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5 + EncLen6 + EncLen7 + EncLen8 + EncLen9 + EncLen10 + EncLen11 + EncLen12 + EncLen13 + EncLen14, - ?RT_BER:encode_tags(TagIn ++ [{tag,64,1,'IMPLICIT',32},{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5 + EncLen6 + EncLen7 + EncLen8 + EncLen9 + EncLen10 + EncLen11 + EncLen12 + EncLen13 + EncLen14, +encode_tags(TagIn, BytesSoFar, LenSoFar). -'dec_AARE-apdu'(Bytes, OptOrMand) -> - 'dec_AARE-apdu'(Bytes, OptOrMand, []). +'dec_AARE-apdu'(Tlv) -> + 'dec_AARE-apdu'(Tlv, [65537]). -'dec_AARE-apdu'(Bytes, OptOrMand, TagIn) -> +'dec_AARE-apdu'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,64,1,'IMPLICIT',32},{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 with type BIT STRING DEFAULT = [version1] +%% attribute protocol-version(1) with type BIT STRING DEFAULT = [version1] %%------------------------------------------------- - {Term1,Bytes3,Rb2} = case Bytes2 of -<<2:2,_:1,0:5,_/binary>> -> -?RT_BER:decode_bit_string(Bytes2,[],[{version1,0}],[{tag,128,0,'IMPLICIT',32}], no_length, mandatory); -_ -> -{[version1],Bytes2, 0 } +{Term1,Tlv2} = case Tlv1 of +[{131072,V1}|TempTlv2] -> + {decode_named_bit_string(V1, [{version1,0}], []), TempTlv2}; + _ -> + {[version1],Tlv1} end, %%------------------------------------------------- -%% attribute number 2 with type OBJECT IDENTIFIER +%% attribute application-context-name(2) with type OBJECT IDENTIFIER %%------------------------------------------------- - {Term2,Bytes4,Rb3} = ?RT_BER:decode_object_identifier(Bytes3,[{tag,128,1,'EXPLICIT',32}], mandatory), +[V2|Tlv3] = Tlv2, +Term2 = decode_object_identifier(V2, [131073,6]), %%------------------------------------------------- -%% attribute number 3 with type INTEGER +%% attribute result(3) with type INTEGER %%------------------------------------------------- - {Term3,Bytes5,Rb4} = ?RT_BER:decode_integer(Bytes4,[],[{accepted,0},{'rejected-permanent',1},{'rejected-transient',2}],[{tag,128,2,'EXPLICIT',32}], mandatory), +[V3|Tlv4] = Tlv3, +Term3 = begin +Val1 = decode_integer(V3, [131074,2]), +number2name(Val1, [{accepted,0},{'rejected-permanent',1},{'rejected-transient',2}]) +end +, %%------------------------------------------------- -%% attribute number 4 External ACSE-1:Associate-source-diagnostic +%% attribute result-source-diagnostic(4) External ACSE-1:Associate-source-diagnostic %%------------------------------------------------- - {Term4,Bytes6,Rb5} = 'dec_Associate-source-diagnostic'(Bytes5, mandatory, [{tag,128,3,'EXPLICIT',32}]), +[V4|Tlv5] = Tlv4, +Term4 = 'dec_Associate-source-diagnostic'(V4, [131075]), %%------------------------------------------------- -%% attribute number 5 External ACSE-1:AP-title OPTIONAL +%% attribute responding-AP-title(5) External ACSE-1:AP-title OPTIONAL %%------------------------------------------------- - {Term5,Bytes7,Rb6} = case Bytes6 of -<<2:2,_:1,4:5,_/binary>> -> -'dec_AP-title'(Bytes6, opt_or_default, [{tag,128,4,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes6, 0 } +{Term5,Tlv6} = case Tlv5 of +[{131076,V5}|TempTlv6] -> + {'dec_AP-title'(V5, []), TempTlv6}; + _ -> + { asn1_NOVALUE, Tlv5} end, %%------------------------------------------------- -%% attribute number 6 External ACSE-1:AE-qualifier OPTIONAL +%% attribute responding-AE-qualifier(6) External ACSE-1:AE-qualifier OPTIONAL %%------------------------------------------------- - {Term6,Bytes8,Rb7} = case Bytes7 of -<<2:2,_:1,5:5,_/binary>> -> -'dec_AE-qualifier'(Bytes7, opt_or_default, [{tag,128,5,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes7, 0 } +{Term6,Tlv7} = case Tlv6 of +[{131077,V6}|TempTlv7] -> + {'dec_AE-qualifier'(V6, []), TempTlv7}; + _ -> + { asn1_NOVALUE, Tlv6} end, %%------------------------------------------------- -%% attribute number 7 with type INTEGER OPTIONAL +%% attribute responding-AP-invocation-identifier(7) with type INTEGER OPTIONAL %%------------------------------------------------- - {Term7,Bytes9,Rb8} = case Bytes8 of -<<2:2,_:1,6:5,_/binary>> -> -?RT_BER:decode_integer(Bytes8,[],[{tag,128,6,'EXPLICIT',32}], mandatory); -_ -> -{ asn1_NOVALUE, Bytes8, 0 } +{Term7,Tlv8} = case Tlv7 of +[{131078,V7}|TempTlv8] -> + {decode_integer(V7, [2]), TempTlv8}; + _ -> + { asn1_NOVALUE, Tlv7} end, %%------------------------------------------------- -%% attribute number 8 with type INTEGER OPTIONAL +%% attribute responding-AE-invocation-identifier(8) with type INTEGER OPTIONAL %%------------------------------------------------- - {Term8,Bytes10,Rb9} = case Bytes9 of -<<2:2,_:1,7:5,_/binary>> -> -?RT_BER:decode_integer(Bytes9,[],[{tag,128,7,'EXPLICIT',32}], mandatory); -_ -> -{ asn1_NOVALUE, Bytes9, 0 } +{Term8,Tlv9} = case Tlv8 of +[{131079,V8}|TempTlv9] -> + {decode_integer(V8, [2]), TempTlv9}; + _ -> + { asn1_NOVALUE, Tlv8} end, %%------------------------------------------------- -%% attribute number 9 with type BIT STRING OPTIONAL +%% attribute responder-acse-requirements(9) with type BIT STRING OPTIONAL %%------------------------------------------------- - {Term9,Bytes11,Rb10} = case Bytes10 of -<<2:2,_:1,8:5,_/binary>> -> -?RT_BER:decode_bit_string(Bytes10,[],[{authentication,0},{'application-context-negotiation',1}],[{tag,128,8,'IMPLICIT',32}], no_length, mandatory); -_ -> -{ asn1_NOVALUE, Bytes10, 0 } +{Term9,Tlv10} = case Tlv9 of +[{131080,V9}|TempTlv10] -> + {decode_named_bit_string(V9, [{authentication,0},{'application-context-negotiation',1}], []), TempTlv10}; + _ -> + { asn1_NOVALUE, Tlv9} end, %%------------------------------------------------- -%% attribute number 10 with type OBJECT IDENTIFIER OPTIONAL +%% attribute mechanism-name(10) with type OBJECT IDENTIFIER OPTIONAL %%------------------------------------------------- - {Term10,Bytes12,Rb11} = case Bytes11 of -<<2:2,_:1,9:5,_/binary>> -> -?RT_BER:decode_object_identifier(Bytes11,[{tag,128,9,'IMPLICIT',32}], mandatory); -_ -> -{ asn1_NOVALUE, Bytes11, 0 } +{Term10,Tlv11} = case Tlv10 of +[{131081,V10}|TempTlv11] -> + {decode_object_identifier(V10, []), TempTlv11}; + _ -> + { asn1_NOVALUE, Tlv10} end, %%------------------------------------------------- -%% attribute number 11 External ACSE-1:Authentication-value OPTIONAL +%% attribute responding-authentication-value(11) External ACSE-1:Authentication-value OPTIONAL %%------------------------------------------------- - {Term11,Bytes13,Rb12} = case Bytes12 of -<<2:2,_:1,10:5,_/binary>> -> -'dec_Authentication-value'(Bytes12, opt_or_default, [{tag,128,10,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes12, 0 } +{Term11,Tlv12} = case Tlv11 of +[{131082,V11}|TempTlv12] -> + {'dec_Authentication-value'(V11, []), TempTlv12}; + _ -> + { asn1_NOVALUE, Tlv11} end, %%------------------------------------------------- -%% attribute number 12 External ACSE-1:Application-context-name-list OPTIONAL +%% attribute application-context-name-list(12) External ACSE-1:Application-context-name-list OPTIONAL %%------------------------------------------------- - {Term12,Bytes14,Rb13} = case Bytes13 of -<<2:2,_:1,11:5,_/binary>> -> -'dec_Application-context-name-list'(Bytes13, opt_or_default, [{tag,128,11,'IMPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes13, 0 } +{Term12,Tlv13} = case Tlv12 of +[{131083,V12}|TempTlv13] -> + {'dec_Application-context-name-list'(V12, []), TempTlv13}; + _ -> + { asn1_NOVALUE, Tlv12} end, %%------------------------------------------------- -%% attribute number 13 with type GraphicString OPTIONAL +%% attribute implementation-information(13) with type GraphicString OPTIONAL %%------------------------------------------------- - {Term13,Bytes15,Rb14} = case Bytes14 of -<<2:2,_:1,29:5,_/binary>> -> -?RT_BER:decode_restricted_string(Bytes14,[],25,[{tag,128,29,'IMPLICIT',32}], no_length, mandatory); -_ -> -{ asn1_NOVALUE, Bytes14, 0 } +{Term13,Tlv14} = case Tlv13 of +[{131101,V13}|TempTlv14] -> + {begin +binary_to_list(decode_restricted_string(V13, [])) +end +, TempTlv14}; + _ -> + { asn1_NOVALUE, Tlv13} end, - {Bytes16, Rb15} = ?RT_BER:skip_ExtensionAdditions(Bytes15, [{tag,128,30,'IMPLICIT',32}]), +Tlv15 = skip_ExtensionAdditions(Tlv14, [131102]), %%------------------------------------------------- -%% attribute number 13 External ACSE-1:Association-information OPTIONAL +%% attribute user-information(13) External ACSE-1:Association-information OPTIONAL %%------------------------------------------------- - {Term14,Bytes17,Rb16} = case Bytes16 of -<<2:2,_:1,30:5,_/binary>> -> -'dec_Association-information'(Bytes16, opt_or_default, [{tag,128,30,'IMPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes16, 0 } +{Term14,Tlv16} = case Tlv15 of +[{131102,V14}|TempTlv16] -> + {'dec_Association-information'(V14, []), TempTlv16}; + _ -> + { asn1_NOVALUE, Tlv15} end, - {Bytes18,Rb17} = ?RT_BER:restbytes2(RemBytes, Bytes17,noext), - {{'AARE-apdu', Term1, Term2, Term3, Term4, Term5, Term6, Term7, Term8, Term9, Term10, Term11, Term12, Term13, Term14}, Bytes18, Rb1+Rb2+Rb3+Rb4+Rb5+Rb6+Rb7+Rb8+Rb9+Rb10+Rb11+Rb12+Rb13+Rb14+Rb15+Rb16+Rb17}. +case Tlv16 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv16}}}) % extra fields not allowed +end, + {'AARE-apdu', Term1, Term2, Term3, Term4, Term5, Term6, Term7, Term8, Term9, Term10, Term11, Term12, Term13, Term14}. + %%================================ %% RLRQ-apdu %%================================ +'enc_RLRQ-apdu'(Val) -> + 'enc_RLRQ-apdu'(Val, [<<98>>]). + 'enc_RLRQ-apdu'(Val, TagIn) -> +{_,Cindex1, Cindex2} = Val, %%------------------------------------------------- -%% attribute number 1 with type INTEGER OPTIONAL +%% attribute reason(1) with type INTEGER OPTIONAL %%------------------------------------------------- - {EncBytes1,EncLen1} = case ?RT_BER:cindex(2,Val,reason) of + {EncBytes1,EncLen1} = case Cindex1 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_integer([], ?RT_BER:cindex(2,Val,reason), [{normal,0},{urgent,1},{'user-defined',30}], [{tag,128,0,'IMPLICIT',32}]) + encode_integer(Cindex1, [{normal,0},{urgent,1},{'user-defined',30}], [<<128>>]) end, %%------------------------------------------------- -%% attribute number 2 External ACSE-1:Association-information OPTIONAL +%% attribute user-information(2) External ACSE-1:Association-information OPTIONAL %%------------------------------------------------- - {EncBytes2,EncLen2} = case ?RT_BER:cindex(3,Val,'user-information') of + {EncBytes2,EncLen2} = case Cindex2 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_Association-information'(?RT_BER:cindex(3,Val,'user-information'), [{tag,128,30,'IMPLICIT',32}]) + 'enc_Association-information'(Cindex2, [<<190>>]) end, BytesSoFar = [EncBytes1, EncBytes2], - LenSoFar = EncLen1 + EncLen2, - ?RT_BER:encode_tags(TagIn ++ [{tag,64,2,'IMPLICIT',32},{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2, +encode_tags(TagIn, BytesSoFar, LenSoFar). -'dec_RLRQ-apdu'(Bytes, OptOrMand) -> - 'dec_RLRQ-apdu'(Bytes, OptOrMand, []). +'dec_RLRQ-apdu'(Tlv) -> + 'dec_RLRQ-apdu'(Tlv, [65538]). -'dec_RLRQ-apdu'(Bytes, OptOrMand, TagIn) -> +'dec_RLRQ-apdu'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,64,2,'IMPLICIT',32},{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 with type INTEGER OPTIONAL +%% attribute reason(1) with type INTEGER OPTIONAL %%------------------------------------------------- - {Term1,Bytes3,Rb2} = case Bytes2 of -<<2:2,_:1,0:5,_/binary>> -> -?RT_BER:decode_integer(Bytes2,[],[{normal,0},{urgent,1},{'user-defined',30}],[{tag,128,0,'IMPLICIT',32}], mandatory); -_ -> -{ asn1_NOVALUE, Bytes2, 0 } +{Term1,Tlv2} = case Tlv1 of +[{131072,V1}|TempTlv2] -> + {begin +Val1 = decode_integer(V1, []), +number2name(Val1, [{normal,0},{urgent,1},{'user-defined',30}]) +end +, TempTlv2}; + _ -> + { asn1_NOVALUE, Tlv1} end, - {Bytes4, Rb3} = ?RT_BER:skip_ExtensionAdditions(Bytes3, [{tag,128,30,'IMPLICIT',32}]), +Tlv3 = skip_ExtensionAdditions(Tlv2, [131102]), %%------------------------------------------------- -%% attribute number 1 External ACSE-1:Association-information OPTIONAL +%% attribute user-information(1) External ACSE-1:Association-information OPTIONAL %%------------------------------------------------- - {Term2,Bytes5,Rb4} = case Bytes4 of -<<2:2,_:1,30:5,_/binary>> -> -'dec_Association-information'(Bytes4, opt_or_default, [{tag,128,30,'IMPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes4, 0 } +{Term2,Tlv4} = case Tlv3 of +[{131102,V2}|TempTlv4] -> + {'dec_Association-information'(V2, []), TempTlv4}; + _ -> + { asn1_NOVALUE, Tlv3} +end, + +case Tlv4 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowed end, + {'RLRQ-apdu', Term1, Term2}. - {Bytes6,Rb5} = ?RT_BER:restbytes2(RemBytes, Bytes5,noext), - {{'RLRQ-apdu', Term1, Term2}, Bytes6, Rb1+Rb2+Rb3+Rb4+Rb5}. %%================================ %% RLRE-apdu %%================================ +'enc_RLRE-apdu'(Val) -> + 'enc_RLRE-apdu'(Val, [<<99>>]). + 'enc_RLRE-apdu'(Val, TagIn) -> +{_,Cindex1, Cindex2} = Val, %%------------------------------------------------- -%% attribute number 1 with type INTEGER OPTIONAL +%% attribute reason(1) with type INTEGER OPTIONAL %%------------------------------------------------- - {EncBytes1,EncLen1} = case ?RT_BER:cindex(2,Val,reason) of + {EncBytes1,EncLen1} = case Cindex1 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_integer([], ?RT_BER:cindex(2,Val,reason), [{normal,0},{'not-finished',1},{'user-defined',30}], [{tag,128,0,'IMPLICIT',32}]) + encode_integer(Cindex1, [{normal,0},{'not-finished',1},{'user-defined',30}], [<<128>>]) end, %%------------------------------------------------- -%% attribute number 2 External ACSE-1:Association-information OPTIONAL +%% attribute user-information(2) External ACSE-1:Association-information OPTIONAL %%------------------------------------------------- - {EncBytes2,EncLen2} = case ?RT_BER:cindex(3,Val,'user-information') of + {EncBytes2,EncLen2} = case Cindex2 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_Association-information'(?RT_BER:cindex(3,Val,'user-information'), [{tag,128,30,'IMPLICIT',32}]) + 'enc_Association-information'(Cindex2, [<<190>>]) end, BytesSoFar = [EncBytes1, EncBytes2], - LenSoFar = EncLen1 + EncLen2, - ?RT_BER:encode_tags(TagIn ++ [{tag,64,3,'IMPLICIT',32},{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2, +encode_tags(TagIn, BytesSoFar, LenSoFar). -'dec_RLRE-apdu'(Bytes, OptOrMand) -> - 'dec_RLRE-apdu'(Bytes, OptOrMand, []). +'dec_RLRE-apdu'(Tlv) -> + 'dec_RLRE-apdu'(Tlv, [65539]). -'dec_RLRE-apdu'(Bytes, OptOrMand, TagIn) -> +'dec_RLRE-apdu'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,64,3,'IMPLICIT',32},{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 with type INTEGER OPTIONAL +%% attribute reason(1) with type INTEGER OPTIONAL %%------------------------------------------------- - {Term1,Bytes3,Rb2} = case Bytes2 of -<<2:2,_:1,0:5,_/binary>> -> -?RT_BER:decode_integer(Bytes2,[],[{normal,0},{'not-finished',1},{'user-defined',30}],[{tag,128,0,'IMPLICIT',32}], mandatory); -_ -> -{ asn1_NOVALUE, Bytes2, 0 } +{Term1,Tlv2} = case Tlv1 of +[{131072,V1}|TempTlv2] -> + {begin +Val1 = decode_integer(V1, []), +number2name(Val1, [{normal,0},{'not-finished',1},{'user-defined',30}]) +end +, TempTlv2}; + _ -> + { asn1_NOVALUE, Tlv1} end, - {Bytes4, Rb3} = ?RT_BER:skip_ExtensionAdditions(Bytes3, [{tag,128,30,'IMPLICIT',32}]), +Tlv3 = skip_ExtensionAdditions(Tlv2, [131102]), %%------------------------------------------------- -%% attribute number 1 External ACSE-1:Association-information OPTIONAL +%% attribute user-information(1) External ACSE-1:Association-information OPTIONAL %%------------------------------------------------- - {Term2,Bytes5,Rb4} = case Bytes4 of -<<2:2,_:1,30:5,_/binary>> -> -'dec_Association-information'(Bytes4, opt_or_default, [{tag,128,30,'IMPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes4, 0 } +{Term2,Tlv4} = case Tlv3 of +[{131102,V2}|TempTlv4] -> + {'dec_Association-information'(V2, []), TempTlv4}; + _ -> + { asn1_NOVALUE, Tlv3} +end, + +case Tlv4 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowed end, + {'RLRE-apdu', Term1, Term2}. - {Bytes6,Rb5} = ?RT_BER:restbytes2(RemBytes, Bytes5,noext), - {{'RLRE-apdu', Term1, Term2}, Bytes6, Rb1+Rb2+Rb3+Rb4+Rb5}. %%================================ %% ABRT-apdu %%================================ +'enc_ABRT-apdu'(Val) -> + 'enc_ABRT-apdu'(Val, [<<100>>]). + 'enc_ABRT-apdu'(Val, TagIn) -> +{_,Cindex1, Cindex2, Cindex3} = Val, %%------------------------------------------------- -%% attribute number 1 with type INTEGER +%% attribute abort-source(1) with type INTEGER %%------------------------------------------------- - {EncBytes1,EncLen1} = ?RT_BER:encode_integer([], ?RT_BER:cindex(2,Val,'abort-source'), [{'acse-service-user',0},{'acse-service-provider',1}], [{tag,128,0,'IMPLICIT',32}]), + {EncBytes1,EncLen1} = encode_integer(Cindex1, [{'acse-service-user',0},{'acse-service-provider',1}], [<<128>>]), %%------------------------------------------------- -%% attribute number 2 with type ENUMERATED OPTIONAL +%% attribute abort-diagnostic(2) with type ENUMERATED OPTIONAL %%------------------------------------------------- - {EncBytes2,EncLen2} = case ?RT_BER:cindex(3,Val,'abort-diagnostic') of + {EncBytes2,EncLen2} = case Cindex2 of asn1_NOVALUE -> {<<>>,0}; _ -> - case (case ?RT_BER:cindex(3,Val,'abort-diagnostic') of {_,Enumval2}->Enumval2;_->?RT_BER:cindex(3,Val,'abort-diagnostic') end) of -'no-reason-given' -> ?RT_BER:encode_enumerated(1,[{tag,128,1,'IMPLICIT',32}]); -'protocol-error' -> ?RT_BER:encode_enumerated(2,[{tag,128,1,'IMPLICIT',32}]); -'authentication-mechanism-name-not-recognized' -> ?RT_BER:encode_enumerated(3,[{tag,128,1,'IMPLICIT',32}]); -'authentication-mechanism-name-required' -> ?RT_BER:encode_enumerated(4,[{tag,128,1,'IMPLICIT',32}]); -'authentication-failure' -> ?RT_BER:encode_enumerated(5,[{tag,128,1,'IMPLICIT',32}]); -'authentication-required' -> ?RT_BER:encode_enumerated(6,[{tag,128,1,'IMPLICIT',32}]); -Enumval3 -> exit({error,{asn1, {enumerated_not_in_range,Enumval3}}}) + case Cindex2 of +'no-reason-given' -> encode_tags([<<129>>], [1], 1); +'protocol-error' -> encode_tags([<<129>>], [2], 1); +'authentication-mechanism-name-not-recognized' -> encode_tags([<<129>>], [3], 1); +'authentication-mechanism-name-required' -> encode_tags([<<129>>], [4], 1); +'authentication-failure' -> encode_tags([<<129>>], [5], 1); +'authentication-required' -> encode_tags([<<129>>], [6], 1); +Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) end end, %%------------------------------------------------- -%% attribute number 3 External ACSE-1:Association-information OPTIONAL +%% attribute user-information(3) External ACSE-1:Association-information OPTIONAL %%------------------------------------------------- - {EncBytes3,EncLen3} = case ?RT_BER:cindex(4,Val,'user-information') of + {EncBytes3,EncLen3} = case Cindex3 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_Association-information'(?RT_BER:cindex(4,Val,'user-information'), [{tag,128,30,'IMPLICIT',32}]) + 'enc_Association-information'(Cindex3, [<<190>>]) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3], - LenSoFar = EncLen1 + EncLen2 + EncLen3, - ?RT_BER:encode_tags(TagIn ++ [{tag,64,4,'IMPLICIT',32},{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2 + EncLen3, +encode_tags(TagIn, BytesSoFar, LenSoFar). -'dec_ABRT-apdu'(Bytes, OptOrMand) -> - 'dec_ABRT-apdu'(Bytes, OptOrMand, []). +'dec_ABRT-apdu'(Tlv) -> + 'dec_ABRT-apdu'(Tlv, [65540]). -'dec_ABRT-apdu'(Bytes, OptOrMand, TagIn) -> +'dec_ABRT-apdu'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,64,4,'IMPLICIT',32},{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 with type INTEGER +%% attribute abort-source(1) with type INTEGER %%------------------------------------------------- - {Term1,Bytes3,Rb2} = ?RT_BER:decode_integer(Bytes2,[],[{'acse-service-user',0},{'acse-service-provider',1}],[{tag,128,0,'IMPLICIT',32}], mandatory), +[V1|Tlv2] = Tlv1, +Term1 = begin +Val1 = decode_integer(V1, [131072]), +number2name(Val1, [{'acse-service-user',0},{'acse-service-provider',1}]) +end +, + +%%------------------------------------------------- +%% attribute abort-diagnostic(2) with type ENUMERATED OPTIONAL +%%------------------------------------------------- +{Term2,Tlv3} = case Tlv2 of +[{131073,V2}|TempTlv3] -> + {case decode_integer(V2, []) of +1 -> 'no-reason-given'; +2 -> 'protocol-error'; +3 -> 'authentication-mechanism-name-not-recognized'; +4 -> 'authentication-mechanism-name-required'; +5 -> 'authentication-failure'; +6 -> 'authentication-required'; +Default1 -> {asn1_enum,Default1} +end, TempTlv3}; + _ -> + { asn1_NOVALUE, Tlv2} +end, +Tlv4 = skip_ExtensionAdditions(Tlv3, [131102]), %%------------------------------------------------- -%% attribute number 2 with type ENUMERATED OPTIONAL +%% attribute user-information(2) External ACSE-1:Association-information OPTIONAL %%------------------------------------------------- - {Term2,Bytes4,Rb3} = case Bytes3 of -<<2:2,_:1,1:5,_/binary>> -> -?RT_BER:decode_enumerated(Bytes3,[],{[{'no-reason-given',1},{'protocol-error',2},{'authentication-mechanism-name-not-recognized',3},{'authentication-mechanism-name-required',4},{'authentication-failure',5},{'authentication-required',6}],[]},[{tag,128,1,'IMPLICIT',32}], mandatory); -_ -> -{ asn1_NOVALUE, Bytes3, 0 } +{Term3,Tlv5} = case Tlv4 of +[{131102,V3}|TempTlv5] -> + {'dec_Association-information'(V3, []), TempTlv5}; + _ -> + { asn1_NOVALUE, Tlv4} end, - {Bytes5, Rb4} = ?RT_BER:skip_ExtensionAdditions(Bytes4, [{tag,128,30,'IMPLICIT',32}]), -%%------------------------------------------------- -%% attribute number 2 External ACSE-1:Association-information OPTIONAL -%%------------------------------------------------- - {Term3,Bytes6,Rb5} = case Bytes5 of -<<2:2,_:1,30:5,_/binary>> -> -'dec_Association-information'(Bytes5, opt_or_default, [{tag,128,30,'IMPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes5, 0 } +case Tlv5 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv5}}}) % extra fields not allowed end, + {'ABRT-apdu', Term1, Term2, Term3}. - {Bytes7,Rb6} = ?RT_BER:restbytes2(RemBytes, Bytes6,noext), - {{'ABRT-apdu', Term1, Term2, Term3}, Bytes7, Rb1+Rb2+Rb3+Rb4+Rb5+Rb6}. %%================================ %% ABRT-diagnostic %%================================ - -'enc_ABRT-diagnostic'({'ABRT-diagnostic',Val}, TagIn) -> - 'enc_ABRT-diagnostic'(Val, TagIn); +'enc_ABRT-diagnostic'(Val) -> + 'enc_ABRT-diagnostic'(Val, [<<10>>]). 'enc_ABRT-diagnostic'(Val, TagIn) -> -case (case Val of {_,Enumval1}->Enumval1;_->Val end) of -'no-reason-given' -> ?RT_BER:encode_enumerated(1,TagIn ++ []); -'protocol-error' -> ?RT_BER:encode_enumerated(2,TagIn ++ []); -'authentication-mechanism-name-not-recognized' -> ?RT_BER:encode_enumerated(3,TagIn ++ []); -'authentication-mechanism-name-required' -> ?RT_BER:encode_enumerated(4,TagIn ++ []); -'authentication-failure' -> ?RT_BER:encode_enumerated(5,TagIn ++ []); -'authentication-required' -> ?RT_BER:encode_enumerated(6,TagIn ++ []); -Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) +case Val of +'no-reason-given' -> encode_tags(TagIn, [1], 1); +'protocol-error' -> encode_tags(TagIn, [2], 1); +'authentication-mechanism-name-not-recognized' -> encode_tags(TagIn, [3], 1); +'authentication-mechanism-name-required' -> encode_tags(TagIn, [4], 1); +'authentication-failure' -> encode_tags(TagIn, [5], 1); +'authentication-required' -> encode_tags(TagIn, [6], 1); +Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}}) end. -'dec_ABRT-diagnostic'(Bytes, OptOrMand) -> - 'dec_ABRT-diagnostic'(Bytes, OptOrMand, []). +'dec_ABRT-diagnostic'(Tlv) -> + 'dec_ABRT-diagnostic'(Tlv, [10]). -'dec_ABRT-diagnostic'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_enumerated(Bytes,[],{[{'no-reason-given',1},{'protocol-error',2},{'authentication-mechanism-name-not-recognized',3},{'authentication-mechanism-name-required',4},{'authentication-failure',5},{'authentication-required',6}],[]},TagIn++[], OptOrMand). +'dec_ABRT-diagnostic'(Tlv, TagIn) -> +case decode_integer(Tlv, TagIn) of +1 -> 'no-reason-given'; +2 -> 'protocol-error'; +3 -> 'authentication-mechanism-name-not-recognized'; +4 -> 'authentication-mechanism-name-required'; +5 -> 'authentication-failure'; +6 -> 'authentication-required'; +Default1 -> {asn1_enum,Default1} +end. %%================================ %% ABRT-source %%================================ - -'enc_ABRT-source'({'ABRT-source',Val}, TagIn) -> - 'enc_ABRT-source'(Val, TagIn); +'enc_ABRT-source'(Val) -> + 'enc_ABRT-source'(Val, [<<2>>]). 'enc_ABRT-source'(Val, TagIn) -> -?RT_BER:encode_integer([], Val, [{'acse-service-user',0},{'acse-service-provider',1}], TagIn ++ []). +encode_integer(Val, [{'acse-service-user',0},{'acse-service-provider',1}], TagIn). -'dec_ABRT-source'(Bytes, OptOrMand) -> - 'dec_ABRT-source'(Bytes, OptOrMand, []). +'dec_ABRT-source'(Tlv) -> + 'dec_ABRT-source'(Tlv, [2]). -'dec_ABRT-source'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_integer(Bytes,[],[{'acse-service-user',0},{'acse-service-provider',1}],TagIn++[], OptOrMand). +'dec_ABRT-source'(Tlv, TagIn) -> +begin +Val1 = decode_integer(Tlv, TagIn), +number2name(Val1, [{'acse-service-user',0},{'acse-service-provider',1}]) +end +. %%================================ %% ACSE-requirements %%================================ - -'enc_ACSE-requirements'({'ACSE-requirements',Val}, TagIn) -> - 'enc_ACSE-requirements'(Val, TagIn); +'enc_ACSE-requirements'(Val) -> + 'enc_ACSE-requirements'(Val, [<<3>>]). 'enc_ACSE-requirements'(Val, TagIn) -> -?RT_BER:encode_bit_string([], Val, [{authentication,0},{'application-context-negotiation',1}], TagIn ++ []). +encode_named_bit_string(Val, [{authentication,0},{'application-context-negotiation',1}], TagIn). -'dec_ACSE-requirements'(Bytes, OptOrMand) -> - 'dec_ACSE-requirements'(Bytes, OptOrMand, []). +'dec_ACSE-requirements'(Tlv) -> + 'dec_ACSE-requirements'(Tlv, [3]). -'dec_ACSE-requirements'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_bit_string(Bytes,[],[{authentication,0},{'application-context-negotiation',1}],TagIn++[], no_length, OptOrMand). +'dec_ACSE-requirements'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{authentication,0},{'application-context-negotiation',1}], TagIn). %%================================ %% Application-context-name-list %%================================ - -'enc_Application-context-name-list'({'Application-context-name-list',Val}, TagIn) -> - 'enc_Application-context-name-list'(Val, TagIn); +'enc_Application-context-name-list'(Val) -> + 'enc_Application-context-name-list'(Val, [<<48>>]). 'enc_Application-context-name-list'(Val, TagIn) -> {EncBytes,EncLen} = 'enc_Application-context-name-list_components'(Val,[],0), - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], EncBytes, EncLen). + encode_tags(TagIn, EncBytes, EncLen). 'enc_Application-context-name-list_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_Application-context-name-list_components'([H|T],AccBytes, AccLen) -> - {EncBytes,EncLen} = ?RT_BER:encode_object_identifier(H, []), + {EncBytes,EncLen} = encode_object_identifier(H, [<<6>>]), 'enc_Application-context-name-list_components'(T,[EncBytes|AccBytes], AccLen + EncLen). -'dec_Application-context-name-list'(Bytes, OptOrMand) -> - 'dec_Application-context-name-list'(Bytes, OptOrMand, []). +'dec_Application-context-name-list'(Tlv) -> + 'dec_Application-context-name-list'(Tlv, [16]). -'dec_Application-context-name-list'(Bytes, OptOrMand, TagIn) -> +'dec_Application-context-name-list'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), - ?RT_BER:decode_components(Rb1, Len, Bytes1, fun(FBytes,_,_)-> -?RT_BER:decode_object_identifier(FBytes,[], mandatory) -end, [], []). +Tlv1 = match_tags(Tlv, TagIn), +[decode_object_identifier(V1, [6]) || V1 <- Tlv1]. @@ -1220,413 +1252,395 @@ end, [], []). %%================================ %% Application-context-name %%================================ - -'enc_Application-context-name'({'Application-context-name',Val}, TagIn) -> - 'enc_Application-context-name'(Val, TagIn); +'enc_Application-context-name'(Val) -> + 'enc_Application-context-name'(Val, [<<6>>]). 'enc_Application-context-name'(Val, TagIn) -> -?RT_BER:encode_object_identifier(Val, TagIn ++ []). +encode_object_identifier(Val, TagIn). -'dec_Application-context-name'(Bytes, OptOrMand) -> - 'dec_Application-context-name'(Bytes, OptOrMand, []). +'dec_Application-context-name'(Tlv) -> + 'dec_Application-context-name'(Tlv, [6]). -'dec_Application-context-name'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_object_identifier(Bytes,TagIn++[], OptOrMand). +'dec_Application-context-name'(Tlv, TagIn) -> +decode_object_identifier(Tlv, TagIn). %%================================ %% AP-title %%================================ - -'enc_AP-title'({'AP-title',Val}, TagIn) -> - 'enc_AP-title'(Val, TagIn); +'enc_AP-title'(Val) -> + 'enc_AP-title'(Val, []). 'enc_AP-title'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of 'ap-title-form1' -> 'enc_AP-title-form1'(element(2,Val), []); 'ap-title-form2' -> - ?RT_BER:encode_object_identifier(element(2,Val), []); + encode_object_identifier(element(2,Val), [<<6>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). +encode_tags(TagIn, EncBytes, EncLen). -'dec_AP-title'(Bytes, OptOrMand) -> - 'dec_AP-title'(Bytes, OptOrMand, []). +'dec_AP-title'(Tlv) -> + 'dec_AP-title'(Tlv, []). -'dec_AP-title'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of +'dec_AP-title'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of %% 'ap-title-form1' - <<0:2,_:1,16:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_AP-title-form1'(Bytes1, mandatory, []), - {{'ap-title-form1', Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + V1 = {16,_} -> + {'ap-title-form1', 'dec_AP-title-form1'(V1, [])}; %% 'ap-title-form2' - <<0:2,_:1,6:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_object_identifier(Bytes1,[], mandatory), - {{'ap-title-form2', Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {6, V1} -> + {'ap-title-form2', decode_object_identifier(V1, [])}; - _ -> - {{asn1_ExtAlt,Bytes1},<<>>, RbExp} - end. + Else -> + {asn1_ExtAlt,ber_encode(Else)} + end +. %%================================ %% AE-qualifier %%================================ - -'enc_AE-qualifier'({'AE-qualifier',Val}, TagIn) -> - 'enc_AE-qualifier'(Val, TagIn); +'enc_AE-qualifier'(Val) -> + 'enc_AE-qualifier'(Val, []). 'enc_AE-qualifier'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of 'ae-qualifier-form1' -> - 'enc_AE-qualifier-form1'(element(2,Val), []); + 'enc_AE-qualifier-form1'(element(2,Val), [<<49>>]); 'ae-qualifier-form2' -> - ?RT_BER:encode_integer([], element(2,Val), []); + encode_integer(element(2,Val), [<<2>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). +encode_tags(TagIn, EncBytes, EncLen). -'dec_AE-qualifier'(Bytes, OptOrMand) -> - 'dec_AE-qualifier'(Bytes, OptOrMand, []). +'dec_AE-qualifier'(Tlv) -> + 'dec_AE-qualifier'(Tlv, []). -'dec_AE-qualifier'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of +'dec_AE-qualifier'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of %% 'ae-qualifier-form1' - <<0:2,_:1,17:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_AE-qualifier-form1'(Bytes1, mandatory, []), - {{'ae-qualifier-form1', Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {17, V1} -> + {'ae-qualifier-form1', 'dec_AE-qualifier-form1'(V1, [])}; %% 'ae-qualifier-form2' - <<0:2,_:1,2:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_integer(Bytes1,[],[], mandatory), - {{'ae-qualifier-form2', Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {2, V1} -> + {'ae-qualifier-form2', decode_integer(V1, [])}; - _ -> - {{asn1_ExtAlt,Bytes1},<<>>, RbExp} - end. + Else -> + {asn1_ExtAlt,ber_encode(Else)} + end +. %%================================ %% AP-title-form1 %%================================ - -'enc_AP-title-form1'({'AP-title-form1',Val}, TagIn) -> - 'enc_AP-title-form1'(Val, TagIn); +'enc_AP-title-form1'(Val) -> + 'enc_AP-title-form1'(Val, []). 'enc_AP-title-form1'(Val, TagIn) -> - 'InformationFramework':'enc_Name'(Val, TagIn ++ []). + 'InformationFramework':'enc_Name'(Val, TagIn). -'dec_AP-title-form1'(Bytes, OptOrMand) -> - 'dec_AP-title-form1'(Bytes, OptOrMand, []). +'dec_AP-title-form1'(Tlv) -> + 'dec_AP-title-form1'(Tlv, []). -'dec_AP-title-form1'(Bytes, OptOrMand, TagIn) -> -'InformationFramework':'dec_Name'(Bytes, OptOrMand, TagIn++[]). +'dec_AP-title-form1'(Tlv, TagIn) -> +'InformationFramework':'dec_Name'(Tlv, TagIn). %%================================ %% AE-qualifier-form1 %%================================ - -'enc_AE-qualifier-form1'({'AE-qualifier-form1',Val}, TagIn) -> - 'enc_AE-qualifier-form1'(Val, TagIn); +'enc_AE-qualifier-form1'(Val) -> + 'enc_AE-qualifier-form1'(Val, [<<49>>]). 'enc_AE-qualifier-form1'(Val, TagIn) -> - 'InformationFramework':'enc_RelativeDistinguishedName'(Val, TagIn ++ []). + 'InformationFramework':'enc_RelativeDistinguishedName'(Val, TagIn). -'dec_AE-qualifier-form1'(Bytes, OptOrMand) -> - 'dec_AE-qualifier-form1'(Bytes, OptOrMand, []). +'dec_AE-qualifier-form1'(Tlv) -> + 'dec_AE-qualifier-form1'(Tlv, [17]). -'dec_AE-qualifier-form1'(Bytes, OptOrMand, TagIn) -> -'InformationFramework':'dec_RelativeDistinguishedName'(Bytes, OptOrMand, TagIn++[]). +'dec_AE-qualifier-form1'(Tlv, TagIn) -> +'InformationFramework':'dec_RelativeDistinguishedName'(Tlv, TagIn). %%================================ %% AP-title-form2 %%================================ - -'enc_AP-title-form2'({'AP-title-form2',Val}, TagIn) -> - 'enc_AP-title-form2'(Val, TagIn); +'enc_AP-title-form2'(Val) -> + 'enc_AP-title-form2'(Val, [<<6>>]). 'enc_AP-title-form2'(Val, TagIn) -> -?RT_BER:encode_object_identifier(Val, TagIn ++ []). +encode_object_identifier(Val, TagIn). -'dec_AP-title-form2'(Bytes, OptOrMand) -> - 'dec_AP-title-form2'(Bytes, OptOrMand, []). +'dec_AP-title-form2'(Tlv) -> + 'dec_AP-title-form2'(Tlv, [6]). -'dec_AP-title-form2'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_object_identifier(Bytes,TagIn++[], OptOrMand). +'dec_AP-title-form2'(Tlv, TagIn) -> +decode_object_identifier(Tlv, TagIn). %%================================ %% AE-qualifier-form2 %%================================ - -'enc_AE-qualifier-form2'({'AE-qualifier-form2',Val}, TagIn) -> - 'enc_AE-qualifier-form2'(Val, TagIn); +'enc_AE-qualifier-form2'(Val) -> + 'enc_AE-qualifier-form2'(Val, [<<2>>]). 'enc_AE-qualifier-form2'(Val, TagIn) -> -?RT_BER:encode_integer([], Val, TagIn ++ []). +encode_integer(Val, TagIn). -'dec_AE-qualifier-form2'(Bytes, OptOrMand) -> - 'dec_AE-qualifier-form2'(Bytes, OptOrMand, []). +'dec_AE-qualifier-form2'(Tlv) -> + 'dec_AE-qualifier-form2'(Tlv, [2]). -'dec_AE-qualifier-form2'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_integer(Bytes,[],TagIn++[], OptOrMand). +'dec_AE-qualifier-form2'(Tlv, TagIn) -> +decode_integer(Tlv, TagIn). %%================================ %% AE-title %%================================ - -'enc_AE-title'({'AE-title',Val}, TagIn) -> - 'enc_AE-title'(Val, TagIn); +'enc_AE-title'(Val) -> + 'enc_AE-title'(Val, []). 'enc_AE-title'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of 'ae-title-form1' -> 'enc_AE-title-form1'(element(2,Val), []); 'ae-title-form2' -> - ?RT_BER:encode_object_identifier(element(2,Val), []); + encode_object_identifier(element(2,Val), [<<6>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). +encode_tags(TagIn, EncBytes, EncLen). -'dec_AE-title'(Bytes, OptOrMand) -> - 'dec_AE-title'(Bytes, OptOrMand, []). +'dec_AE-title'(Tlv) -> + 'dec_AE-title'(Tlv, []). -'dec_AE-title'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of +'dec_AE-title'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of %% 'ae-title-form1' - <<0:2,_:1,16:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_AE-title-form1'(Bytes1, mandatory, []), - {{'ae-title-form1', Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + V1 = {16,_} -> + {'ae-title-form1', 'dec_AE-title-form1'(V1, [])}; %% 'ae-title-form2' - <<0:2,_:1,6:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_object_identifier(Bytes1,[], mandatory), - {{'ae-title-form2', Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {6, V1} -> + {'ae-title-form2', decode_object_identifier(V1, [])}; - _ -> - {{asn1_ExtAlt,Bytes1},<<>>, RbExp} - end. + Else -> + {asn1_ExtAlt,ber_encode(Else)} + end +. %%================================ %% AE-title-form1 %%================================ - -'enc_AE-title-form1'({'AE-title-form1',Val}, TagIn) -> - 'enc_AE-title-form1'(Val, TagIn); +'enc_AE-title-form1'(Val) -> + 'enc_AE-title-form1'(Val, []). 'enc_AE-title-form1'(Val, TagIn) -> - 'InformationFramework':'enc_Name'(Val, TagIn ++ []). + 'InformationFramework':'enc_Name'(Val, TagIn). -'dec_AE-title-form1'(Bytes, OptOrMand) -> - 'dec_AE-title-form1'(Bytes, OptOrMand, []). +'dec_AE-title-form1'(Tlv) -> + 'dec_AE-title-form1'(Tlv, []). -'dec_AE-title-form1'(Bytes, OptOrMand, TagIn) -> -'InformationFramework':'dec_Name'(Bytes, OptOrMand, TagIn++[]). +'dec_AE-title-form1'(Tlv, TagIn) -> +'InformationFramework':'dec_Name'(Tlv, TagIn). %%================================ %% AE-title-form2 %%================================ - -'enc_AE-title-form2'({'AE-title-form2',Val}, TagIn) -> - 'enc_AE-title-form2'(Val, TagIn); +'enc_AE-title-form2'(Val) -> + 'enc_AE-title-form2'(Val, [<<6>>]). 'enc_AE-title-form2'(Val, TagIn) -> -?RT_BER:encode_object_identifier(Val, TagIn ++ []). +encode_object_identifier(Val, TagIn). -'dec_AE-title-form2'(Bytes, OptOrMand) -> - 'dec_AE-title-form2'(Bytes, OptOrMand, []). +'dec_AE-title-form2'(Tlv) -> + 'dec_AE-title-form2'(Tlv, [6]). -'dec_AE-title-form2'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_object_identifier(Bytes,TagIn++[], OptOrMand). +'dec_AE-title-form2'(Tlv, TagIn) -> +decode_object_identifier(Tlv, TagIn). %%================================ %% AE-invocation-identifier %%================================ - -'enc_AE-invocation-identifier'({'AE-invocation-identifier',Val}, TagIn) -> - 'enc_AE-invocation-identifier'(Val, TagIn); +'enc_AE-invocation-identifier'(Val) -> + 'enc_AE-invocation-identifier'(Val, [<<2>>]). 'enc_AE-invocation-identifier'(Val, TagIn) -> -?RT_BER:encode_integer([], Val, TagIn ++ []). +encode_integer(Val, TagIn). -'dec_AE-invocation-identifier'(Bytes, OptOrMand) -> - 'dec_AE-invocation-identifier'(Bytes, OptOrMand, []). +'dec_AE-invocation-identifier'(Tlv) -> + 'dec_AE-invocation-identifier'(Tlv, [2]). -'dec_AE-invocation-identifier'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_integer(Bytes,[],TagIn++[], OptOrMand). +'dec_AE-invocation-identifier'(Tlv, TagIn) -> +decode_integer(Tlv, TagIn). %%================================ %% AP-invocation-identifier %%================================ - -'enc_AP-invocation-identifier'({'AP-invocation-identifier',Val}, TagIn) -> - 'enc_AP-invocation-identifier'(Val, TagIn); +'enc_AP-invocation-identifier'(Val) -> + 'enc_AP-invocation-identifier'(Val, [<<2>>]). 'enc_AP-invocation-identifier'(Val, TagIn) -> -?RT_BER:encode_integer([], Val, TagIn ++ []). +encode_integer(Val, TagIn). -'dec_AP-invocation-identifier'(Bytes, OptOrMand) -> - 'dec_AP-invocation-identifier'(Bytes, OptOrMand, []). +'dec_AP-invocation-identifier'(Tlv) -> + 'dec_AP-invocation-identifier'(Tlv, [2]). -'dec_AP-invocation-identifier'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_integer(Bytes,[],TagIn++[], OptOrMand). +'dec_AP-invocation-identifier'(Tlv, TagIn) -> +decode_integer(Tlv, TagIn). %%================================ %% Associate-result %%================================ - -'enc_Associate-result'({'Associate-result',Val}, TagIn) -> - 'enc_Associate-result'(Val, TagIn); +'enc_Associate-result'(Val) -> + 'enc_Associate-result'(Val, [<<2>>]). 'enc_Associate-result'(Val, TagIn) -> -?RT_BER:encode_integer([], Val, [{accepted,0},{'rejected-permanent',1},{'rejected-transient',2}], TagIn ++ []). +encode_integer(Val, [{accepted,0},{'rejected-permanent',1},{'rejected-transient',2}], TagIn). -'dec_Associate-result'(Bytes, OptOrMand) -> - 'dec_Associate-result'(Bytes, OptOrMand, []). +'dec_Associate-result'(Tlv) -> + 'dec_Associate-result'(Tlv, [2]). -'dec_Associate-result'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_integer(Bytes,[],[{accepted,0},{'rejected-permanent',1},{'rejected-transient',2}],TagIn++[], OptOrMand). +'dec_Associate-result'(Tlv, TagIn) -> +begin +Val1 = decode_integer(Tlv, TagIn), +number2name(Val1, [{accepted,0},{'rejected-permanent',1},{'rejected-transient',2}]) +end +. %%================================ %% Associate-source-diagnostic %%================================ - -'enc_Associate-source-diagnostic'({'Associate-source-diagnostic',Val}, TagIn) -> - 'enc_Associate-source-diagnostic'(Val, TagIn); +'enc_Associate-source-diagnostic'(Val) -> + 'enc_Associate-source-diagnostic'(Val, []). 'enc_Associate-source-diagnostic'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of 'acse-service-user' -> - ?RT_BER:encode_integer([], element(2,Val), [{null,0},{'no-reason-given',1},{'application-context-name-not-supported',2},{'calling-AP-title-not-recognized',3},{'calling-AP-invocation-identifier-not-recognized',4},{'calling-AE-qualifier-not-recognized',5},{'calling-AE-invocation-identifier-not-recognized',6},{'called-AP-title-not-recognized',7},{'called-AP-invocation-identifier-not-recognized',8},{'called-AE-qualifier-not-recognized',9},{'called-AE-invocation-identifier-not-recognized',10},{'authentication-mechanism-name-not-recognized',11},{'authentication-mechanism-name-required',12},{'authentication-failure',13},{'authentication-required',14}], [{tag,128,1,'EXPLICIT',32}]); + encode_integer(element(2,Val), [{null,0},{'no-reason-given',1},{'application-context-name-not-supported',2},{'calling-AP-title-not-recognized',3},{'calling-AP-invocation-identifier-not-recognized',4},{'calling-AE-qualifier-not-recognized',5},{'calling-AE-invocation-identifier-not-recognized',6},{'called-AP-title-not-recognized',7},{'called-AP-invocation-identifier-not-recognized',8},{'called-AE-qualifier-not-recognized',9},{'called-AE-invocation-identifier-not-recognized',10},{'authentication-mechanism-name-not-recognized',11},{'authentication-mechanism-name-required',12},{'authentication-failure',13},{'authentication-required',14}], [<<2>>,<<161>>]); 'acse-service-provider' -> - ?RT_BER:encode_integer([], element(2,Val), [{null,0},{'no-reason-given',1},{'no-common-acse-version',2}], [{tag,128,2,'EXPLICIT',32}]); + encode_integer(element(2,Val), [{null,0},{'no-reason-given',1},{'no-common-acse-version',2}], [<<2>>,<<162>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). +encode_tags(TagIn, EncBytes, EncLen). -'dec_Associate-source-diagnostic'(Bytes, OptOrMand) -> - 'dec_Associate-source-diagnostic'(Bytes, OptOrMand, []). +'dec_Associate-source-diagnostic'(Tlv) -> + 'dec_Associate-source-diagnostic'(Tlv, []). -'dec_Associate-source-diagnostic'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of +'dec_Associate-source-diagnostic'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of %% 'acse-service-user' - <<2:2,_:1,1:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_integer(Bytes1,[],[{null,0},{'no-reason-given',1},{'application-context-name-not-supported',2},{'calling-AP-title-not-recognized',3},{'calling-AP-invocation-identifier-not-recognized',4},{'calling-AE-qualifier-not-recognized',5},{'calling-AE-invocation-identifier-not-recognized',6},{'called-AP-title-not-recognized',7},{'called-AP-invocation-identifier-not-recognized',8},{'called-AE-qualifier-not-recognized',9},{'called-AE-invocation-identifier-not-recognized',10},{'authentication-mechanism-name-not-recognized',11},{'authentication-mechanism-name-required',12},{'authentication-failure',13},{'authentication-required',14}],[{tag,128,1,'EXPLICIT',32}], mandatory), - {{'acse-service-user', Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131073, V1} -> + {'acse-service-user', begin +Val1 = decode_integer(V1, [2]), +number2name(Val1, [{null,0},{'no-reason-given',1},{'application-context-name-not-supported',2},{'calling-AP-title-not-recognized',3},{'calling-AP-invocation-identifier-not-recognized',4},{'calling-AE-qualifier-not-recognized',5},{'calling-AE-invocation-identifier-not-recognized',6},{'called-AP-title-not-recognized',7},{'called-AP-invocation-identifier-not-recognized',8},{'called-AE-qualifier-not-recognized',9},{'called-AE-invocation-identifier-not-recognized',10},{'authentication-mechanism-name-not-recognized',11},{'authentication-mechanism-name-required',12},{'authentication-failure',13},{'authentication-required',14}]) +end +}; %% 'acse-service-provider' - <<2:2,_:1,2:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_integer(Bytes1,[],[{null,0},{'no-reason-given',1},{'no-common-acse-version',2}],[{tag,128,2,'EXPLICIT',32}], mandatory), - {{'acse-service-provider', Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131074, V1} -> + {'acse-service-provider', begin +Val2 = decode_integer(V1, [2]), +number2name(Val2, [{null,0},{'no-reason-given',1},{'no-common-acse-version',2}]) +end +}; Else -> - case OptOrMand of - mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}}); - _ ->exit({error,{asn1,{no_optional_tag,Else}}}) - end - end. + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. %%================================ %% Association-information %%================================ - -'enc_Association-information'({'Association-information',Val}, TagIn) -> - 'enc_Association-information'(Val, TagIn); +'enc_Association-information'(Val) -> + 'enc_Association-information'(Val, [<<48>>]). 'enc_Association-information'(Val, TagIn) -> {EncBytes,EncLen} = 'enc_Association-information_components'(Val,[],0), - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], EncBytes, EncLen). + encode_tags(TagIn, EncBytes, EncLen). 'enc_Association-information_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_Association-information_components'([H|T],AccBytes, AccLen) -> - {EncBytes,EncLen} = 'enc_EXTERNAL'(H, []), + {EncBytes,EncLen} = 'enc_EXTERNAL'(H, [<<40>>]), 'enc_Association-information_components'(T,[EncBytes|AccBytes], AccLen + EncLen). -'dec_Association-information'(Bytes, OptOrMand) -> - 'dec_Association-information'(Bytes, OptOrMand, []). +'dec_Association-information'(Tlv) -> + 'dec_Association-information'(Tlv, [16]). -'dec_Association-information'(Bytes, OptOrMand, TagIn) -> +'dec_Association-information'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), - ?RT_BER:decode_components(Rb1, Len, Bytes1, fun 'dec_EXTERNAL'/3, [], []). +Tlv1 = match_tags(Tlv, TagIn), +['dec_EXTERNAL'(V1, [8]) || V1 <- Tlv1]. @@ -1634,25 +1648,24 @@ end, [], []). %%================================ %% Authentication-value %%================================ - -'enc_Authentication-value'({'Authentication-value',Val}, TagIn) -> - 'enc_Authentication-value'(Val, TagIn); +'enc_Authentication-value'(Val) -> + 'enc_Authentication-value'(Val, []). 'enc_Authentication-value'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of charstring -> - ?RT_BER:encode_restricted_string([], element(2,Val), 25, [{tag,128,0,'IMPLICIT',32}]); + encode_restricted_string(element(2,Val), [<<128>>]); bitstring -> - ?RT_BER:encode_bit_string([], element(2,Val), [], [{tag,128,1,'IMPLICIT',32}]); + encode_unnamed_bit_string(element(2,Val), [<<129>>]); external -> - 'enc_EXTERNAL'(element(2,Val), [{tag,128,2,'IMPLICIT',32}]); + 'enc_EXTERNAL'(element(2,Val), [<<162>>]); other -> - 'enc_Authentication-value_other'(element(2,Val), [{tag,128,3,'IMPLICIT',32}]); + 'enc_Authentication-value_other'(element(2,Val), [<<163>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). +encode_tags(TagIn, EncBytes, EncLen). @@ -1662,327 +1675,322 @@ end, [], []). %% Authentication-value_other %%================================ 'enc_Authentication-value_other'(Val, TagIn) -> - Objother_mechanism_name = - 'ACSE-1':'getenc_ObjectSet'(id, - value_match([],?RT_BER:cindex(2,Val,'other-mechanism-name'))), + {_,Cindex1, Cindex2} = Val, +Objother_mechanism_name = + 'ACSE-1':'getenc_ObjectSet'( Cindex1), %%------------------------------------------------- -%% attribute number 1 with type fixedtypevaluefieldidtypeOBJECT IDENTIFIERno +%% attribute other-mechanism-name(1) with type OBJECT IDENTIFIER %%------------------------------------------------- - {EncBytes1,EncLen1} = ?RT_BER:encode_object_identifier(?RT_BER:cindex(2,Val,'other-mechanism-name'), []), + {EncBytes1,EncLen1} = encode_object_identifier(Cindex1, [<<6>>]), %%------------------------------------------------- -%% attribute number 2 with type typefieldType +%% attribute other-mechanism-value(2) with type typefieldType %%------------------------------------------------- - {TmpBytes1,_} = Objother_mechanism_name('Type', ?RT_BER:cindex(3,Val,'other-mechanism-value'), [], []), - {EncBytes2, EncLen2} = ?RT_BER:encode_open_type(TmpBytes1,[]), + {TmpBytes2,_} = Objother_mechanism_name('Type', Cindex2, []), + {EncBytes2,EncLen2} = encode_open_type(TmpBytes2, []) +, BytesSoFar = [EncBytes1, EncBytes2], - LenSoFar = EncLen1 + EncLen2, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). -'dec_Authentication-value_other'(Bytes, OptOrMand, TagIn) -> +LenSoFar = EncLen1 + EncLen2, +encode_tags(TagIn, BytesSoFar, LenSoFar). + + +'dec_Authentication-value'(Tlv) -> + 'dec_Authentication-value'(Tlv, []). + +'dec_Authentication-value'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of + +%% 'charstring' + {131072, V1} -> + {charstring, begin +binary_to_list(decode_restricted_string(V1, [])) +end +}; + + +%% 'bitstring' + {131073, V1} -> + {bitstring, decode_native_bit_string(V1, [])}; + + +%% 'external' + {131074, V1} -> + {external, 'dec_EXTERNAL'(V1, [])}; + + +%% 'other' + {131075, V1} -> + {other, 'dec_Authentication-value_other'(V1, [])}; + + Else -> + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. +'dec_Authentication-value_other'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 with type fixedtypevaluefieldidtypeOBJECT IDENTIFIERno +%% attribute other-mechanism-name(1) with type OBJECT IDENTIFIER %%------------------------------------------------- - {Term1,Bytes3,Rb2} = ?RT_BER:decode_object_identifier(Bytes2,[], mandatory), +[V1|Tlv2] = Tlv1, +Term1 = decode_object_identifier(V1, [6]), %%------------------------------------------------- -%% attribute number 2 with type typefieldType +%% attribute other-mechanism-value(2) with type typefieldType %%------------------------------------------------- - {Tmpterm1, Bytes4,Rb3} = ?RT_BER:decode_open_type(Bytes3,[]), +[V2|Tlv3] = Tlv2, + + Tmpterm1 = decode_open_type(V2, []), DecObjother_mechanism_nameTerm1 = - 'ACSE-1':'getdec_ObjectSet'(id, Term1), -{Term2, _, _} = - case (catch DecObjother_mechanism_nameTerm1('Type', Tmpterm1, [], [])) of + 'ACSE-1':'getdec_ObjectSet'(Term1), +Term2 = + case (catch DecObjother_mechanism_nameTerm1('Type', Tmpterm1, [])) of {'EXIT', Reason1} -> exit({'Type not compatible with table constraint',Reason1}); Tmpterm2 -> Tmpterm2 end, - {Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext), - {{'Authentication-value_other', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}. - - -'dec_Authentication-value'(Bytes, OptOrMand) -> - 'dec_Authentication-value'(Bytes, OptOrMand, []). - -'dec_Authentication-value'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of - -%% 'charstring' - <<2:2,_:1,0:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_restricted_string(Bytes1,[],25,[{tag,128,0,'IMPLICIT',32}], no_length, mandatory), - {{charstring, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; - - -%% 'bitstring' - <<2:2,_:1,1:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_bit_string(Bytes1,[],[],[{tag,128,1,'IMPLICIT',32}], no_length, mandatory), - {{bitstring, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; - - -%% 'external' - <<2:2,_:1,2:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_EXTERNAL'(Bytes1, mandatory, [{tag,128,2,'IMPLICIT',32}]), - {{external, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; - - -%% 'other' - <<2:2,_:1,3:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_Authentication-value_other'(Bytes1, mandatory, [{tag,128,3,'IMPLICIT',32}]), - {{other, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; +case Tlv3 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed +end, + {'Authentication-value_other', Term1, Term2}. - Else -> - case OptOrMand of - mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}}); - _ ->exit({error,{asn1,{no_optional_tag,Else}}}) - end - end. %%================================ %% Implementation-data %%================================ - -'enc_Implementation-data'({'Implementation-data',Val}, TagIn) -> - 'enc_Implementation-data'(Val, TagIn); +'enc_Implementation-data'(Val) -> + 'enc_Implementation-data'(Val, [<<25>>]). 'enc_Implementation-data'(Val, TagIn) -> -?RT_BER:encode_restricted_string([], Val, 25, TagIn ++ []). +encode_restricted_string(Val, TagIn). -'dec_Implementation-data'(Bytes, OptOrMand) -> - 'dec_Implementation-data'(Bytes, OptOrMand, []). +'dec_Implementation-data'(Tlv) -> + 'dec_Implementation-data'(Tlv, [25]). -'dec_Implementation-data'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_restricted_string(Bytes,[],25,TagIn++[], no_length, OptOrMand). +'dec_Implementation-data'(Tlv, TagIn) -> +begin +binary_to_list(decode_restricted_string(Tlv, TagIn)) +end +. %%================================ %% Mechanism-name %%================================ - -'enc_Mechanism-name'({'Mechanism-name',Val}, TagIn) -> - 'enc_Mechanism-name'(Val, TagIn); +'enc_Mechanism-name'(Val) -> + 'enc_Mechanism-name'(Val, [<<6>>]). 'enc_Mechanism-name'(Val, TagIn) -> -?RT_BER:encode_object_identifier(Val, TagIn ++ []). +encode_object_identifier(Val, TagIn). -'dec_Mechanism-name'(Bytes, OptOrMand) -> - 'dec_Mechanism-name'(Bytes, OptOrMand, []). +'dec_Mechanism-name'(Tlv) -> + 'dec_Mechanism-name'(Tlv, [6]). -'dec_Mechanism-name'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_object_identifier(Bytes,TagIn++[], OptOrMand). +'dec_Mechanism-name'(Tlv, TagIn) -> +decode_object_identifier(Tlv, TagIn). %%================================ %% Release-request-reason %%================================ - -'enc_Release-request-reason'({'Release-request-reason',Val}, TagIn) -> - 'enc_Release-request-reason'(Val, TagIn); +'enc_Release-request-reason'(Val) -> + 'enc_Release-request-reason'(Val, [<<2>>]). 'enc_Release-request-reason'(Val, TagIn) -> -?RT_BER:encode_integer([], Val, [{normal,0},{urgent,1},{'user-defined',30}], TagIn ++ []). +encode_integer(Val, [{normal,0},{urgent,1},{'user-defined',30}], TagIn). -'dec_Release-request-reason'(Bytes, OptOrMand) -> - 'dec_Release-request-reason'(Bytes, OptOrMand, []). +'dec_Release-request-reason'(Tlv) -> + 'dec_Release-request-reason'(Tlv, [2]). -'dec_Release-request-reason'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_integer(Bytes,[],[{normal,0},{urgent,1},{'user-defined',30}],TagIn++[], OptOrMand). +'dec_Release-request-reason'(Tlv, TagIn) -> +begin +Val1 = decode_integer(Tlv, TagIn), +number2name(Val1, [{normal,0},{urgent,1},{'user-defined',30}]) +end +. %%================================ %% Release-response-reason %%================================ - -'enc_Release-response-reason'({'Release-response-reason',Val}, TagIn) -> - 'enc_Release-response-reason'(Val, TagIn); +'enc_Release-response-reason'(Val) -> + 'enc_Release-response-reason'(Val, [<<2>>]). 'enc_Release-response-reason'(Val, TagIn) -> -?RT_BER:encode_integer([], Val, [{normal,0},{'not-finished',1},{'user-defined',30}], TagIn ++ []). +encode_integer(Val, [{normal,0},{'not-finished',1},{'user-defined',30}], TagIn). -'dec_Release-response-reason'(Bytes, OptOrMand) -> - 'dec_Release-response-reason'(Bytes, OptOrMand, []). +'dec_Release-response-reason'(Tlv) -> + 'dec_Release-response-reason'(Tlv, [2]). -'dec_Release-response-reason'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_integer(Bytes,[],[{normal,0},{'not-finished',1},{'user-defined',30}],TagIn++[], OptOrMand). +'dec_Release-response-reason'(Tlv, TagIn) -> +begin +Val1 = decode_integer(Tlv, TagIn), +number2name(Val1, [{normal,0},{'not-finished',1},{'user-defined',30}]) +end +. %%================================ %% EXTERNAL %%================================ +'enc_EXTERNAL'(Val) -> + 'enc_EXTERNAL'(Val, [<<40>>]). + 'enc_EXTERNAL'(Val, TagIn) -> - NewVal = asn1rt_check:transform_to_EXTERNAL1990(Val), + NewVal = transform_to_EXTERNAL1990(Val), +{_,Cindex1, Cindex2, Cindex3, Cindex4} = NewVal, %%------------------------------------------------- -%% attribute number 1 with type OBJECT IDENTIFIER OPTIONAL +%% attribute direct-reference(1) with type OBJECT IDENTIFIER OPTIONAL %%------------------------------------------------- - {EncBytes1,EncLen1} = case ?RT_BER:cindex(2,NewVal,'direct-reference') of + {EncBytes1,EncLen1} = case Cindex1 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_object_identifier(?RT_BER:cindex(2,NewVal,'direct-reference'), []) + encode_object_identifier(Cindex1, [<<6>>]) end, %%------------------------------------------------- -%% attribute number 2 with type INTEGER OPTIONAL +%% attribute indirect-reference(2) with type INTEGER OPTIONAL %%------------------------------------------------- - {EncBytes2,EncLen2} = case ?RT_BER:cindex(3,NewVal,'indirect-reference') of + {EncBytes2,EncLen2} = case Cindex2 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_integer([], ?RT_BER:cindex(3,NewVal,'indirect-reference'), []) + encode_integer(Cindex2, [<<2>>]) end, %%------------------------------------------------- -%% attribute number 3 with type ObjectDescriptor OPTIONAL +%% attribute data-value-descriptor(3) with type ObjectDescriptor OPTIONAL %%------------------------------------------------- - {EncBytes3,EncLen3} = case ?RT_BER:cindex(4,NewVal,'data-value-descriptor') of + {EncBytes3,EncLen3} = case Cindex3 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_restricted_string([], ?RT_BER:cindex(4,NewVal,'data-value-descriptor'), 7, []) + encode_restricted_string(Cindex3, [<<7>>]) end, %%------------------------------------------------- -%% attribute number 4 with type CHOICE +%% attribute encoding(4) with type CHOICE %%------------------------------------------------- - {EncBytes4,EncLen4} = 'enc_EXTERNAL_encoding'(?RT_BER:cindex(5,NewVal,encoding), []), + {EncBytes4,EncLen4} = 'enc_EXTERNAL_encoding'(Cindex4, []), BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4], - LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,8,'IMPLICIT',32},{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4, +encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% EXTERNAL_encoding %%================================ - -'enc_EXTERNAL_encoding'({'EXTERNAL_encoding',Val}, TagIn) -> - 'enc_EXTERNAL_encoding'(Val, TagIn); - 'enc_EXTERNAL_encoding'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of 'single-ASN1-type' -> - ?RT_BER:encode_open_type(element(2,Val), [{tag,128,0,'EXPLICIT',32}]); + encode_open_type(element(2,Val), [<<160>>]); 'octet-aligned' -> - ?RT_BER:encode_octet_string([], element(2,Val), [{tag,128,1,'IMPLICIT',0}]); + encode_restricted_string(element(2,Val), [<<129>>]); arbitrary -> - ?RT_BER:encode_bit_string([], element(2,Val), [], [{tag,128,2,'IMPLICIT',0}]); + encode_unnamed_bit_string(element(2,Val), [<<130>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). - - -'dec_EXTERNAL_encoding'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of - -%% 'single-ASN1-type' - <<2:2,_:1,0:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_open_type(ber,Bytes1,[{tag,128,0,'EXPLICIT',32}]), - {{'single-ASN1-type', Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; +encode_tags(TagIn, EncBytes, EncLen). -%% 'octet-aligned' - <<2:2,_:1,1:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_octet_string(Bytes1,[],[{tag,128,1,'IMPLICIT',0}], no_length, mandatory), - {{'octet-aligned', Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; -%% 'arbitrary' - <<2:2,_:1,2:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_bit_string(Bytes1,[],[],[{tag,128,2,'IMPLICIT',0}], no_length, mandatory), - {{arbitrary, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; +'dec_EXTERNAL'(Tlv) -> + 'dec_EXTERNAL'(Tlv, [8]). - Else -> - case OptOrMand of - mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}}); - _ ->exit({error,{asn1,{no_optional_tag,Else}}}) - end - end. - - -'dec_EXTERNAL'(Bytes, OptOrMand) -> - 'dec_EXTERNAL'(Bytes, OptOrMand, []). - -'dec_EXTERNAL'(Bytes, OptOrMand, TagIn) -> +'dec_EXTERNAL'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,8,'IMPLICIT',32},{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 with type OBJECT IDENTIFIER OPTIONAL +%% attribute direct-reference(1) with type OBJECT IDENTIFIER OPTIONAL %%------------------------------------------------- - {Term1,Bytes3,Rb2} = case Bytes2 of -<<0:2,_:1,6:5,_/binary>> -> -?RT_BER:decode_object_identifier(Bytes2,[], mandatory); -_ -> -{ asn1_NOVALUE, Bytes2, 0 } +{Term1,Tlv2} = case Tlv1 of +[{6,V1}|TempTlv2] -> + {decode_object_identifier(V1, []), TempTlv2}; + _ -> + { asn1_NOVALUE, Tlv1} end, %%------------------------------------------------- -%% attribute number 2 with type INTEGER OPTIONAL +%% attribute indirect-reference(2) with type INTEGER OPTIONAL %%------------------------------------------------- - {Term2,Bytes4,Rb3} = case Bytes3 of -<<0:2,_:1,2:5,_/binary>> -> -?RT_BER:decode_integer(Bytes3,[],[], mandatory); -_ -> -{ asn1_NOVALUE, Bytes3, 0 } +{Term2,Tlv3} = case Tlv2 of +[{2,V2}|TempTlv3] -> + {decode_integer(V2, []), TempTlv3}; + _ -> + { asn1_NOVALUE, Tlv2} end, %%------------------------------------------------- -%% attribute number 3 with type ObjectDescriptor OPTIONAL +%% attribute data-value-descriptor(3) with type ObjectDescriptor OPTIONAL %%------------------------------------------------- - {Term3,Bytes5,Rb4} = case Bytes4 of -<<0:2,_:1,7:5,_/binary>> -> -?RT_BER:decode_restricted_string(Bytes4,[],7,[], no_length, mandatory); -_ -> -{ asn1_NOVALUE, Bytes4, 0 } +{Term3,Tlv4} = case Tlv3 of +[{7,V3}|TempTlv4] -> + {begin +binary_to_list(decode_restricted_string(V3, [])) +end +, TempTlv4}; + _ -> + { asn1_NOVALUE, Tlv3} end, %%------------------------------------------------- -%% attribute number 4 with type CHOICE +%% attribute encoding(4) with type CHOICE %%------------------------------------------------- - {Term4,Bytes6,Rb5} = 'dec_EXTERNAL_encoding'(Bytes5, mandatory, []), +[V4|Tlv5] = Tlv4, +Term4 = 'dec_EXTERNAL_encoding'(V4, []), - {Bytes7,Rb6} = ?RT_BER:restbytes2(RemBytes, Bytes6,noext), +case Tlv5 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv5}}}) % extra fields not allowed +end, OldFormat={'EXTERNAL', Term1, Term2, Term3, Term4}, - ASN11994Format = - asn1rt_check:transform_to_EXTERNAL1994(OldFormat), - {ASN11994Format,Bytes7, Rb1+Rb2+Rb3+Rb4+Rb5+Rb6}. -value_match([{Index,Cname}|Rest],Value) -> - Value2 = - case element(Index,Value) of - {Cname,Val2} -> Val2; - X -> X - end, - value_match(Rest,Value2); -value_match([],Value) -> - Value. + transform_to_EXTERNAL1994(OldFormat). +'dec_EXTERNAL_encoding'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of + +%% 'single-ASN1-type' + {131072, V1} -> + {'single-ASN1-type', decode_open_type_as_binary(V1, [])}; + + +%% 'octet-aligned' + {131073, V1} -> + {'octet-aligned', decode_octet_string(V1, [])}; + + +%% 'arbitrary' + {131074, V1} -> + {arbitrary, decode_native_bit_string(V1, [])}; + + Else -> + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. 'acse-as-id'() -> {2,2,1,0,1}. @@ -1995,20 +2003,452 @@ value_match([],Value) -> %%================================ %% ObjectSet %%================================ -'getenc_ObjectSet'(_, _) -> - fun(_Attr, Val, _TagIn, _RestPrimFieldName) -> - Len = case Val of - Bin when is_binary(Bin) -> size(Bin); - _ -> length(Val) - end, {Val,Len} - end. - -'getdec_ObjectSet'(_, _) -> - fun(_, Bytes, _, _) -> - Len = case Bytes of - Bin when is_binary(Bin) -> size(Bin); - _ -> length(Bytes) - end, {Bytes,[],Len} - end. - - +'getenc_ObjectSet'(_) -> + fun(_, Val, _RestPrimFieldName) -> + case Val of + {asn1_OPENTYPE,Bin} when is_binary(Bin) -> + {Bin,byte_size(Bin)} + end + end. + +'getdec_ObjectSet'(_) -> + fun(_,Bytes, _RestPrimFieldName) -> + case Bytes of + Bin when is_binary(Bin) -> + {asn1_OPENTYPE,Bin}; + _ -> + {asn1_OPENTYPE,ber_encode(Bytes)} + end + end. + + + +%%% +%%% Run-time functions. +%%% + +'dialyzer-suppressions'(Arg) -> + ok. + +ber_decode_nif(B) -> + asn1rt_nif:decode_ber_tlv(B). + +ber_encode([Tlv]) -> + ber_encode(Tlv); +ber_encode(Tlv) when is_binary(Tlv) -> + Tlv; +ber_encode(Tlv) -> + asn1rt_nif:encode_ber_tlv(Tlv). + +collect_parts(TlvList) -> + collect_parts(TlvList, []). + +collect_parts([{_,L}|Rest], Acc) when is_list(L) -> + collect_parts(Rest, [collect_parts(L)|Acc]); +collect_parts([{3,<>}|Rest], _Acc) -> + collect_parts_bit(Rest, [Bits], Unused); +collect_parts([{_T,V}|Rest], Acc) -> + collect_parts(Rest, [V|Acc]); +collect_parts([], Acc) -> + list_to_binary(lists:reverse(Acc)). + +collect_parts_bit([{3,<>}|Rest], Acc, Uacc) -> + collect_parts_bit(Rest, [Bits|Acc], Unused + Uacc); +collect_parts_bit([], Acc, Uacc) -> + list_to_binary([Uacc|lists:reverse(Acc)]). + +dec_subidentifiers(<<>>, _Av, Al) -> + lists:reverse(Al); +dec_subidentifiers(<<1:1,H:7,T/binary>>, Av, Al) -> + dec_subidentifiers(T, Av bsl 7 + H, Al); +dec_subidentifiers(<>, Av, Al) -> + dec_subidentifiers(T, 0, [Av bsl 7 + H|Al]). + +decode_bitstring2(1, + Unused, + <>) -> + lists:sublist([B7,B6,B5,B4,B3,B2,B1,B0], 8 - Unused); +decode_bitstring2(Len, + Unused, + <>) -> + [B7,B6,B5,B4,B3,B2,B1,B0|decode_bitstring2(Len - 1, Unused, Buffer)]. + +decode_bitstring_NNL(BitList, NamedNumberList) -> + decode_bitstring_NNL(BitList, NamedNumberList, 0, []). + +decode_bitstring_NNL([], _, _No, Result) -> + lists:reverse(Result); +decode_bitstring_NNL([B|BitList], + [{Name,No}|NamedNumberList], + No, + Result) -> + if + B =:= 0 -> + decode_bitstring_NNL(BitList, + NamedNumberList, + No + 1, + Result); + true -> + decode_bitstring_NNL(BitList, + NamedNumberList, + No + 1, + [Name|Result]) + end; +decode_bitstring_NNL([1|BitList], NamedNumberList, No, Result) -> + decode_bitstring_NNL(BitList, + NamedNumberList, + No + 1, + [{bit,No}|Result]); +decode_bitstring_NNL([0|BitList], NamedNumberList, No, Result) -> + decode_bitstring_NNL(BitList, NamedNumberList, No + 1, Result). + +decode_integer(Tlv, TagIn) -> + Bin = match_tags(Tlv, TagIn), + Len = byte_size(Bin), + <> = Bin, + Int. + +decode_named_bit_string(Buffer, NamedNumberList, Tags) -> + case match_and_collect(Buffer, Tags) of + <<0>> -> + []; + <> -> + BitString = decode_bitstring2(byte_size(Bits), Unused, Bits), + decode_bitstring_NNL(BitString, NamedNumberList) + end. + +decode_native_bit_string(Buffer, Tags) -> + case match_and_collect(Buffer, Tags) of + <<0>> -> + <<>>; + <> -> + Size = bit_size(Bits) - Unused, + <> = Bits, + Val + end. + +decode_object_identifier(Tlv, Tags) -> + Val = match_tags(Tlv, Tags), + [AddedObjVal|ObjVals] = dec_subidentifiers(Val, 0, []), + {Val1,Val2} = + if + AddedObjVal < 40 -> + {0,AddedObjVal}; + AddedObjVal < 80 -> + {1,AddedObjVal - 40}; + true -> + {2,AddedObjVal - 80} + end, + list_to_tuple([Val1,Val2|ObjVals]). + +decode_octet_string(Tlv, TagsIn) -> + Bin = match_and_collect(Tlv, TagsIn), + binary:copy(Bin). + +decode_open_type(Tlv, TagIn) -> + case match_tags(Tlv, TagIn) of + Bin when is_binary(Bin) -> + {InnerTlv,_} = ber_decode_nif(Bin), + InnerTlv; + TlvBytes -> + TlvBytes + end. + +decode_open_type_as_binary(Tlv, TagIn) -> + ber_encode(match_tags(Tlv, TagIn)). + +decode_restricted_string(Tlv, TagsIn) -> + match_and_collect(Tlv, TagsIn). + +do_encode_named_bit_string([FirstVal|RestVal], NamedBitList, TagIn) -> + ToSetPos = get_all_bitposes([FirstVal|RestVal], NamedBitList, []), + Size = lists:max(ToSetPos) + 1, + BitList = make_and_set_list(Size, ToSetPos, 0), + {Len,Unused,OctetList} = encode_bitstring(BitList), + encode_tags(TagIn, [Unused|OctetList], Len + 1). + +e_object_identifier({'OBJECT IDENTIFIER',V}) -> + e_object_identifier(V); +e_object_identifier(V) when is_tuple(V) -> + e_object_identifier(tuple_to_list(V)); +e_object_identifier([E1,E2|Tail]) -> + Head = 40 * E1 + E2, + {H,Lh} = mk_object_val(Head), + {R,Lr} = lists:mapfoldl(fun enc_obj_id_tail/2, 0, Tail), + {[H|R],Lh + Lr}. + +enc_obj_id_tail(H, Len) -> + {B,L} = mk_object_val(H), + {B,Len + L}. + +encode_bitstring([B8,B7,B6,B5,B4,B3,B2,B1|Rest]) -> + Val = + B8 bsl 7 bor (B7 bsl 6) bor (B6 bsl 5) bor (B5 bsl 4) + bor + (B4 bsl 3) + bor + (B3 bsl 2) + bor + (B2 bsl 1) + bor + B1, + encode_bitstring(Rest, [Val], 1); +encode_bitstring(Val) -> + {Unused,Octet} = unused_bitlist(Val, 7, 0), + {1,Unused,[Octet]}. + +encode_bitstring([B8,B7,B6,B5,B4,B3,B2,B1|Rest], Ack, Len) -> + Val = + B8 bsl 7 bor (B7 bsl 6) bor (B6 bsl 5) bor (B5 bsl 4) + bor + (B4 bsl 3) + bor + (B3 bsl 2) + bor + (B2 bsl 1) + bor + B1, + encode_bitstring(Rest, [Ack,Val], Len + 1); +encode_bitstring([], Ack, Len) -> + {Len,0,Ack}; +encode_bitstring(Rest, Ack, Len) -> + {Unused,Val} = unused_bitlist(Rest, 7, 0), + {Len + 1,Unused,[Ack,Val]}. + +encode_integer(Val) -> + Bytes = + if + Val >= 0 -> + encode_integer_pos(Val, []); + true -> + encode_integer_neg(Val, []) + end, + {Bytes,length(Bytes)}. + +encode_integer(Val, NamedNumberList, Tag) when is_atom(Val) -> + case lists:keyfind(Val, 1, NamedNumberList) of + {_,NewVal} -> + encode_tags(Tag, encode_integer(NewVal)); + _ -> + exit({error,{asn1,{encode_integer_namednumber,Val}}}) + end; +encode_integer(Val, _NamedNumberList, Tag) -> + encode_tags(Tag, encode_integer(Val)). + +encode_integer(Val, Tag) when is_integer(Val) -> + encode_tags(Tag, encode_integer(Val)); +encode_integer(Val, _Tag) -> + exit({error,{asn1,{encode_integer,Val}}}). + +encode_integer_neg(- 1, [B1|_T] = L) when B1 > 127 -> + L; +encode_integer_neg(N, Acc) -> + encode_integer_neg(N bsr 8, [N band 255|Acc]). + +encode_integer_pos(0, [B|_Acc] = L) when B < 128 -> + L; +encode_integer_pos(N, Acc) -> + encode_integer_pos(N bsr 8, [N band 255|Acc]). + +encode_length(L) when L =< 127 -> + {[L],1}; +encode_length(L) -> + Oct = minimum_octets(L), + Len = length(Oct), + if + Len =< 126 -> + {[128 bor Len|Oct],Len + 1}; + true -> + exit({error,{asn1,too_long_length_oct,Len}}) + end. + +encode_named_bit_string([H|_] = Bits, NamedBitList, TagIn) + when is_atom(H) -> + do_encode_named_bit_string(Bits, NamedBitList, TagIn); +encode_named_bit_string([{bit,_}|_] = Bits, NamedBitList, TagIn) -> + do_encode_named_bit_string(Bits, NamedBitList, TagIn); +encode_named_bit_string(Bits, _NamedBitList, TagIn) + when is_bitstring(Bits) -> + encode_unnamed_bit_string(Bits, TagIn). + +encode_object_identifier(Val, TagIn) -> + encode_tags(TagIn, e_object_identifier(Val)). + +encode_open_type(Val, T) when is_list(Val) -> + encode_open_type(list_to_binary(Val), T); +encode_open_type(Val, Tag) -> + encode_tags(Tag, Val, byte_size(Val)). + +encode_restricted_string(OctetList, TagIn) when is_binary(OctetList) -> + encode_tags(TagIn, OctetList, byte_size(OctetList)); +encode_restricted_string(OctetList, TagIn) when is_list(OctetList) -> + encode_tags(TagIn, OctetList, length(OctetList)). + +encode_tags(TagIn, {BytesSoFar,LenSoFar}) -> + encode_tags(TagIn, BytesSoFar, LenSoFar). + +encode_tags([Tag|Trest], BytesSoFar, LenSoFar) -> + {Bytes2,L2} = encode_length(LenSoFar), + encode_tags(Trest, + [Tag,Bytes2|BytesSoFar], + LenSoFar + byte_size(Tag) + L2); +encode_tags([], BytesSoFar, LenSoFar) -> + {BytesSoFar,LenSoFar}. + +encode_unnamed_bit_string(Bits, TagIn) -> + Unused = (8 - bit_size(Bits) band 7) band 7, + Bin = <>, + encode_tags(TagIn, Bin, byte_size(Bin)). + +get_all_bitposes([{bit,ValPos}|Rest], NamedBitList, Ack) -> + get_all_bitposes(Rest, NamedBitList, [ValPos|Ack]); +get_all_bitposes([Val|Rest], NamedBitList, Ack) when is_atom(Val) -> + case lists:keyfind(Val, 1, NamedBitList) of + {_ValName,ValPos} -> + get_all_bitposes(Rest, NamedBitList, [ValPos|Ack]); + _ -> + exit({error,{asn1,{bitstring_namedbit,Val}}}) + end; +get_all_bitposes([], _NamedBitList, Ack) -> + lists:sort(Ack). + +make_and_set_list(0, [], _) -> + []; +make_and_set_list(0, _, _) -> + exit({error,{asn1,bitstring_sizeconstraint}}); +make_and_set_list(Len, [XPos|SetPos], XPos) -> + [1|make_and_set_list(Len - 1, SetPos, XPos + 1)]; +make_and_set_list(Len, [Pos|SetPos], XPos) -> + [0|make_and_set_list(Len - 1, [Pos|SetPos], XPos + 1)]; +make_and_set_list(Len, [], XPos) -> + [0|make_and_set_list(Len - 1, [], XPos + 1)]. + +match_and_collect(Tlv, TagsIn) -> + Val = match_tags(Tlv, TagsIn), + case Val of + [_|_] = PartList -> + collect_parts(PartList); + Bin when is_binary(Bin) -> + Bin + end. + +match_tags({T,V}, [T]) -> + V; +match_tags({T,V}, [T|Tt]) -> + match_tags(V, Tt); +match_tags([{T,V}], [T|Tt]) -> + match_tags(V, Tt); +match_tags([{T,_V}|_] = Vlist, [T]) -> + Vlist; +match_tags(Tlv, []) -> + Tlv; +match_tags({Tag,_V} = Tlv, [T|_Tt]) -> + exit({error,{asn1,{wrong_tag,{{expected,T},{got,Tag,Tlv}}}}}). + +minimum_octets(0, Acc) -> + Acc; +minimum_octets(Val, Acc) -> + minimum_octets(Val bsr 8, [Val band 255|Acc]). + +minimum_octets(Val) -> + minimum_octets(Val, []). + +mk_object_val(0, Ack, Len) -> + {Ack,Len}; +mk_object_val(Val, Ack, Len) -> + mk_object_val(Val bsr 7, [Val band 127 bor 128|Ack], Len + 1). + +mk_object_val(Val) when Val =< 127 -> + {[255 band Val],1}; +mk_object_val(Val) -> + mk_object_val(Val bsr 7, [Val band 127], 1). + +number2name(Int, NamedNumberList) -> + case lists:keyfind(Int, 2, NamedNumberList) of + {NamedVal,_} -> + NamedVal; + _ -> + Int + end. + +skip_ExtensionAdditions([], _Tags) -> + []; +skip_ExtensionAdditions([{Tag,_}|Rest] = TLV, Tags) -> + case + [ + X || + X = T <- Tags, + T =:= Tag + ] + of + [] -> + skip_ExtensionAdditions(Rest, Tags); + _ -> + TLV + end. + +transform_to_EXTERNAL1990(['EXTERNAL'|Rest], Acc) -> + transform_to_EXTERNAL1990(Rest, ['EXTERNAL'|Acc]); +transform_to_EXTERNAL1990([{syntax,Syntax}|Rest], Acc) -> + transform_to_EXTERNAL1990(Rest, [asn1_NOVALUE,Syntax|Acc]); +transform_to_EXTERNAL1990([{'presentation-context-id',PCid}|Rest], Acc) -> + transform_to_EXTERNAL1990(Rest, [PCid,asn1_NOVALUE|Acc]); +transform_to_EXTERNAL1990([{'context-negotiation',Context_negot}|Rest], + Acc) -> + {_,Presentation_Cid,Transfer_syntax} = Context_negot, + transform_to_EXTERNAL1990(Rest, + [Presentation_Cid,Transfer_syntax|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); 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) + when is_binary(Data_value) -> + list_to_tuple(lists:reverse([{'single-ASN1-type',Data_value}, + Data_val_desc| + Acc])); +transform_to_EXTERNAL1990([Data_value], Acc) + when is_list(Data_value); is_binary(Data_value) -> + list_to_tuple(lists:reverse([{'octet-aligned',Data_value}|Acc])). + +transform_to_EXTERNAL1990({_,_,_,_} = Val) -> + transform_to_EXTERNAL1990(tuple_to_list(Val), []); +transform_to_EXTERNAL1990(Val) when is_tuple(Val) -> + Val. + +transform_to_EXTERNAL1994({'EXTERNAL',DRef,IndRef,Data_v_desc,Encoding} = + V) -> + Identification = + case {DRef,IndRef} of + {DRef,asn1_NOVALUE} -> + {syntax,DRef}; + {asn1_NOVALUE,IndRef} -> + {'presentation-context-id',IndRef}; + _ -> + {'context-negotiation', + {'EXTERNAL_identification_context-negotiation', + IndRef, + DRef}} + end, + case Encoding of + {'octet-aligned',Val} when is_list(Val); is_binary(Val) -> + {'EXTERNAL',Identification,Data_v_desc,Val}; + _ -> + V + end. + +unused_bitlist([], Trail, Ack) -> + {Trail + 1,Ack}; +unused_bitlist([Bit|Rest], Trail, Ack) -> + unused_bitlist(Rest, Trail - 1, Bit bsl Trail bor Ack). diff --git a/ACSE-1.hrl b/ACSE-1.hrl index 1f53585..e12f3fd 100644 --- a/ACSE-1.hrl +++ b/ACSE-1.hrl @@ -1,10 +1,13 @@ -%% Generated by the Erlang ASN.1 compiler version:1.7 +%% Generated by the Erlang ASN.1 compiler version:4.0 %% Purpose: Erlang record definitions for each named and unnamed %% SEQUENCE and SET, and macro definitions for each value %% definition,in module ACSE-1 +-ifndef(_ACSE_1_HRL_). +-define(_ACSE_1_HRL_, true). + -record('AARQ-apdu',{ 'protocol-version' = asn1_DEFAULT, 'application-context-name', 'called-AP-title' = asn1_NOVALUE, 'called-AE-qualifier' = asn1_NOVALUE, 'called-AP-invocation-identifier' = asn1_NOVALUE, 'called-AE-invocation-identifier' = asn1_NOVALUE, 'calling-AP-title' = asn1_NOVALUE, 'calling-AE-qualifier' = asn1_NOVALUE, 'calling-AP-invocation-identifier' = asn1_NOVALUE, 'calling-AE-invocation-identifier' = asn1_NOVALUE, 'sender-acse-requirements' = asn1_NOVALUE, 'mechanism-name' = asn1_NOVALUE, 'calling-authentication-value' = asn1_NOVALUE, 'application-context-name-list' = asn1_NOVALUE, 'implementation-information' = asn1_NOVALUE, %% with extensions @@ -43,3 +46,4 @@ reason = asn1_NOVALUE, -define('acse-as-id', {2,2,1,0,1}). -define('aCSE-id', {2,2,3,1,1}). +-endif. %% _ACSE_1_HRL_ diff --git a/CSTA-application-context-information-csta3.erl b/CSTA-application-context-information-csta3.erl index fdf7405..6d5fb0a 100644 --- a/CSTA-application-context-information-csta3.erl +++ b/CSTA-application-context-information-csta3.erl @@ -1,14 +1,23 @@ -%% Generated by the Erlang ASN.1 BER-compiler version:1.7 +%% Generated by the Erlang ASN.1 BER_V2-compiler version, utilizing bit-syntax:4.0 %% Purpose: encoder and decoder to the types in mod CSTA-application-context-information-csta3 -module('CSTA-application-context-information-csta3'). +-compile(nowarn_unused_vars). -include("CSTA-application-context-information-csta3.hrl"). --define('RT_BER',asn1rt_ber_bin). --asn1_info([{vsn,'1.7'}, +-asn1_info([{vsn,'4.0'}, {module,'CSTA-application-context-information-csta3'}, - {options,[{i,[47,104,111,109,101,47,113,117,97,120,47,101,114,108,47,97,115,110]},warnings,ber,errors,{cwd,[47,104,111,109,101,47,113,117,97,120,47,101,114,108,47,97,115,110]},{outdir,[47,104,111,109,101,47,113,117,97,120,47,101,114,108,47,97,115,110]},{i,[46]},{i,[47,104,111,109,101,47,113,117,97,120,47,101,114,108,47,97,115,110,47,107,109,101]}]}]). - --export([encoding_rule/0]). + {options,[{i,"/Users/quax/erl"}, + warnings,ber,errors, + {cwd,"/Users/quax/erl"}, + {outdir,"/Users/quax/erl"}, + {i,"/Users/quax/erl/acse"}, + {i,"/Users/quax/erl/csta"}, + {i,"."}, + {i,"/Users/quax/erl/kme"}]}]). + +-export([encoding_rule/0,bit_string_format/0, + legacy_erlang_types/0]). +-export(['dialyzer-suppressions'/1]). -export([ 'enc_CSTAFunctionality'/2, 'enc_SwitchingFunctionServicesC2'/2, @@ -69,680 +78,649 @@ 'dec_VendorSpecEvents'/2 ]). --export([ -'dec_CSTAFunctionality'/3, -'dec_SwitchingFunctionServicesC2'/3, -'dec_EventReportServicesC2'/3, -'dec_ComputingFunctionServicesC2'/3, -'dec_BidirectionalServicesC2'/3, -'dec_StatusReportingServicesC2'/3, -'dec_InputOutputServicesC2'/3, -'dec_VoiceUnitServicesC2'/3, -'dec_ACSEUserInformationForCSTA'/3, -'dec_OldACSEUserInformationForCSTA'/3, -'dec_NewACSEUserInformationForCSTA'/3, -'dec_CSTAPrivateDataVersionList'/3, -'dec_CSTAVersion'/3, -'dec_CallControlServices'/3, -'dec_CallAssociatedServices'/3, -'dec_MediaAttachmentServices'/3, -'dec_RouteingServices'/3, -'dec_VoiceUnitServices'/3, -'dec_LocationServices'/3, -'dec_CallControlEvents'/3, -'dec_CallAssociatedEvents'/3, -'dec_MediaAttachmentEvents'/3, -'dec_PhysicalDeviceFeatureEvents'/3, -'dec_LogicalDeviceFeatureEvents'/3, -'dec_DeviceMaintenanceEvents'/3, -'dec_VoiceUnitEvents'/3, -'dec_VendorSpecEvents'/3 -]). - -export([info/0]). --export([encode/2,decode/2,encode_disp/2,decode_disp/2]). +-export([encode/2,decode/2]). + +encoding_rule() -> ber. + +bit_string_format() -> bitstring. -encoding_rule() -> - ber. +legacy_erlang_types() -> false. -encode(Type,Data) -> -case catch encode_disp(Type,Data) of - {'EXIT',{error,Reason}} -> - {error,Reason}; - {'EXIT',Reason} -> - {error,{asn1,Reason}}; - {Bytes,_Len} -> - {ok,wrap_encode(Bytes)}; +encode(Type, Data) -> +try iolist_to_binary(element(1, encode_disp(Type, Data))) of Bytes -> - {ok,wrap_encode(Bytes)} + {ok,Bytes} + catch + Class:Exception when Class =:= error; Class =:= exit -> + case Exception of + {error,Reason}=Error -> + Error; + Reason -> + {error,{asn1,Reason}} + end end. decode(Type,Data) -> -case catch decode_disp(Type,wrap_decode(Data)) of - {'EXIT',{error,Reason}} -> - {error,Reason}; - {'EXIT',Reason} -> - {error,{asn1,Reason}}; - {X,_Rest} -> - {ok,X}; - {X,_Rest,_Len} -> - {ok,X} +try decode_disp(Type, element(1, ber_decode_nif(Data))) of + Result -> + {ok,Result} + catch + Class:Exception when Class =:= error; Class =:= exit -> + case Exception of + {error,Reason}=Error -> + Error; + Reason -> + {error,{asn1,Reason}} + end end. -encode_disp('CSTAFunctionality',Data) -> 'enc_CSTAFunctionality'(Data,[]); -encode_disp('SwitchingFunctionServicesC2',Data) -> 'enc_SwitchingFunctionServicesC2'(Data,[]); -encode_disp('EventReportServicesC2',Data) -> 'enc_EventReportServicesC2'(Data,[]); -encode_disp('ComputingFunctionServicesC2',Data) -> 'enc_ComputingFunctionServicesC2'(Data,[]); -encode_disp('BidirectionalServicesC2',Data) -> 'enc_BidirectionalServicesC2'(Data,[]); -encode_disp('StatusReportingServicesC2',Data) -> 'enc_StatusReportingServicesC2'(Data,[]); -encode_disp('InputOutputServicesC2',Data) -> 'enc_InputOutputServicesC2'(Data,[]); -encode_disp('VoiceUnitServicesC2',Data) -> 'enc_VoiceUnitServicesC2'(Data,[]); -encode_disp('ACSEUserInformationForCSTA',Data) -> 'enc_ACSEUserInformationForCSTA'(Data,[]); -encode_disp('OldACSEUserInformationForCSTA',Data) -> 'enc_OldACSEUserInformationForCSTA'(Data,[]); -encode_disp('NewACSEUserInformationForCSTA',Data) -> 'enc_NewACSEUserInformationForCSTA'(Data,[]); -encode_disp('CSTAPrivateDataVersionList',Data) -> 'enc_CSTAPrivateDataVersionList'(Data,[]); -encode_disp('CSTAVersion',Data) -> 'enc_CSTAVersion'(Data,[]); -encode_disp('CallControlServices',Data) -> 'enc_CallControlServices'(Data,[]); -encode_disp('CallAssociatedServices',Data) -> 'enc_CallAssociatedServices'(Data,[]); -encode_disp('MediaAttachmentServices',Data) -> 'enc_MediaAttachmentServices'(Data,[]); -encode_disp('RouteingServices',Data) -> 'enc_RouteingServices'(Data,[]); -encode_disp('VoiceUnitServices',Data) -> 'enc_VoiceUnitServices'(Data,[]); -encode_disp('LocationServices',Data) -> 'enc_LocationServices'(Data,[]); -encode_disp('CallControlEvents',Data) -> 'enc_CallControlEvents'(Data,[]); -encode_disp('CallAssociatedEvents',Data) -> 'enc_CallAssociatedEvents'(Data,[]); -encode_disp('MediaAttachmentEvents',Data) -> 'enc_MediaAttachmentEvents'(Data,[]); -encode_disp('PhysicalDeviceFeatureEvents',Data) -> 'enc_PhysicalDeviceFeatureEvents'(Data,[]); -encode_disp('LogicalDeviceFeatureEvents',Data) -> 'enc_LogicalDeviceFeatureEvents'(Data,[]); -encode_disp('DeviceMaintenanceEvents',Data) -> 'enc_DeviceMaintenanceEvents'(Data,[]); -encode_disp('VoiceUnitEvents',Data) -> 'enc_VoiceUnitEvents'(Data,[]); -encode_disp('VendorSpecEvents',Data) -> 'enc_VendorSpecEvents'(Data,[]); +encode_disp('CSTAFunctionality',Data) -> 'enc_CSTAFunctionality'(Data); +encode_disp('SwitchingFunctionServicesC2',Data) -> 'enc_SwitchingFunctionServicesC2'(Data); +encode_disp('EventReportServicesC2',Data) -> 'enc_EventReportServicesC2'(Data); +encode_disp('ComputingFunctionServicesC2',Data) -> 'enc_ComputingFunctionServicesC2'(Data); +encode_disp('BidirectionalServicesC2',Data) -> 'enc_BidirectionalServicesC2'(Data); +encode_disp('StatusReportingServicesC2',Data) -> 'enc_StatusReportingServicesC2'(Data); +encode_disp('InputOutputServicesC2',Data) -> 'enc_InputOutputServicesC2'(Data); +encode_disp('VoiceUnitServicesC2',Data) -> 'enc_VoiceUnitServicesC2'(Data); +encode_disp('ACSEUserInformationForCSTA',Data) -> 'enc_ACSEUserInformationForCSTA'(Data); +encode_disp('OldACSEUserInformationForCSTA',Data) -> 'enc_OldACSEUserInformationForCSTA'(Data); +encode_disp('NewACSEUserInformationForCSTA',Data) -> 'enc_NewACSEUserInformationForCSTA'(Data); +encode_disp('CSTAPrivateDataVersionList',Data) -> 'enc_CSTAPrivateDataVersionList'(Data); +encode_disp('CSTAVersion',Data) -> 'enc_CSTAVersion'(Data); +encode_disp('CallControlServices',Data) -> 'enc_CallControlServices'(Data); +encode_disp('CallAssociatedServices',Data) -> 'enc_CallAssociatedServices'(Data); +encode_disp('MediaAttachmentServices',Data) -> 'enc_MediaAttachmentServices'(Data); +encode_disp('RouteingServices',Data) -> 'enc_RouteingServices'(Data); +encode_disp('VoiceUnitServices',Data) -> 'enc_VoiceUnitServices'(Data); +encode_disp('LocationServices',Data) -> 'enc_LocationServices'(Data); +encode_disp('CallControlEvents',Data) -> 'enc_CallControlEvents'(Data); +encode_disp('CallAssociatedEvents',Data) -> 'enc_CallAssociatedEvents'(Data); +encode_disp('MediaAttachmentEvents',Data) -> 'enc_MediaAttachmentEvents'(Data); +encode_disp('PhysicalDeviceFeatureEvents',Data) -> 'enc_PhysicalDeviceFeatureEvents'(Data); +encode_disp('LogicalDeviceFeatureEvents',Data) -> 'enc_LogicalDeviceFeatureEvents'(Data); +encode_disp('DeviceMaintenanceEvents',Data) -> 'enc_DeviceMaintenanceEvents'(Data); +encode_disp('VoiceUnitEvents',Data) -> 'enc_VoiceUnitEvents'(Data); +encode_disp('VendorSpecEvents',Data) -> 'enc_VendorSpecEvents'(Data); encode_disp(Type,_Data) -> exit({error,{asn1,{undefined_type,Type}}}). -decode_disp('CSTAFunctionality',Data) -> 'dec_CSTAFunctionality'(Data,mandatory); -decode_disp('SwitchingFunctionServicesC2',Data) -> 'dec_SwitchingFunctionServicesC2'(Data,mandatory); -decode_disp('EventReportServicesC2',Data) -> 'dec_EventReportServicesC2'(Data,mandatory); -decode_disp('ComputingFunctionServicesC2',Data) -> 'dec_ComputingFunctionServicesC2'(Data,mandatory); -decode_disp('BidirectionalServicesC2',Data) -> 'dec_BidirectionalServicesC2'(Data,mandatory); -decode_disp('StatusReportingServicesC2',Data) -> 'dec_StatusReportingServicesC2'(Data,mandatory); -decode_disp('InputOutputServicesC2',Data) -> 'dec_InputOutputServicesC2'(Data,mandatory); -decode_disp('VoiceUnitServicesC2',Data) -> 'dec_VoiceUnitServicesC2'(Data,mandatory); -decode_disp('ACSEUserInformationForCSTA',Data) -> 'dec_ACSEUserInformationForCSTA'(Data,mandatory); -decode_disp('OldACSEUserInformationForCSTA',Data) -> 'dec_OldACSEUserInformationForCSTA'(Data,mandatory); -decode_disp('NewACSEUserInformationForCSTA',Data) -> 'dec_NewACSEUserInformationForCSTA'(Data,mandatory); -decode_disp('CSTAPrivateDataVersionList',Data) -> 'dec_CSTAPrivateDataVersionList'(Data,mandatory); -decode_disp('CSTAVersion',Data) -> 'dec_CSTAVersion'(Data,mandatory); -decode_disp('CallControlServices',Data) -> 'dec_CallControlServices'(Data,mandatory); -decode_disp('CallAssociatedServices',Data) -> 'dec_CallAssociatedServices'(Data,mandatory); -decode_disp('MediaAttachmentServices',Data) -> 'dec_MediaAttachmentServices'(Data,mandatory); -decode_disp('RouteingServices',Data) -> 'dec_RouteingServices'(Data,mandatory); -decode_disp('VoiceUnitServices',Data) -> 'dec_VoiceUnitServices'(Data,mandatory); -decode_disp('LocationServices',Data) -> 'dec_LocationServices'(Data,mandatory); -decode_disp('CallControlEvents',Data) -> 'dec_CallControlEvents'(Data,mandatory); -decode_disp('CallAssociatedEvents',Data) -> 'dec_CallAssociatedEvents'(Data,mandatory); -decode_disp('MediaAttachmentEvents',Data) -> 'dec_MediaAttachmentEvents'(Data,mandatory); -decode_disp('PhysicalDeviceFeatureEvents',Data) -> 'dec_PhysicalDeviceFeatureEvents'(Data,mandatory); -decode_disp('LogicalDeviceFeatureEvents',Data) -> 'dec_LogicalDeviceFeatureEvents'(Data,mandatory); -decode_disp('DeviceMaintenanceEvents',Data) -> 'dec_DeviceMaintenanceEvents'(Data,mandatory); -decode_disp('VoiceUnitEvents',Data) -> 'dec_VoiceUnitEvents'(Data,mandatory); -decode_disp('VendorSpecEvents',Data) -> 'dec_VendorSpecEvents'(Data,mandatory); +decode_disp('CSTAFunctionality',Data) -> 'dec_CSTAFunctionality'(Data); +decode_disp('SwitchingFunctionServicesC2',Data) -> 'dec_SwitchingFunctionServicesC2'(Data); +decode_disp('EventReportServicesC2',Data) -> 'dec_EventReportServicesC2'(Data); +decode_disp('ComputingFunctionServicesC2',Data) -> 'dec_ComputingFunctionServicesC2'(Data); +decode_disp('BidirectionalServicesC2',Data) -> 'dec_BidirectionalServicesC2'(Data); +decode_disp('StatusReportingServicesC2',Data) -> 'dec_StatusReportingServicesC2'(Data); +decode_disp('InputOutputServicesC2',Data) -> 'dec_InputOutputServicesC2'(Data); +decode_disp('VoiceUnitServicesC2',Data) -> 'dec_VoiceUnitServicesC2'(Data); +decode_disp('ACSEUserInformationForCSTA',Data) -> 'dec_ACSEUserInformationForCSTA'(Data); +decode_disp('OldACSEUserInformationForCSTA',Data) -> 'dec_OldACSEUserInformationForCSTA'(Data); +decode_disp('NewACSEUserInformationForCSTA',Data) -> 'dec_NewACSEUserInformationForCSTA'(Data); +decode_disp('CSTAPrivateDataVersionList',Data) -> 'dec_CSTAPrivateDataVersionList'(Data); +decode_disp('CSTAVersion',Data) -> 'dec_CSTAVersion'(Data); +decode_disp('CallControlServices',Data) -> 'dec_CallControlServices'(Data); +decode_disp('CallAssociatedServices',Data) -> 'dec_CallAssociatedServices'(Data); +decode_disp('MediaAttachmentServices',Data) -> 'dec_MediaAttachmentServices'(Data); +decode_disp('RouteingServices',Data) -> 'dec_RouteingServices'(Data); +decode_disp('VoiceUnitServices',Data) -> 'dec_VoiceUnitServices'(Data); +decode_disp('LocationServices',Data) -> 'dec_LocationServices'(Data); +decode_disp('CallControlEvents',Data) -> 'dec_CallControlEvents'(Data); +decode_disp('CallAssociatedEvents',Data) -> 'dec_CallAssociatedEvents'(Data); +decode_disp('MediaAttachmentEvents',Data) -> 'dec_MediaAttachmentEvents'(Data); +decode_disp('PhysicalDeviceFeatureEvents',Data) -> 'dec_PhysicalDeviceFeatureEvents'(Data); +decode_disp('LogicalDeviceFeatureEvents',Data) -> 'dec_LogicalDeviceFeatureEvents'(Data); +decode_disp('DeviceMaintenanceEvents',Data) -> 'dec_DeviceMaintenanceEvents'(Data); +decode_disp('VoiceUnitEvents',Data) -> 'dec_VoiceUnitEvents'(Data); +decode_disp('VendorSpecEvents',Data) -> 'dec_VendorSpecEvents'(Data); decode_disp(Type,_Data) -> exit({error,{asn1,{undefined_type,Type}}}). -wrap_encode(Bytes) when is_list(Bytes) -> - binary_to_list(list_to_binary(Bytes)); -wrap_encode(Bytes) when is_binary(Bytes) -> - binary_to_list(Bytes); -wrap_encode(Bytes) -> Bytes. - -wrap_decode(Bytes) when is_list(Bytes) -> - list_to_binary(Bytes); -wrap_decode(Bytes) -> Bytes. - info() -> - case ?MODULE:module_info() of - MI when is_list(MI) -> - case lists:keysearch(attributes,1,MI) of - {value,{_,Attributes}} when is_list(Attributes) -> - case lists:keysearch(asn1_info,1,Attributes) of - {value,{_,Info}} when is_list(Info) -> - Info; - _ -> - [] - end; - _ -> - [] - end + case ?MODULE:module_info(attributes) of + Attributes when is_list(Attributes) -> + case lists:keyfind(asn1_info, 1, Attributes) of + {_,Info} when is_list(Info) -> + Info; + _ -> + [] + end; + _ -> + [] end. %%================================ %% CSTAFunctionality %%================================ +'enc_CSTAFunctionality'(Val) -> + 'enc_CSTAFunctionality'(Val, [<<48>>]). + 'enc_CSTAFunctionality'(Val, TagIn) -> +{_,Cindex1, Cindex2, Cindex3, Cindex4, Cindex5, Cindex6, Cindex7} = Val, %%------------------------------------------------- -%% attribute number 1 with type BIT STRING DEFAULT = [] +%% attribute switchingFunctionServices(1) with type BIT STRING DEFAULT = [] %%------------------------------------------------- - {EncBytes1,EncLen1} = case ?RT_BER:cindex(2,Val,switchingFunctionServices) of + {EncBytes1,EncLen1} = case Cindex1 of asn1_DEFAULT -> {<<>>,0}; [] -> {<<>>,0}; _ -> - ?RT_BER:encode_bit_string([], ?RT_BER:cindex(2,Val,switchingFunctionServices), [{alternateCall,0},{answerCall,1},{associateData,2},{callCompletion,3},{clearCall,4},{clearConnection,5},{conferenceCall,6},{consultationCall,7},{divertCall,8},{holdCall,9},{makeCall,10},{makePredictiveCall,11},{parkCall,12},{queryDevice,13},{reconnectCall,14},{retrieveCall,15},{sendDTMFTones,16},{setFeature,17},{singleStepConference,18},{singleStepTransfer,19},{transferCall,20}], [{tag,128,0,'IMPLICIT',32}]) + encode_named_bit_string(Cindex1, [{alternateCall,0},{answerCall,1},{associateData,2},{callCompletion,3},{clearCall,4},{clearConnection,5},{conferenceCall,6},{consultationCall,7},{divertCall,8},{holdCall,9},{makeCall,10},{makePredictiveCall,11},{parkCall,12},{queryDevice,13},{reconnectCall,14},{retrieveCall,15},{sendDTMFTones,16},{setFeature,17},{singleStepConference,18},{singleStepTransfer,19},{transferCall,20}], [<<128>>]) end, %%------------------------------------------------- -%% attribute number 2 with type BIT STRING DEFAULT = [] +%% attribute eventReportServices(2) with type BIT STRING DEFAULT = [] %%------------------------------------------------- - {EncBytes2,EncLen2} = case ?RT_BER:cindex(3,Val,eventReportServices) of + {EncBytes2,EncLen2} = case Cindex2 of asn1_DEFAULT -> {<<>>,0}; [] -> {<<>>,0}; _ -> - ?RT_BER:encode_bit_string([], ?RT_BER:cindex(3,Val,eventReportServices), [{callCleared,0},{conferenced,1},{connectionCleared,2},{delivered,3},{diverted,4},{established,5},{failed,6},{held,7},{networkReached,8},{originated,9},{queued,10},{retrieved,11},{serviceInitiated,12},{transferred,13},{autoAnswer,14},{callInformation,15},{doNotDisturb,16},{forwarding,17},{messageWaiting,18},{microphoneMute,19},{speakerMute,20},{speakerVolume,21},{agentBusy,22},{loggedOn,23},{loggedOff,24},{notReady,25},{ready,26},{workingAfterCall,27},{backInService,28},{outOfServiceEvent,29},{privateEvent,30},{playEvent,31},{recordEvent,32},{reviewEvent,33},{stopEvent,34},{suspendPlayEvent,35},{suspendRecordEvent,36},{voiceAttributesChangeEvent,37}], [{tag,128,1,'IMPLICIT',32}]) + encode_named_bit_string(Cindex2, [{callCleared,0},{conferenced,1},{connectionCleared,2},{delivered,3},{diverted,4},{established,5},{failed,6},{held,7},{networkReached,8},{originated,9},{queued,10},{retrieved,11},{serviceInitiated,12},{transferred,13},{autoAnswer,14},{callInformation,15},{doNotDisturb,16},{forwarding,17},{messageWaiting,18},{microphoneMute,19},{speakerMute,20},{speakerVolume,21},{agentBusy,22},{loggedOn,23},{loggedOff,24},{notReady,25},{ready,26},{workingAfterCall,27},{backInService,28},{outOfServiceEvent,29},{privateEvent,30},{playEvent,31},{recordEvent,32},{reviewEvent,33},{stopEvent,34},{suspendPlayEvent,35},{suspendRecordEvent,36},{voiceAttributesChangeEvent,37}], [<<129>>]) end, %%------------------------------------------------- -%% attribute number 3 with type BIT STRING DEFAULT = [] +%% attribute computingFunctionServices(3) with type BIT STRING DEFAULT = [] %%------------------------------------------------- - {EncBytes3,EncLen3} = case ?RT_BER:cindex(4,Val,computingFunctionServices) of + {EncBytes3,EncLen3} = case Cindex3 of asn1_DEFAULT -> {<<>>,0}; [] -> {<<>>,0}; _ -> - ?RT_BER:encode_bit_string([], ?RT_BER:cindex(4,Val,computingFunctionServices), [{routeRequest,0},{reRouteRequest,1},{routeSelectRequest,2},{routeUsedRequest,3},{routeEndRequest,4}], [{tag,128,2,'IMPLICIT',32}]) + encode_named_bit_string(Cindex3, [{routeRequest,0},{reRouteRequest,1},{routeSelectRequest,2},{routeUsedRequest,3},{routeEndRequest,4}], [<<130>>]) end, %%------------------------------------------------- -%% attribute number 4 with type BIT STRING DEFAULT = [] +%% attribute bidirectionalServices(4) with type BIT STRING DEFAULT = [] %%------------------------------------------------- - {EncBytes4,EncLen4} = case ?RT_BER:cindex(5,Val,bidirectionalServices) of + {EncBytes4,EncLen4} = case Cindex4 of asn1_DEFAULT -> {<<>>,0}; [] -> {<<>>,0}; _ -> - ?RT_BER:encode_bit_string([], ?RT_BER:cindex(5,Val,bidirectionalServices), [{escapeService,0},{systemStatus,1}], [{tag,128,3,'IMPLICIT',32}]) + encode_named_bit_string(Cindex4, [{escapeService,0},{systemStatus,1}], [<<131>>]) end, %%------------------------------------------------- -%% attribute number 5 with type BIT STRING DEFAULT = [] +%% attribute statusReportingServices(5) with type BIT STRING DEFAULT = [] %%------------------------------------------------- - {EncBytes5,EncLen5} = case ?RT_BER:cindex(6,Val,statusReportingServices) of + {EncBytes5,EncLen5} = case Cindex5 of asn1_DEFAULT -> {<<>>,0}; [] -> {<<>>,0}; _ -> - ?RT_BER:encode_bit_string([], ?RT_BER:cindex(6,Val,statusReportingServices), [{monitorStart,0},{changeMonitorFilter,1},{monitorStop,2},{snapshotDevice,3},{snapshotCall,4}], [{tag,128,4,'IMPLICIT',32}]) + encode_named_bit_string(Cindex5, [{monitorStart,0},{changeMonitorFilter,1},{monitorStop,2},{snapshotDevice,3},{snapshotCall,4}], [<<132>>]) end, %%------------------------------------------------- -%% attribute number 6 with type BIT STRING DEFAULT = [] +%% attribute inputOutputServices(6) with type BIT STRING DEFAULT = [] %%------------------------------------------------- - {EncBytes6,EncLen6} = case ?RT_BER:cindex(7,Val,inputOutputServices) of + {EncBytes6,EncLen6} = case Cindex6 of asn1_DEFAULT -> {<<>>,0}; [] -> {<<>>,0}; _ -> - ?RT_BER:encode_bit_string([], ?RT_BER:cindex(7,Val,inputOutputServices), [{startDataPathService,0},{stopDataPathService,1},{sendDataService,2},{sendMulticastDataService,3},{sendBroadcastDataService,4},{suspendDataPathService,5},{dataPathSuspendedService,6},{resumeDataPath,7},{dataPathResumedService,8},{fastData,9}], [{tag,128,5,'IMPLICIT',32}]) + encode_named_bit_string(Cindex6, [{startDataPathService,0},{stopDataPathService,1},{sendDataService,2},{sendMulticastDataService,3},{sendBroadcastDataService,4},{suspendDataPathService,5},{dataPathSuspendedService,6},{resumeDataPath,7},{dataPathResumedService,8},{fastData,9}], [<<133>>]) end, %%------------------------------------------------- -%% attribute number 7 with type BIT STRING DEFAULT = [] +%% attribute voiceUnitServices(7) with type BIT STRING DEFAULT = [] %%------------------------------------------------- - {EncBytes7,EncLen7} = case ?RT_BER:cindex(8,Val,voiceUnitServices) of + {EncBytes7,EncLen7} = case Cindex7 of asn1_DEFAULT -> {<<>>,0}; [] -> {<<>>,0}; _ -> - ?RT_BER:encode_bit_string([], ?RT_BER:cindex(8,Val,voiceUnitServices), [{concatenateMessage,0},{deleteMessage,1},{playMessage,2},{queryVoiceAttribute,3},{recordMessage,4},{reposition,5},{resume,6},{review,7},{setVoiceAttribute,8},{stop,9},{suspend,10},{synthesizeMessage,11}], [{tag,128,6,'IMPLICIT',32}]) + encode_named_bit_string(Cindex7, [{concatenateMessage,0},{deleteMessage,1},{playMessage,2},{queryVoiceAttribute,3},{recordMessage,4},{reposition,5},{resume,6},{review,7},{setVoiceAttribute,8},{stop,9},{suspend,10},{synthesizeMessage,11}], [<<134>>]) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4, EncBytes5, EncBytes6, EncBytes7], - LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5 + EncLen6 + EncLen7, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5 + EncLen6 + EncLen7, +encode_tags(TagIn, BytesSoFar, LenSoFar). -'dec_CSTAFunctionality'(Bytes, OptOrMand) -> - 'dec_CSTAFunctionality'(Bytes, OptOrMand, []). +'dec_CSTAFunctionality'(Tlv) -> + 'dec_CSTAFunctionality'(Tlv, [16]). -'dec_CSTAFunctionality'(Bytes, OptOrMand, TagIn) -> +'dec_CSTAFunctionality'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 with type BIT STRING DEFAULT = [] +%% attribute switchingFunctionServices(1) with type BIT STRING DEFAULT = [] %%------------------------------------------------- - {Term1,Bytes3,Rb2} = case Bytes2 of -<<2:2,_:1,0:5,_/binary>> -> -?RT_BER:decode_bit_string(Bytes2,[],[{alternateCall,0},{answerCall,1},{associateData,2},{callCompletion,3},{clearCall,4},{clearConnection,5},{conferenceCall,6},{consultationCall,7},{divertCall,8},{holdCall,9},{makeCall,10},{makePredictiveCall,11},{parkCall,12},{queryDevice,13},{reconnectCall,14},{retrieveCall,15},{sendDTMFTones,16},{setFeature,17},{singleStepConference,18},{singleStepTransfer,19},{transferCall,20}],[{tag,128,0,'IMPLICIT',32}], no_length, mandatory); -_ -> -{[],Bytes2, 0 } +{Term1,Tlv2} = case Tlv1 of +[{131072,V1}|TempTlv2] -> + {decode_named_bit_string(V1, [{alternateCall,0},{answerCall,1},{associateData,2},{callCompletion,3},{clearCall,4},{clearConnection,5},{conferenceCall,6},{consultationCall,7},{divertCall,8},{holdCall,9},{makeCall,10},{makePredictiveCall,11},{parkCall,12},{queryDevice,13},{reconnectCall,14},{retrieveCall,15},{sendDTMFTones,16},{setFeature,17},{singleStepConference,18},{singleStepTransfer,19},{transferCall,20}], []), TempTlv2}; + _ -> + {[],Tlv1} end, %%------------------------------------------------- -%% attribute number 2 with type BIT STRING DEFAULT = [] +%% attribute eventReportServices(2) with type BIT STRING DEFAULT = [] %%------------------------------------------------- - {Term2,Bytes4,Rb3} = case Bytes3 of -<<2:2,_:1,1:5,_/binary>> -> -?RT_BER:decode_bit_string(Bytes3,[],[{callCleared,0},{conferenced,1},{connectionCleared,2},{delivered,3},{diverted,4},{established,5},{failed,6},{held,7},{networkReached,8},{originated,9},{queued,10},{retrieved,11},{serviceInitiated,12},{transferred,13},{autoAnswer,14},{callInformation,15},{doNotDisturb,16},{forwarding,17},{messageWaiting,18},{microphoneMute,19},{speakerMute,20},{speakerVolume,21},{agentBusy,22},{loggedOn,23},{loggedOff,24},{notReady,25},{ready,26},{workingAfterCall,27},{backInService,28},{outOfServiceEvent,29},{privateEvent,30},{playEvent,31},{recordEvent,32},{reviewEvent,33},{stopEvent,34},{suspendPlayEvent,35},{suspendRecordEvent,36},{voiceAttributesChangeEvent,37}],[{tag,128,1,'IMPLICIT',32}], no_length, mandatory); -_ -> -{[],Bytes3, 0 } +{Term2,Tlv3} = case Tlv2 of +[{131073,V2}|TempTlv3] -> + {decode_named_bit_string(V2, [{callCleared,0},{conferenced,1},{connectionCleared,2},{delivered,3},{diverted,4},{established,5},{failed,6},{held,7},{networkReached,8},{originated,9},{queued,10},{retrieved,11},{serviceInitiated,12},{transferred,13},{autoAnswer,14},{callInformation,15},{doNotDisturb,16},{forwarding,17},{messageWaiting,18},{microphoneMute,19},{speakerMute,20},{speakerVolume,21},{agentBusy,22},{loggedOn,23},{loggedOff,24},{notReady,25},{ready,26},{workingAfterCall,27},{backInService,28},{outOfServiceEvent,29},{privateEvent,30},{playEvent,31},{recordEvent,32},{reviewEvent,33},{stopEvent,34},{suspendPlayEvent,35},{suspendRecordEvent,36},{voiceAttributesChangeEvent,37}], []), TempTlv3}; + _ -> + {[],Tlv2} end, %%------------------------------------------------- -%% attribute number 3 with type BIT STRING DEFAULT = [] +%% attribute computingFunctionServices(3) with type BIT STRING DEFAULT = [] %%------------------------------------------------- - {Term3,Bytes5,Rb4} = case Bytes4 of -<<2:2,_:1,2:5,_/binary>> -> -?RT_BER:decode_bit_string(Bytes4,[],[{routeRequest,0},{reRouteRequest,1},{routeSelectRequest,2},{routeUsedRequest,3},{routeEndRequest,4}],[{tag,128,2,'IMPLICIT',32}], no_length, mandatory); -_ -> -{[],Bytes4, 0 } +{Term3,Tlv4} = case Tlv3 of +[{131074,V3}|TempTlv4] -> + {decode_named_bit_string(V3, [{routeRequest,0},{reRouteRequest,1},{routeSelectRequest,2},{routeUsedRequest,3},{routeEndRequest,4}], []), TempTlv4}; + _ -> + {[],Tlv3} end, %%------------------------------------------------- -%% attribute number 4 with type BIT STRING DEFAULT = [] +%% attribute bidirectionalServices(4) with type BIT STRING DEFAULT = [] %%------------------------------------------------- - {Term4,Bytes6,Rb5} = case Bytes5 of -<<2:2,_:1,3:5,_/binary>> -> -?RT_BER:decode_bit_string(Bytes5,[],[{escapeService,0},{systemStatus,1}],[{tag,128,3,'IMPLICIT',32}], no_length, mandatory); -_ -> -{[],Bytes5, 0 } +{Term4,Tlv5} = case Tlv4 of +[{131075,V4}|TempTlv5] -> + {decode_named_bit_string(V4, [{escapeService,0},{systemStatus,1}], []), TempTlv5}; + _ -> + {[],Tlv4} end, %%------------------------------------------------- -%% attribute number 5 with type BIT STRING DEFAULT = [] +%% attribute statusReportingServices(5) with type BIT STRING DEFAULT = [] %%------------------------------------------------- - {Term5,Bytes7,Rb6} = case Bytes6 of -<<2:2,_:1,4:5,_/binary>> -> -?RT_BER:decode_bit_string(Bytes6,[],[{monitorStart,0},{changeMonitorFilter,1},{monitorStop,2},{snapshotDevice,3},{snapshotCall,4}],[{tag,128,4,'IMPLICIT',32}], no_length, mandatory); -_ -> -{[],Bytes6, 0 } +{Term5,Tlv6} = case Tlv5 of +[{131076,V5}|TempTlv6] -> + {decode_named_bit_string(V5, [{monitorStart,0},{changeMonitorFilter,1},{monitorStop,2},{snapshotDevice,3},{snapshotCall,4}], []), TempTlv6}; + _ -> + {[],Tlv5} end, %%------------------------------------------------- -%% attribute number 6 with type BIT STRING DEFAULT = [] +%% attribute inputOutputServices(6) with type BIT STRING DEFAULT = [] %%------------------------------------------------- - {Term6,Bytes8,Rb7} = case Bytes7 of -<<2:2,_:1,5:5,_/binary>> -> -?RT_BER:decode_bit_string(Bytes7,[],[{startDataPathService,0},{stopDataPathService,1},{sendDataService,2},{sendMulticastDataService,3},{sendBroadcastDataService,4},{suspendDataPathService,5},{dataPathSuspendedService,6},{resumeDataPath,7},{dataPathResumedService,8},{fastData,9}],[{tag,128,5,'IMPLICIT',32}], no_length, mandatory); -_ -> -{[],Bytes7, 0 } +{Term6,Tlv7} = case Tlv6 of +[{131077,V6}|TempTlv7] -> + {decode_named_bit_string(V6, [{startDataPathService,0},{stopDataPathService,1},{sendDataService,2},{sendMulticastDataService,3},{sendBroadcastDataService,4},{suspendDataPathService,5},{dataPathSuspendedService,6},{resumeDataPath,7},{dataPathResumedService,8},{fastData,9}], []), TempTlv7}; + _ -> + {[],Tlv6} end, %%------------------------------------------------- -%% attribute number 7 with type BIT STRING DEFAULT = [] +%% attribute voiceUnitServices(7) with type BIT STRING DEFAULT = [] %%------------------------------------------------- - {Term7,Bytes9,Rb8} = case Bytes8 of -<<2:2,_:1,6:5,_/binary>> -> -?RT_BER:decode_bit_string(Bytes8,[],[{concatenateMessage,0},{deleteMessage,1},{playMessage,2},{queryVoiceAttribute,3},{recordMessage,4},{reposition,5},{resume,6},{review,7},{setVoiceAttribute,8},{stop,9},{suspend,10},{synthesizeMessage,11}],[{tag,128,6,'IMPLICIT',32}], no_length, mandatory); -_ -> -{[],Bytes8, 0 } +{Term7,Tlv8} = case Tlv7 of +[{131078,V7}|TempTlv8] -> + {decode_named_bit_string(V7, [{concatenateMessage,0},{deleteMessage,1},{playMessage,2},{queryVoiceAttribute,3},{recordMessage,4},{reposition,5},{resume,6},{review,7},{setVoiceAttribute,8},{stop,9},{suspend,10},{synthesizeMessage,11}], []), TempTlv8}; + _ -> + {[],Tlv7} +end, + +case Tlv8 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv8}}}) % extra fields not allowed end, + {'CSTAFunctionality', Term1, Term2, Term3, Term4, Term5, Term6, Term7}. - {Bytes10,Rb9} = ?RT_BER:restbytes2(RemBytes, Bytes9,noext), - {{'CSTAFunctionality', Term1, Term2, Term3, Term4, Term5, Term6, Term7}, Bytes10, Rb1+Rb2+Rb3+Rb4+Rb5+Rb6+Rb7+Rb8+Rb9}. %%================================ %% SwitchingFunctionServicesC2 %%================================ - -'enc_SwitchingFunctionServicesC2'({'SwitchingFunctionServicesC2',Val}, TagIn) -> - 'enc_SwitchingFunctionServicesC2'(Val, TagIn); +'enc_SwitchingFunctionServicesC2'(Val) -> + 'enc_SwitchingFunctionServicesC2'(Val, [<<3>>]). 'enc_SwitchingFunctionServicesC2'(Val, TagIn) -> -?RT_BER:encode_bit_string([], Val, [{alternateCall,0},{answerCall,1},{associateData,2},{callCompletion,3},{clearCall,4},{clearConnection,5},{conferenceCall,6},{consultationCall,7},{divertCall,8},{holdCall,9},{makeCall,10},{makePredictiveCall,11},{parkCall,12},{queryDevice,13},{reconnectCall,14},{retrieveCall,15},{sendDTMFTones,16},{setFeature,17},{singleStepConference,18},{singleStepTransfer,19},{transferCall,20}], TagIn ++ []). +encode_named_bit_string(Val, [{alternateCall,0},{answerCall,1},{associateData,2},{callCompletion,3},{clearCall,4},{clearConnection,5},{conferenceCall,6},{consultationCall,7},{divertCall,8},{holdCall,9},{makeCall,10},{makePredictiveCall,11},{parkCall,12},{queryDevice,13},{reconnectCall,14},{retrieveCall,15},{sendDTMFTones,16},{setFeature,17},{singleStepConference,18},{singleStepTransfer,19},{transferCall,20}], TagIn). -'dec_SwitchingFunctionServicesC2'(Bytes, OptOrMand) -> - 'dec_SwitchingFunctionServicesC2'(Bytes, OptOrMand, []). +'dec_SwitchingFunctionServicesC2'(Tlv) -> + 'dec_SwitchingFunctionServicesC2'(Tlv, [3]). -'dec_SwitchingFunctionServicesC2'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_bit_string(Bytes,[],[{alternateCall,0},{answerCall,1},{associateData,2},{callCompletion,3},{clearCall,4},{clearConnection,5},{conferenceCall,6},{consultationCall,7},{divertCall,8},{holdCall,9},{makeCall,10},{makePredictiveCall,11},{parkCall,12},{queryDevice,13},{reconnectCall,14},{retrieveCall,15},{sendDTMFTones,16},{setFeature,17},{singleStepConference,18},{singleStepTransfer,19},{transferCall,20}],TagIn++[], no_length, OptOrMand). +'dec_SwitchingFunctionServicesC2'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{alternateCall,0},{answerCall,1},{associateData,2},{callCompletion,3},{clearCall,4},{clearConnection,5},{conferenceCall,6},{consultationCall,7},{divertCall,8},{holdCall,9},{makeCall,10},{makePredictiveCall,11},{parkCall,12},{queryDevice,13},{reconnectCall,14},{retrieveCall,15},{sendDTMFTones,16},{setFeature,17},{singleStepConference,18},{singleStepTransfer,19},{transferCall,20}], TagIn). %%================================ %% EventReportServicesC2 %%================================ - -'enc_EventReportServicesC2'({'EventReportServicesC2',Val}, TagIn) -> - 'enc_EventReportServicesC2'(Val, TagIn); +'enc_EventReportServicesC2'(Val) -> + 'enc_EventReportServicesC2'(Val, [<<3>>]). 'enc_EventReportServicesC2'(Val, TagIn) -> -?RT_BER:encode_bit_string([], Val, [{callCleared,0},{conferenced,1},{connectionCleared,2},{delivered,3},{diverted,4},{established,5},{failed,6},{held,7},{networkReached,8},{originated,9},{queued,10},{retrieved,11},{serviceInitiated,12},{transferred,13},{autoAnswer,14},{callInformation,15},{doNotDisturb,16},{forwarding,17},{messageWaiting,18},{microphoneMute,19},{speakerMute,20},{speakerVolume,21},{agentBusy,22},{loggedOn,23},{loggedOff,24},{notReady,25},{ready,26},{workingAfterCall,27},{backInService,28},{outOfServiceEvent,29},{privateEvent,30},{playEvent,31},{recordEvent,32},{reviewEvent,33},{stopEvent,34},{suspendPlayEvent,35},{suspendRecordEvent,36},{voiceAttributesChangeEvent,37}], TagIn ++ []). +encode_named_bit_string(Val, [{callCleared,0},{conferenced,1},{connectionCleared,2},{delivered,3},{diverted,4},{established,5},{failed,6},{held,7},{networkReached,8},{originated,9},{queued,10},{retrieved,11},{serviceInitiated,12},{transferred,13},{autoAnswer,14},{callInformation,15},{doNotDisturb,16},{forwarding,17},{messageWaiting,18},{microphoneMute,19},{speakerMute,20},{speakerVolume,21},{agentBusy,22},{loggedOn,23},{loggedOff,24},{notReady,25},{ready,26},{workingAfterCall,27},{backInService,28},{outOfServiceEvent,29},{privateEvent,30},{playEvent,31},{recordEvent,32},{reviewEvent,33},{stopEvent,34},{suspendPlayEvent,35},{suspendRecordEvent,36},{voiceAttributesChangeEvent,37}], TagIn). -'dec_EventReportServicesC2'(Bytes, OptOrMand) -> - 'dec_EventReportServicesC2'(Bytes, OptOrMand, []). +'dec_EventReportServicesC2'(Tlv) -> + 'dec_EventReportServicesC2'(Tlv, [3]). -'dec_EventReportServicesC2'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_bit_string(Bytes,[],[{callCleared,0},{conferenced,1},{connectionCleared,2},{delivered,3},{diverted,4},{established,5},{failed,6},{held,7},{networkReached,8},{originated,9},{queued,10},{retrieved,11},{serviceInitiated,12},{transferred,13},{autoAnswer,14},{callInformation,15},{doNotDisturb,16},{forwarding,17},{messageWaiting,18},{microphoneMute,19},{speakerMute,20},{speakerVolume,21},{agentBusy,22},{loggedOn,23},{loggedOff,24},{notReady,25},{ready,26},{workingAfterCall,27},{backInService,28},{outOfServiceEvent,29},{privateEvent,30},{playEvent,31},{recordEvent,32},{reviewEvent,33},{stopEvent,34},{suspendPlayEvent,35},{suspendRecordEvent,36},{voiceAttributesChangeEvent,37}],TagIn++[], no_length, OptOrMand). +'dec_EventReportServicesC2'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{callCleared,0},{conferenced,1},{connectionCleared,2},{delivered,3},{diverted,4},{established,5},{failed,6},{held,7},{networkReached,8},{originated,9},{queued,10},{retrieved,11},{serviceInitiated,12},{transferred,13},{autoAnswer,14},{callInformation,15},{doNotDisturb,16},{forwarding,17},{messageWaiting,18},{microphoneMute,19},{speakerMute,20},{speakerVolume,21},{agentBusy,22},{loggedOn,23},{loggedOff,24},{notReady,25},{ready,26},{workingAfterCall,27},{backInService,28},{outOfServiceEvent,29},{privateEvent,30},{playEvent,31},{recordEvent,32},{reviewEvent,33},{stopEvent,34},{suspendPlayEvent,35},{suspendRecordEvent,36},{voiceAttributesChangeEvent,37}], TagIn). %%================================ %% ComputingFunctionServicesC2 %%================================ - -'enc_ComputingFunctionServicesC2'({'ComputingFunctionServicesC2',Val}, TagIn) -> - 'enc_ComputingFunctionServicesC2'(Val, TagIn); +'enc_ComputingFunctionServicesC2'(Val) -> + 'enc_ComputingFunctionServicesC2'(Val, [<<3>>]). 'enc_ComputingFunctionServicesC2'(Val, TagIn) -> -?RT_BER:encode_bit_string([], Val, [{routeRequest,0},{reRouteRequest,1},{routeSelectRequest,2},{routeUsedRequest,3},{routeEndRequest,4}], TagIn ++ []). +encode_named_bit_string(Val, [{routeRequest,0},{reRouteRequest,1},{routeSelectRequest,2},{routeUsedRequest,3},{routeEndRequest,4}], TagIn). -'dec_ComputingFunctionServicesC2'(Bytes, OptOrMand) -> - 'dec_ComputingFunctionServicesC2'(Bytes, OptOrMand, []). +'dec_ComputingFunctionServicesC2'(Tlv) -> + 'dec_ComputingFunctionServicesC2'(Tlv, [3]). -'dec_ComputingFunctionServicesC2'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_bit_string(Bytes,[],[{routeRequest,0},{reRouteRequest,1},{routeSelectRequest,2},{routeUsedRequest,3},{routeEndRequest,4}],TagIn++[], no_length, OptOrMand). +'dec_ComputingFunctionServicesC2'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{routeRequest,0},{reRouteRequest,1},{routeSelectRequest,2},{routeUsedRequest,3},{routeEndRequest,4}], TagIn). %%================================ %% BidirectionalServicesC2 %%================================ - -'enc_BidirectionalServicesC2'({'BidirectionalServicesC2',Val}, TagIn) -> - 'enc_BidirectionalServicesC2'(Val, TagIn); +'enc_BidirectionalServicesC2'(Val) -> + 'enc_BidirectionalServicesC2'(Val, [<<3>>]). 'enc_BidirectionalServicesC2'(Val, TagIn) -> -?RT_BER:encode_bit_string([], Val, [{escapeService,0},{systemStatus,1}], TagIn ++ []). +encode_named_bit_string(Val, [{escapeService,0},{systemStatus,1}], TagIn). -'dec_BidirectionalServicesC2'(Bytes, OptOrMand) -> - 'dec_BidirectionalServicesC2'(Bytes, OptOrMand, []). +'dec_BidirectionalServicesC2'(Tlv) -> + 'dec_BidirectionalServicesC2'(Tlv, [3]). -'dec_BidirectionalServicesC2'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_bit_string(Bytes,[],[{escapeService,0},{systemStatus,1}],TagIn++[], no_length, OptOrMand). +'dec_BidirectionalServicesC2'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{escapeService,0},{systemStatus,1}], TagIn). %%================================ %% StatusReportingServicesC2 %%================================ - -'enc_StatusReportingServicesC2'({'StatusReportingServicesC2',Val}, TagIn) -> - 'enc_StatusReportingServicesC2'(Val, TagIn); +'enc_StatusReportingServicesC2'(Val) -> + 'enc_StatusReportingServicesC2'(Val, [<<3>>]). 'enc_StatusReportingServicesC2'(Val, TagIn) -> -?RT_BER:encode_bit_string([], Val, [{monitorStart,0},{changeMonitorFilter,1},{monitorStop,2},{snapshotDevice,3},{snapshotCall,4}], TagIn ++ []). +encode_named_bit_string(Val, [{monitorStart,0},{changeMonitorFilter,1},{monitorStop,2},{snapshotDevice,3},{snapshotCall,4}], TagIn). -'dec_StatusReportingServicesC2'(Bytes, OptOrMand) -> - 'dec_StatusReportingServicesC2'(Bytes, OptOrMand, []). +'dec_StatusReportingServicesC2'(Tlv) -> + 'dec_StatusReportingServicesC2'(Tlv, [3]). -'dec_StatusReportingServicesC2'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_bit_string(Bytes,[],[{monitorStart,0},{changeMonitorFilter,1},{monitorStop,2},{snapshotDevice,3},{snapshotCall,4}],TagIn++[], no_length, OptOrMand). +'dec_StatusReportingServicesC2'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{monitorStart,0},{changeMonitorFilter,1},{monitorStop,2},{snapshotDevice,3},{snapshotCall,4}], TagIn). %%================================ %% InputOutputServicesC2 %%================================ - -'enc_InputOutputServicesC2'({'InputOutputServicesC2',Val}, TagIn) -> - 'enc_InputOutputServicesC2'(Val, TagIn); +'enc_InputOutputServicesC2'(Val) -> + 'enc_InputOutputServicesC2'(Val, [<<3>>]). 'enc_InputOutputServicesC2'(Val, TagIn) -> -?RT_BER:encode_bit_string([], Val, [{startDataPathService,0},{stopDataPathService,1},{sendDataService,2},{sendMulticastDataService,3},{sendBroadcastDataService,4},{suspendDataPathService,5},{dataPathSuspendedService,6},{resumeDataPath,7},{dataPathResumedService,8},{fastData,9}], TagIn ++ []). +encode_named_bit_string(Val, [{startDataPathService,0},{stopDataPathService,1},{sendDataService,2},{sendMulticastDataService,3},{sendBroadcastDataService,4},{suspendDataPathService,5},{dataPathSuspendedService,6},{resumeDataPath,7},{dataPathResumedService,8},{fastData,9}], TagIn). -'dec_InputOutputServicesC2'(Bytes, OptOrMand) -> - 'dec_InputOutputServicesC2'(Bytes, OptOrMand, []). +'dec_InputOutputServicesC2'(Tlv) -> + 'dec_InputOutputServicesC2'(Tlv, [3]). -'dec_InputOutputServicesC2'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_bit_string(Bytes,[],[{startDataPathService,0},{stopDataPathService,1},{sendDataService,2},{sendMulticastDataService,3},{sendBroadcastDataService,4},{suspendDataPathService,5},{dataPathSuspendedService,6},{resumeDataPath,7},{dataPathResumedService,8},{fastData,9}],TagIn++[], no_length, OptOrMand). +'dec_InputOutputServicesC2'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{startDataPathService,0},{stopDataPathService,1},{sendDataService,2},{sendMulticastDataService,3},{sendBroadcastDataService,4},{suspendDataPathService,5},{dataPathSuspendedService,6},{resumeDataPath,7},{dataPathResumedService,8},{fastData,9}], TagIn). %%================================ %% VoiceUnitServicesC2 %%================================ - -'enc_VoiceUnitServicesC2'({'VoiceUnitServicesC2',Val}, TagIn) -> - 'enc_VoiceUnitServicesC2'(Val, TagIn); +'enc_VoiceUnitServicesC2'(Val) -> + 'enc_VoiceUnitServicesC2'(Val, [<<3>>]). 'enc_VoiceUnitServicesC2'(Val, TagIn) -> -?RT_BER:encode_bit_string([], Val, [{concatenateMessage,0},{deleteMessage,1},{playMessage,2},{queryVoiceAttribute,3},{recordMessage,4},{reposition,5},{resume,6},{review,7},{setVoiceAttribute,8},{stop,9},{suspend,10},{synthesizeMessage,11}], TagIn ++ []). +encode_named_bit_string(Val, [{concatenateMessage,0},{deleteMessage,1},{playMessage,2},{queryVoiceAttribute,3},{recordMessage,4},{reposition,5},{resume,6},{review,7},{setVoiceAttribute,8},{stop,9},{suspend,10},{synthesizeMessage,11}], TagIn). -'dec_VoiceUnitServicesC2'(Bytes, OptOrMand) -> - 'dec_VoiceUnitServicesC2'(Bytes, OptOrMand, []). +'dec_VoiceUnitServicesC2'(Tlv) -> + 'dec_VoiceUnitServicesC2'(Tlv, [3]). -'dec_VoiceUnitServicesC2'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_bit_string(Bytes,[],[{concatenateMessage,0},{deleteMessage,1},{playMessage,2},{queryVoiceAttribute,3},{recordMessage,4},{reposition,5},{resume,6},{review,7},{setVoiceAttribute,8},{stop,9},{suspend,10},{synthesizeMessage,11}],TagIn++[], no_length, OptOrMand). +'dec_VoiceUnitServicesC2'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{concatenateMessage,0},{deleteMessage,1},{playMessage,2},{queryVoiceAttribute,3},{recordMessage,4},{reposition,5},{resume,6},{review,7},{setVoiceAttribute,8},{stop,9},{suspend,10},{synthesizeMessage,11}], TagIn). %%================================ %% ACSEUserInformationForCSTA %%================================ - -'enc_ACSEUserInformationForCSTA'({'ACSEUserInformationForCSTA',Val}, TagIn) -> - 'enc_ACSEUserInformationForCSTA'(Val, TagIn); +'enc_ACSEUserInformationForCSTA'(Val) -> + 'enc_ACSEUserInformationForCSTA'(Val, []). 'enc_ACSEUserInformationForCSTA'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of oldDefinition -> - 'enc_OldACSEUserInformationForCSTA'(element(2,Val), []); + 'enc_OldACSEUserInformationForCSTA'(element(2,Val), [<<48>>]); newDefinition -> - 'enc_NewACSEUserInformationForCSTA'(element(2,Val), [{tag,128,0,'IMPLICIT',32}]); + 'enc_NewACSEUserInformationForCSTA'(element(2,Val), [<<160>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). +encode_tags(TagIn, EncBytes, EncLen). -'dec_ACSEUserInformationForCSTA'(Bytes, OptOrMand) -> - 'dec_ACSEUserInformationForCSTA'(Bytes, OptOrMand, []). +'dec_ACSEUserInformationForCSTA'(Tlv) -> + 'dec_ACSEUserInformationForCSTA'(Tlv, []). -'dec_ACSEUserInformationForCSTA'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of +'dec_ACSEUserInformationForCSTA'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of %% 'oldDefinition' - <<0:2,_:1,16:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_OldACSEUserInformationForCSTA'(Bytes1, mandatory, []), - {{oldDefinition, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {16, V1} -> + {oldDefinition, 'dec_OldACSEUserInformationForCSTA'(V1, [])}; %% 'newDefinition' - <<2:2,_:1,0:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_NewACSEUserInformationForCSTA'(Bytes1, mandatory, [{tag,128,0,'IMPLICIT',32}]), - {{newDefinition, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131072, V1} -> + {newDefinition, 'dec_NewACSEUserInformationForCSTA'(V1, [])}; Else -> - case OptOrMand of - mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}}); - _ ->exit({error,{asn1,{no_optional_tag,Else}}}) - end - end. + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. %%================================ %% OldACSEUserInformationForCSTA %%================================ +'enc_OldACSEUserInformationForCSTA'(Val) -> + 'enc_OldACSEUserInformationForCSTA'(Val, [<<48>>]). + 'enc_OldACSEUserInformationForCSTA'(Val, TagIn) -> +{_,Cindex1, Cindex2, Cindex3} = Val, %%------------------------------------------------- -%% attribute number 1 with type BIT STRING +%% attribute cSTAVersion(1) with type BIT STRING %%------------------------------------------------- - {EncBytes1,EncLen1} = ?RT_BER:encode_bit_string([], ?RT_BER:cindex(2,Val,cSTAVersion), [{versionOne,0},{versionTwo,1},{versionThree,2},{versionFour,3},{versionFive,4},{versionSix,5},{versionSeven,6},{versionEight,7},{versionNine,8},{versionTen,9},{versionEleven,10},{versionTwelve,11},{versionThirteen,12},{versionFourteen,13},{versionFifteen,14},{versionSixteen,15},{versionSeventeen,16},{versionEighteen,17},{versionNineteen,18},{versionTwenty,19},{versionTwentyone,20},{versionTwentytwo,21},{versionTwentythree,22},{versionTwentyfour,23}], []), + {EncBytes1,EncLen1} = encode_named_bit_string(Cindex1, [{versionOne,0},{versionTwo,1},{versionThree,2},{versionFour,3},{versionFive,4},{versionSix,5},{versionSeven,6},{versionEight,7},{versionNine,8},{versionTen,9},{versionEleven,10},{versionTwelve,11},{versionThirteen,12},{versionFourteen,13},{versionFifteen,14},{versionSixteen,15},{versionSeventeen,16},{versionEighteen,17},{versionNineteen,18},{versionTwenty,19},{versionTwentyone,20},{versionTwentytwo,21},{versionTwentythree,22},{versionTwentyfour,23}], [<<3>>]), %%------------------------------------------------- -%% attribute number 2 External CSTA-application-context-information-csta3:CSTAFunctionality +%% attribute cSTAFunctionsRequiredByApplication(2) External CSTA-application-context-information-csta3:CSTAFunctionality %%------------------------------------------------- - {EncBytes2,EncLen2} = 'enc_CSTAFunctionality'(?RT_BER:cindex(3,Val,cSTAFunctionsRequiredByApplication), []), + {EncBytes2,EncLen2} = 'enc_CSTAFunctionality'(Cindex2, [<<48>>]), %%------------------------------------------------- -%% attribute number 3 External CSTA-application-context-information-csta3:CSTAFunctionality +%% attribute cSTAFunctionsThatCanBeSupplied(3) External CSTA-application-context-information-csta3:CSTAFunctionality %%------------------------------------------------- - {EncBytes3,EncLen3} = 'enc_CSTAFunctionality'(?RT_BER:cindex(4,Val,cSTAFunctionsThatCanBeSupplied), []), + {EncBytes3,EncLen3} = 'enc_CSTAFunctionality'(Cindex3, [<<48>>]), BytesSoFar = [EncBytes1, EncBytes2, EncBytes3], - LenSoFar = EncLen1 + EncLen2 + EncLen3, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2 + EncLen3, +encode_tags(TagIn, BytesSoFar, LenSoFar). -'dec_OldACSEUserInformationForCSTA'(Bytes, OptOrMand) -> - 'dec_OldACSEUserInformationForCSTA'(Bytes, OptOrMand, []). +'dec_OldACSEUserInformationForCSTA'(Tlv) -> + 'dec_OldACSEUserInformationForCSTA'(Tlv, [16]). -'dec_OldACSEUserInformationForCSTA'(Bytes, OptOrMand, TagIn) -> +'dec_OldACSEUserInformationForCSTA'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 with type BIT STRING +%% attribute cSTAVersion(1) with type BIT STRING %%------------------------------------------------- - {Term1,Bytes3,Rb2} = ?RT_BER:decode_bit_string(Bytes2,[],[{versionOne,0},{versionTwo,1},{versionThree,2},{versionFour,3},{versionFive,4},{versionSix,5},{versionSeven,6},{versionEight,7},{versionNine,8},{versionTen,9},{versionEleven,10},{versionTwelve,11},{versionThirteen,12},{versionFourteen,13},{versionFifteen,14},{versionSixteen,15},{versionSeventeen,16},{versionEighteen,17},{versionNineteen,18},{versionTwenty,19},{versionTwentyone,20},{versionTwentytwo,21},{versionTwentythree,22},{versionTwentyfour,23}],[], no_length, mandatory), +[V1|Tlv2] = Tlv1, +Term1 = decode_named_bit_string(V1, [{versionOne,0},{versionTwo,1},{versionThree,2},{versionFour,3},{versionFive,4},{versionSix,5},{versionSeven,6},{versionEight,7},{versionNine,8},{versionTen,9},{versionEleven,10},{versionTwelve,11},{versionThirteen,12},{versionFourteen,13},{versionFifteen,14},{versionSixteen,15},{versionSeventeen,16},{versionEighteen,17},{versionNineteen,18},{versionTwenty,19},{versionTwentyone,20},{versionTwentytwo,21},{versionTwentythree,22},{versionTwentyfour,23}], [3]), %%------------------------------------------------- -%% attribute number 2 External CSTA-application-context-information-csta3:CSTAFunctionality +%% attribute cSTAFunctionsRequiredByApplication(2) External CSTA-application-context-information-csta3:CSTAFunctionality %%------------------------------------------------- - {Term2,Bytes4,Rb3} = 'dec_CSTAFunctionality'(Bytes3, mandatory, []), +[V2|Tlv3] = Tlv2, +Term2 = 'dec_CSTAFunctionality'(V2, [16]), %%------------------------------------------------- -%% attribute number 3 External CSTA-application-context-information-csta3:CSTAFunctionality +%% attribute cSTAFunctionsThatCanBeSupplied(3) External CSTA-application-context-information-csta3:CSTAFunctionality %%------------------------------------------------- - {Term3,Bytes5,Rb4} = 'dec_CSTAFunctionality'(Bytes4, mandatory, []), +[V3|Tlv4] = Tlv3, +Term3 = 'dec_CSTAFunctionality'(V3, [16]), + +case Tlv4 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowed +end, + {'OldACSEUserInformationForCSTA', Term1, Term2, Term3}. - {Bytes6,Rb5} = ?RT_BER:restbytes2(RemBytes, Bytes5,noext), - {{'OldACSEUserInformationForCSTA', Term1, Term2, Term3}, Bytes6, Rb1+Rb2+Rb3+Rb4+Rb5}. %%================================ %% NewACSEUserInformationForCSTA %%================================ +'enc_NewACSEUserInformationForCSTA'(Val) -> + 'enc_NewACSEUserInformationForCSTA'(Val, [<<48>>]). + 'enc_NewACSEUserInformationForCSTA'(Val, TagIn) -> +{_,Cindex1, Cindex2, Cindex3, Cindex4} = Val, %%------------------------------------------------- -%% attribute number 1 with type BIT STRING +%% attribute cSTAVersion(1) with type BIT STRING %%------------------------------------------------- - {EncBytes1,EncLen1} = ?RT_BER:encode_bit_string([], ?RT_BER:cindex(2,Val,cSTAVersion), [{versionOne,0},{versionTwo,1},{versionThree,2},{versionFour,3},{versionFive,4},{versionSix,5},{versionSeven,6},{versionEight,7},{versionNine,8},{versionTen,9},{versionEleven,10},{versionTwelve,11},{versionThirteen,12},{versionFourteen,13},{versionFifteen,14},{versionSixteen,15},{versionSeventeen,16},{versionEighteen,17},{versionNineteen,18},{versionTwenty,19},{versionTwentyone,20},{versionTwentytwo,21},{versionTwentythree,22},{versionTwentyfour,23}], []), + {EncBytes1,EncLen1} = encode_named_bit_string(Cindex1, [{versionOne,0},{versionTwo,1},{versionThree,2},{versionFour,3},{versionFive,4},{versionSix,5},{versionSeven,6},{versionEight,7},{versionNine,8},{versionTen,9},{versionEleven,10},{versionTwelve,11},{versionThirteen,12},{versionFourteen,13},{versionFifteen,14},{versionSixteen,15},{versionSeventeen,16},{versionEighteen,17},{versionNineteen,18},{versionTwenty,19},{versionTwentyone,20},{versionTwentytwo,21},{versionTwentythree,22},{versionTwentyfour,23}], [<<3>>]), %%------------------------------------------------- -%% attribute number 2 External CSTA-application-context-information-csta3:CSTAFunctionality OPTIONAL +%% attribute cSTAFunctionsRequiredByApplication(2) External CSTA-application-context-information-csta3:CSTAFunctionality OPTIONAL %%------------------------------------------------- - {EncBytes2,EncLen2} = case ?RT_BER:cindex(3,Val,cSTAFunctionsRequiredByApplication) of + {EncBytes2,EncLen2} = case Cindex2 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_CSTAFunctionality'(?RT_BER:cindex(3,Val,cSTAFunctionsRequiredByApplication), [{tag,128,0,'IMPLICIT',32}]) + 'enc_CSTAFunctionality'(Cindex2, [<<160>>]) end, %%------------------------------------------------- -%% attribute number 3 External CSTA-application-context-information-csta3:CSTAFunctionality OPTIONAL +%% attribute cSTAFunctionsThatCanBeSupplied(3) External CSTA-application-context-information-csta3:CSTAFunctionality OPTIONAL %%------------------------------------------------- - {EncBytes3,EncLen3} = case ?RT_BER:cindex(4,Val,cSTAFunctionsThatCanBeSupplied) of + {EncBytes3,EncLen3} = case Cindex3 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_CSTAFunctionality'(?RT_BER:cindex(4,Val,cSTAFunctionsThatCanBeSupplied), [{tag,128,1,'IMPLICIT',32}]) + 'enc_CSTAFunctionality'(Cindex3, [<<161>>]) end, %%------------------------------------------------- -%% attribute number 4 External CSTA-application-context-information-csta3:CSTAPrivateDataVersionList OPTIONAL +%% attribute cSTAPrivateDataVersionList(4) External CSTA-application-context-information-csta3:CSTAPrivateDataVersionList OPTIONAL %%------------------------------------------------- - {EncBytes4,EncLen4} = case ?RT_BER:cindex(5,Val,cSTAPrivateDataVersionList) of + {EncBytes4,EncLen4} = case Cindex4 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_CSTAPrivateDataVersionList'(?RT_BER:cindex(5,Val,cSTAPrivateDataVersionList), [{tag,128,2,'IMPLICIT',32}]) + 'enc_CSTAPrivateDataVersionList'(Cindex4, [<<162>>]) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4], - LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4, +encode_tags(TagIn, BytesSoFar, LenSoFar). -'dec_NewACSEUserInformationForCSTA'(Bytes, OptOrMand) -> - 'dec_NewACSEUserInformationForCSTA'(Bytes, OptOrMand, []). +'dec_NewACSEUserInformationForCSTA'(Tlv) -> + 'dec_NewACSEUserInformationForCSTA'(Tlv, [16]). -'dec_NewACSEUserInformationForCSTA'(Bytes, OptOrMand, TagIn) -> +'dec_NewACSEUserInformationForCSTA'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 with type BIT STRING +%% attribute cSTAVersion(1) with type BIT STRING %%------------------------------------------------- - {Term1,Bytes3,Rb2} = ?RT_BER:decode_bit_string(Bytes2,[],[{versionOne,0},{versionTwo,1},{versionThree,2},{versionFour,3},{versionFive,4},{versionSix,5},{versionSeven,6},{versionEight,7},{versionNine,8},{versionTen,9},{versionEleven,10},{versionTwelve,11},{versionThirteen,12},{versionFourteen,13},{versionFifteen,14},{versionSixteen,15},{versionSeventeen,16},{versionEighteen,17},{versionNineteen,18},{versionTwenty,19},{versionTwentyone,20},{versionTwentytwo,21},{versionTwentythree,22},{versionTwentyfour,23}],[], no_length, mandatory), +[V1|Tlv2] = Tlv1, +Term1 = decode_named_bit_string(V1, [{versionOne,0},{versionTwo,1},{versionThree,2},{versionFour,3},{versionFive,4},{versionSix,5},{versionSeven,6},{versionEight,7},{versionNine,8},{versionTen,9},{versionEleven,10},{versionTwelve,11},{versionThirteen,12},{versionFourteen,13},{versionFifteen,14},{versionSixteen,15},{versionSeventeen,16},{versionEighteen,17},{versionNineteen,18},{versionTwenty,19},{versionTwentyone,20},{versionTwentytwo,21},{versionTwentythree,22},{versionTwentyfour,23}], [3]), %%------------------------------------------------- -%% attribute number 2 External CSTA-application-context-information-csta3:CSTAFunctionality OPTIONAL +%% attribute cSTAFunctionsRequiredByApplication(2) External CSTA-application-context-information-csta3:CSTAFunctionality OPTIONAL %%------------------------------------------------- - {Term2,Bytes4,Rb3} = case Bytes3 of -<<2:2,_:1,0:5,_/binary>> -> -'dec_CSTAFunctionality'(Bytes3, opt_or_default, [{tag,128,0,'IMPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes3, 0 } +{Term2,Tlv3} = case Tlv2 of +[{131072,V2}|TempTlv3] -> + {'dec_CSTAFunctionality'(V2, []), TempTlv3}; + _ -> + { asn1_NOVALUE, Tlv2} end, %%------------------------------------------------- -%% attribute number 3 External CSTA-application-context-information-csta3:CSTAFunctionality OPTIONAL +%% attribute cSTAFunctionsThatCanBeSupplied(3) External CSTA-application-context-information-csta3:CSTAFunctionality OPTIONAL %%------------------------------------------------- - {Term3,Bytes5,Rb4} = case Bytes4 of -<<2:2,_:1,1:5,_/binary>> -> -'dec_CSTAFunctionality'(Bytes4, opt_or_default, [{tag,128,1,'IMPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes4, 0 } +{Term3,Tlv4} = case Tlv3 of +[{131073,V3}|TempTlv4] -> + {'dec_CSTAFunctionality'(V3, []), TempTlv4}; + _ -> + { asn1_NOVALUE, Tlv3} end, %%------------------------------------------------- -%% attribute number 4 External CSTA-application-context-information-csta3:CSTAPrivateDataVersionList OPTIONAL +%% attribute cSTAPrivateDataVersionList(4) External CSTA-application-context-information-csta3:CSTAPrivateDataVersionList OPTIONAL %%------------------------------------------------- - {Term4,Bytes6,Rb5} = case Bytes5 of -<<2:2,_:1,2:5,_/binary>> -> -'dec_CSTAPrivateDataVersionList'(Bytes5, opt_or_default, [{tag,128,2,'IMPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes5, 0 } +{Term4,Tlv5} = case Tlv4 of +[{131074,V4}|TempTlv5] -> + {'dec_CSTAPrivateDataVersionList'(V4, []), TempTlv5}; + _ -> + { asn1_NOVALUE, Tlv4} +end, + +case Tlv5 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv5}}}) % extra fields not allowed end, + {'NewACSEUserInformationForCSTA', Term1, Term2, Term3, Term4}. - {Bytes7,Rb6} = ?RT_BER:restbytes2(RemBytes, Bytes6,noext), - {{'NewACSEUserInformationForCSTA', Term1, Term2, Term3, Term4}, Bytes7, Rb1+Rb2+Rb3+Rb4+Rb5+Rb6}. %%================================ %% CSTAPrivateDataVersionList %%================================ - -'enc_CSTAPrivateDataVersionList'({'CSTAPrivateDataVersionList',Val}, TagIn) -> - 'enc_CSTAPrivateDataVersionList'(Val, TagIn); +'enc_CSTAPrivateDataVersionList'(Val) -> + 'enc_CSTAPrivateDataVersionList'(Val, [<<48>>]). 'enc_CSTAPrivateDataVersionList'(Val, TagIn) -> {EncBytes,EncLen} = 'enc_CSTAPrivateDataVersionList_components'(Val,[],0), - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], EncBytes, EncLen). + encode_tags(TagIn, EncBytes, EncLen). 'enc_CSTAPrivateDataVersionList_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_CSTAPrivateDataVersionList_components'([H|T],AccBytes, AccLen) -> - {EncBytes,EncLen} = ?RT_BER:encode_integer([], H, []), + {EncBytes,EncLen} = encode_integer(H, [<<2>>]), 'enc_CSTAPrivateDataVersionList_components'(T,[EncBytes|AccBytes], AccLen + EncLen). -'dec_CSTAPrivateDataVersionList'(Bytes, OptOrMand) -> - 'dec_CSTAPrivateDataVersionList'(Bytes, OptOrMand, []). +'dec_CSTAPrivateDataVersionList'(Tlv) -> + 'dec_CSTAPrivateDataVersionList'(Tlv, [16]). -'dec_CSTAPrivateDataVersionList'(Bytes, OptOrMand, TagIn) -> +'dec_CSTAPrivateDataVersionList'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), - ?RT_BER:decode_components(Rb1, Len, Bytes1, fun(FBytes,_,_)-> -?RT_BER:decode_integer(FBytes,[],[], mandatory) -end, [], []). +Tlv1 = match_tags(Tlv, TagIn), +[decode_integer(V1, [2]) || V1 <- Tlv1]. @@ -750,283 +728,517 @@ end, [], []). %%================================ %% CSTAVersion %%================================ - -'enc_CSTAVersion'({'CSTAVersion',Val}, TagIn) -> - 'enc_CSTAVersion'(Val, TagIn); +'enc_CSTAVersion'(Val) -> + 'enc_CSTAVersion'(Val, [<<3>>]). 'enc_CSTAVersion'(Val, TagIn) -> -?RT_BER:encode_bit_string([], Val, [{versionOne,0},{versionTwo,1},{versionThree,2},{versionFour,3},{versionFive,4},{versionSix,5},{versionSeven,6},{versionEight,7},{versionNine,8},{versionTen,9},{versionEleven,10},{versionTwelve,11},{versionThirteen,12},{versionFourteen,13},{versionFifteen,14},{versionSixteen,15},{versionSeventeen,16},{versionEighteen,17},{versionNineteen,18},{versionTwenty,19},{versionTwentyone,20},{versionTwentytwo,21},{versionTwentythree,22},{versionTwentyfour,23}], TagIn ++ []). +encode_named_bit_string(Val, [{versionOne,0},{versionTwo,1},{versionThree,2},{versionFour,3},{versionFive,4},{versionSix,5},{versionSeven,6},{versionEight,7},{versionNine,8},{versionTen,9},{versionEleven,10},{versionTwelve,11},{versionThirteen,12},{versionFourteen,13},{versionFifteen,14},{versionSixteen,15},{versionSeventeen,16},{versionEighteen,17},{versionNineteen,18},{versionTwenty,19},{versionTwentyone,20},{versionTwentytwo,21},{versionTwentythree,22},{versionTwentyfour,23}], TagIn). -'dec_CSTAVersion'(Bytes, OptOrMand) -> - 'dec_CSTAVersion'(Bytes, OptOrMand, []). +'dec_CSTAVersion'(Tlv) -> + 'dec_CSTAVersion'(Tlv, [3]). -'dec_CSTAVersion'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_bit_string(Bytes,[],[{versionOne,0},{versionTwo,1},{versionThree,2},{versionFour,3},{versionFive,4},{versionSix,5},{versionSeven,6},{versionEight,7},{versionNine,8},{versionTen,9},{versionEleven,10},{versionTwelve,11},{versionThirteen,12},{versionFourteen,13},{versionFifteen,14},{versionSixteen,15},{versionSeventeen,16},{versionEighteen,17},{versionNineteen,18},{versionTwenty,19},{versionTwentyone,20},{versionTwentytwo,21},{versionTwentythree,22},{versionTwentyfour,23}],TagIn++[], no_length, OptOrMand). +'dec_CSTAVersion'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{versionOne,0},{versionTwo,1},{versionThree,2},{versionFour,3},{versionFive,4},{versionSix,5},{versionSeven,6},{versionEight,7},{versionNine,8},{versionTen,9},{versionEleven,10},{versionTwelve,11},{versionThirteen,12},{versionFourteen,13},{versionFifteen,14},{versionSixteen,15},{versionSeventeen,16},{versionEighteen,17},{versionNineteen,18},{versionTwenty,19},{versionTwentyone,20},{versionTwentytwo,21},{versionTwentythree,22},{versionTwentyfour,23}], TagIn). %%================================ %% CallControlServices %%================================ - -'enc_CallControlServices'({'CallControlServices',Val}, TagIn) -> - 'enc_CallControlServices'(Val, TagIn); +'enc_CallControlServices'(Val) -> + 'enc_CallControlServices'(Val, [<<3>>]). 'enc_CallControlServices'(Val, TagIn) -> -?RT_BER:encode_bit_string([], Val, [{acceptCall,0},{alternateCall,1},{answerCall,2},{callBack,3},{callBackMessage,4},{campOnCall,5},{clearCall,6},{clearConnection,7},{conferenceCall,8},{consultationCall,9},{deflectCall,10},{dialDigits,11},{directedPickupCall,12},{groupPickupCall,13},{holdCall,14},{intrudeCall,15},{joinCall,16},{makeCall,17},{makePredictiveCall,18},{parkCall,19},{reconnectCall,20},{retrieveCall,21},{singleStepConference,22},{singleStepTransfer,23},{transferCall,24},{makeConnection,25},{sendMessage,26}], TagIn ++ []). +encode_named_bit_string(Val, [{acceptCall,0},{alternateCall,1},{answerCall,2},{callBack,3},{callBackMessage,4},{campOnCall,5},{clearCall,6},{clearConnection,7},{conferenceCall,8},{consultationCall,9},{deflectCall,10},{dialDigits,11},{directedPickupCall,12},{groupPickupCall,13},{holdCall,14},{intrudeCall,15},{joinCall,16},{makeCall,17},{makePredictiveCall,18},{parkCall,19},{reconnectCall,20},{retrieveCall,21},{singleStepConference,22},{singleStepTransfer,23},{transferCall,24},{makeConnection,25},{sendMessage,26}], TagIn). -'dec_CallControlServices'(Bytes, OptOrMand) -> - 'dec_CallControlServices'(Bytes, OptOrMand, []). +'dec_CallControlServices'(Tlv) -> + 'dec_CallControlServices'(Tlv, [3]). -'dec_CallControlServices'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_bit_string(Bytes,[],[{acceptCall,0},{alternateCall,1},{answerCall,2},{callBack,3},{callBackMessage,4},{campOnCall,5},{clearCall,6},{clearConnection,7},{conferenceCall,8},{consultationCall,9},{deflectCall,10},{dialDigits,11},{directedPickupCall,12},{groupPickupCall,13},{holdCall,14},{intrudeCall,15},{joinCall,16},{makeCall,17},{makePredictiveCall,18},{parkCall,19},{reconnectCall,20},{retrieveCall,21},{singleStepConference,22},{singleStepTransfer,23},{transferCall,24},{makeConnection,25},{sendMessage,26}],TagIn++[], no_length, OptOrMand). +'dec_CallControlServices'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{acceptCall,0},{alternateCall,1},{answerCall,2},{callBack,3},{callBackMessage,4},{campOnCall,5},{clearCall,6},{clearConnection,7},{conferenceCall,8},{consultationCall,9},{deflectCall,10},{dialDigits,11},{directedPickupCall,12},{groupPickupCall,13},{holdCall,14},{intrudeCall,15},{joinCall,16},{makeCall,17},{makePredictiveCall,18},{parkCall,19},{reconnectCall,20},{retrieveCall,21},{singleStepConference,22},{singleStepTransfer,23},{transferCall,24},{makeConnection,25},{sendMessage,26}], TagIn). %%================================ %% CallAssociatedServices %%================================ - -'enc_CallAssociatedServices'({'CallAssociatedServices',Val}, TagIn) -> - 'enc_CallAssociatedServices'(Val, TagIn); +'enc_CallAssociatedServices'(Val) -> + 'enc_CallAssociatedServices'(Val, [<<3>>]). 'enc_CallAssociatedServices'(Val, TagIn) -> -?RT_BER:encode_bit_string([], Val, [{associateData,0},{cancelTelephonyTones,1},{generateDigits,2},{generateTelephonyTones,3},{sendUserInformation,4},{changeConnectionInformation,5}], TagIn ++ []). +encode_named_bit_string(Val, [{associateData,0},{cancelTelephonyTones,1},{generateDigits,2},{generateTelephonyTones,3},{sendUserInformation,4},{changeConnectionInformation,5}], TagIn). -'dec_CallAssociatedServices'(Bytes, OptOrMand) -> - 'dec_CallAssociatedServices'(Bytes, OptOrMand, []). +'dec_CallAssociatedServices'(Tlv) -> + 'dec_CallAssociatedServices'(Tlv, [3]). -'dec_CallAssociatedServices'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_bit_string(Bytes,[],[{associateData,0},{cancelTelephonyTones,1},{generateDigits,2},{generateTelephonyTones,3},{sendUserInformation,4},{changeConnectionInformation,5}],TagIn++[], no_length, OptOrMand). +'dec_CallAssociatedServices'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{associateData,0},{cancelTelephonyTones,1},{generateDigits,2},{generateTelephonyTones,3},{sendUserInformation,4},{changeConnectionInformation,5}], TagIn). %%================================ %% MediaAttachmentServices %%================================ - -'enc_MediaAttachmentServices'({'MediaAttachmentServices',Val}, TagIn) -> - 'enc_MediaAttachmentServices'(Val, TagIn); +'enc_MediaAttachmentServices'(Val) -> + 'enc_MediaAttachmentServices'(Val, [<<3>>]). 'enc_MediaAttachmentServices'(Val, TagIn) -> -?RT_BER:encode_bit_string([], Val, [{attachMediaService,0},{detachMediaService,1}], TagIn ++ []). +encode_named_bit_string(Val, [{attachMediaService,0},{detachMediaService,1}], TagIn). -'dec_MediaAttachmentServices'(Bytes, OptOrMand) -> - 'dec_MediaAttachmentServices'(Bytes, OptOrMand, []). +'dec_MediaAttachmentServices'(Tlv) -> + 'dec_MediaAttachmentServices'(Tlv, [3]). -'dec_MediaAttachmentServices'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_bit_string(Bytes,[],[{attachMediaService,0},{detachMediaService,1}],TagIn++[], no_length, OptOrMand). +'dec_MediaAttachmentServices'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{attachMediaService,0},{detachMediaService,1}], TagIn). %%================================ %% RouteingServices %%================================ - -'enc_RouteingServices'({'RouteingServices',Val}, TagIn) -> - 'enc_RouteingServices'(Val, TagIn); +'enc_RouteingServices'(Val) -> + 'enc_RouteingServices'(Val, [<<3>>]). 'enc_RouteingServices'(Val, TagIn) -> -?RT_BER:encode_bit_string([], Val, [{routeRegister,0},{routeRegisterCancel,1},{routeRegisterAbort,2},{reroute,3},{routeEnd,4},{routeReject,5},{routeRequest,6},{routeSelect,7},{routeUsed,8}], TagIn ++ []). +encode_named_bit_string(Val, [{routeRegister,0},{routeRegisterCancel,1},{routeRegisterAbort,2},{reroute,3},{routeEnd,4},{routeReject,5},{routeRequest,6},{routeSelect,7},{routeUsed,8}], TagIn). -'dec_RouteingServices'(Bytes, OptOrMand) -> - 'dec_RouteingServices'(Bytes, OptOrMand, []). +'dec_RouteingServices'(Tlv) -> + 'dec_RouteingServices'(Tlv, [3]). -'dec_RouteingServices'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_bit_string(Bytes,[],[{routeRegister,0},{routeRegisterCancel,1},{routeRegisterAbort,2},{reroute,3},{routeEnd,4},{routeReject,5},{routeRequest,6},{routeSelect,7},{routeUsed,8}],TagIn++[], no_length, OptOrMand). +'dec_RouteingServices'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{routeRegister,0},{routeRegisterCancel,1},{routeRegisterAbort,2},{reroute,3},{routeEnd,4},{routeReject,5},{routeRequest,6},{routeSelect,7},{routeUsed,8}], TagIn). %%================================ %% VoiceUnitServices %%================================ - -'enc_VoiceUnitServices'({'VoiceUnitServices',Val}, TagIn) -> - 'enc_VoiceUnitServices'(Val, TagIn); +'enc_VoiceUnitServices'(Val) -> + 'enc_VoiceUnitServices'(Val, [<<3>>]). 'enc_VoiceUnitServices'(Val, TagIn) -> -?RT_BER:encode_bit_string([], Val, [{concatenateMessage,0},{deleteMessage,1},{playMessage,2},{queryVoiceAttribute,3},{recordMessage,4},{reposition,5},{resume,6},{review,7},{setVoiceAttribute,8},{stop,9},{suspend,10},{synthesizeMessage,11},{activate,12},{clear,13},{deactivate,14}], TagIn ++ []). +encode_named_bit_string(Val, [{concatenateMessage,0},{deleteMessage,1},{playMessage,2},{queryVoiceAttribute,3},{recordMessage,4},{reposition,5},{resume,6},{review,7},{setVoiceAttribute,8},{stop,9},{suspend,10},{synthesizeMessage,11},{activate,12},{clear,13},{deactivate,14}], TagIn). -'dec_VoiceUnitServices'(Bytes, OptOrMand) -> - 'dec_VoiceUnitServices'(Bytes, OptOrMand, []). +'dec_VoiceUnitServices'(Tlv) -> + 'dec_VoiceUnitServices'(Tlv, [3]). -'dec_VoiceUnitServices'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_bit_string(Bytes,[],[{concatenateMessage,0},{deleteMessage,1},{playMessage,2},{queryVoiceAttribute,3},{recordMessage,4},{reposition,5},{resume,6},{review,7},{setVoiceAttribute,8},{stop,9},{suspend,10},{synthesizeMessage,11},{activate,12},{clear,13},{deactivate,14}],TagIn++[], no_length, OptOrMand). +'dec_VoiceUnitServices'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{concatenateMessage,0},{deleteMessage,1},{playMessage,2},{queryVoiceAttribute,3},{recordMessage,4},{reposition,5},{resume,6},{review,7},{setVoiceAttribute,8},{stop,9},{suspend,10},{synthesizeMessage,11},{activate,12},{clear,13},{deactivate,14}], TagIn). %%================================ %% LocationServices %%================================ - -'enc_LocationServices'({'LocationServices',Val}, TagIn) -> - 'enc_LocationServices'(Val, TagIn); +'enc_LocationServices'(Val) -> + 'enc_LocationServices'(Val, [<<3>>]). 'enc_LocationServices'(Val, TagIn) -> -?RT_BER:encode_bit_string([], Val, [{getLocationInformation,0},{setLocationInformation,1},{locationTrackkingSessionResumed,2},{locationTrackkingSessionSuspended,3},{resumeLocationTrackingSession,4},{locationInformationReport,5},{startLocationTrackingSession,6},{stopLocationTrackingSession,7},{suspendLocationTrackingCapabilities,8},{locationSessionInfo,9}], TagIn ++ []). +encode_named_bit_string(Val, [{getLocationInformation,0},{setLocationInformation,1},{locationTrackkingSessionResumed,2},{locationTrackkingSessionSuspended,3},{resumeLocationTrackingSession,4},{locationInformationReport,5},{startLocationTrackingSession,6},{stopLocationTrackingSession,7},{suspendLocationTrackingCapabilities,8},{locationSessionInfo,9}], TagIn). -'dec_LocationServices'(Bytes, OptOrMand) -> - 'dec_LocationServices'(Bytes, OptOrMand, []). +'dec_LocationServices'(Tlv) -> + 'dec_LocationServices'(Tlv, [3]). -'dec_LocationServices'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_bit_string(Bytes,[],[{getLocationInformation,0},{setLocationInformation,1},{locationTrackkingSessionResumed,2},{locationTrackkingSessionSuspended,3},{resumeLocationTrackingSession,4},{locationInformationReport,5},{startLocationTrackingSession,6},{stopLocationTrackingSession,7},{suspendLocationTrackingCapabilities,8},{locationSessionInfo,9}],TagIn++[], no_length, OptOrMand). +'dec_LocationServices'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{getLocationInformation,0},{setLocationInformation,1},{locationTrackkingSessionResumed,2},{locationTrackkingSessionSuspended,3},{resumeLocationTrackingSession,4},{locationInformationReport,5},{startLocationTrackingSession,6},{stopLocationTrackingSession,7},{suspendLocationTrackingCapabilities,8},{locationSessionInfo,9}], TagIn). %%================================ %% CallControlEvents %%================================ - -'enc_CallControlEvents'({'CallControlEvents',Val}, TagIn) -> - 'enc_CallControlEvents'(Val, TagIn); +'enc_CallControlEvents'(Val) -> + 'enc_CallControlEvents'(Val, [<<3>>]). 'enc_CallControlEvents'(Val, TagIn) -> -?RT_BER:encode_bit_string([], Val, [{callCleared,0},{conferenced,1},{connectionCleared,2},{delivered,3},{diverted,4},{established,5},{failed,6},{held,7},{networkReached,8},{originated,9},{queued,10},{retrieved,11},{serviceInitiated,12},{transferred,13},{digitsDialed,14},{bridged,15},{networkCapabilitiesChanged,16},{offered,17}], TagIn ++ []). +encode_named_bit_string(Val, [{callCleared,0},{conferenced,1},{connectionCleared,2},{delivered,3},{diverted,4},{established,5},{failed,6},{held,7},{networkReached,8},{originated,9},{queued,10},{retrieved,11},{serviceInitiated,12},{transferred,13},{digitsDialed,14},{bridged,15},{networkCapabilitiesChanged,16},{offered,17}], TagIn). -'dec_CallControlEvents'(Bytes, OptOrMand) -> - 'dec_CallControlEvents'(Bytes, OptOrMand, []). +'dec_CallControlEvents'(Tlv) -> + 'dec_CallControlEvents'(Tlv, [3]). -'dec_CallControlEvents'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_bit_string(Bytes,[],[{callCleared,0},{conferenced,1},{connectionCleared,2},{delivered,3},{diverted,4},{established,5},{failed,6},{held,7},{networkReached,8},{originated,9},{queued,10},{retrieved,11},{serviceInitiated,12},{transferred,13},{digitsDialed,14},{bridged,15},{networkCapabilitiesChanged,16},{offered,17}],TagIn++[], no_length, OptOrMand). +'dec_CallControlEvents'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{callCleared,0},{conferenced,1},{connectionCleared,2},{delivered,3},{diverted,4},{established,5},{failed,6},{held,7},{networkReached,8},{originated,9},{queued,10},{retrieved,11},{serviceInitiated,12},{transferred,13},{digitsDialed,14},{bridged,15},{networkCapabilitiesChanged,16},{offered,17}], TagIn). %%================================ %% CallAssociatedEvents %%================================ - -'enc_CallAssociatedEvents'({'CallAssociatedEvents',Val}, TagIn) -> - 'enc_CallAssociatedEvents'(Val, TagIn); +'enc_CallAssociatedEvents'(Val) -> + 'enc_CallAssociatedEvents'(Val, [<<3>>]). 'enc_CallAssociatedEvents'(Val, TagIn) -> -?RT_BER:encode_bit_string([], Val, [{callInformation,0},{charging,1},{dTMFDigitsDetected,2},{telephonyTonesDetected,3},{serviceCompletionFailure,4}], TagIn ++ []). +encode_named_bit_string(Val, [{callInformation,0},{charging,1},{dTMFDigitsDetected,2},{telephonyTonesDetected,3},{serviceCompletionFailure,4}], TagIn). -'dec_CallAssociatedEvents'(Bytes, OptOrMand) -> - 'dec_CallAssociatedEvents'(Bytes, OptOrMand, []). +'dec_CallAssociatedEvents'(Tlv) -> + 'dec_CallAssociatedEvents'(Tlv, [3]). -'dec_CallAssociatedEvents'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_bit_string(Bytes,[],[{callInformation,0},{charging,1},{dTMFDigitsDetected,2},{telephonyTonesDetected,3},{serviceCompletionFailure,4}],TagIn++[], no_length, OptOrMand). +'dec_CallAssociatedEvents'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{callInformation,0},{charging,1},{dTMFDigitsDetected,2},{telephonyTonesDetected,3},{serviceCompletionFailure,4}], TagIn). %%================================ %% MediaAttachmentEvents %%================================ - -'enc_MediaAttachmentEvents'({'MediaAttachmentEvents',Val}, TagIn) -> - 'enc_MediaAttachmentEvents'(Val, TagIn); +'enc_MediaAttachmentEvents'(Val) -> + 'enc_MediaAttachmentEvents'(Val, [<<3>>]). 'enc_MediaAttachmentEvents'(Val, TagIn) -> -?RT_BER:encode_bit_string([], Val, [{mediaAttached,0},{mediaDetached,1}], TagIn ++ []). +encode_named_bit_string(Val, [{mediaAttached,0},{mediaDetached,1}], TagIn). -'dec_MediaAttachmentEvents'(Bytes, OptOrMand) -> - 'dec_MediaAttachmentEvents'(Bytes, OptOrMand, []). +'dec_MediaAttachmentEvents'(Tlv) -> + 'dec_MediaAttachmentEvents'(Tlv, [3]). -'dec_MediaAttachmentEvents'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_bit_string(Bytes,[],[{mediaAttached,0},{mediaDetached,1}],TagIn++[], no_length, OptOrMand). +'dec_MediaAttachmentEvents'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{mediaAttached,0},{mediaDetached,1}], TagIn). %%================================ %% PhysicalDeviceFeatureEvents %%================================ - -'enc_PhysicalDeviceFeatureEvents'({'PhysicalDeviceFeatureEvents',Val}, TagIn) -> - 'enc_PhysicalDeviceFeatureEvents'(Val, TagIn); +'enc_PhysicalDeviceFeatureEvents'(Val) -> + 'enc_PhysicalDeviceFeatureEvents'(Val, [<<3>>]). 'enc_PhysicalDeviceFeatureEvents'(Val, TagIn) -> -?RT_BER:encode_bit_string([], Val, [{buttonInformation,0},{buttonPress,1},{displayUpdated,2},{hookswitch,3},{lampMode,4},{messageWaiting,5},{microphoneGain,6},{microphoneMute,7},{ringerStatus,8},{speakerMute,9},{speakerVolume,10}], TagIn ++ []). +encode_named_bit_string(Val, [{buttonInformation,0},{buttonPress,1},{displayUpdated,2},{hookswitch,3},{lampMode,4},{messageWaiting,5},{microphoneGain,6},{microphoneMute,7},{ringerStatus,8},{speakerMute,9},{speakerVolume,10}], TagIn). -'dec_PhysicalDeviceFeatureEvents'(Bytes, OptOrMand) -> - 'dec_PhysicalDeviceFeatureEvents'(Bytes, OptOrMand, []). +'dec_PhysicalDeviceFeatureEvents'(Tlv) -> + 'dec_PhysicalDeviceFeatureEvents'(Tlv, [3]). -'dec_PhysicalDeviceFeatureEvents'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_bit_string(Bytes,[],[{buttonInformation,0},{buttonPress,1},{displayUpdated,2},{hookswitch,3},{lampMode,4},{messageWaiting,5},{microphoneGain,6},{microphoneMute,7},{ringerStatus,8},{speakerMute,9},{speakerVolume,10}],TagIn++[], no_length, OptOrMand). +'dec_PhysicalDeviceFeatureEvents'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{buttonInformation,0},{buttonPress,1},{displayUpdated,2},{hookswitch,3},{lampMode,4},{messageWaiting,5},{microphoneGain,6},{microphoneMute,7},{ringerStatus,8},{speakerMute,9},{speakerVolume,10}], TagIn). %%================================ %% LogicalDeviceFeatureEvents %%================================ - -'enc_LogicalDeviceFeatureEvents'({'LogicalDeviceFeatureEvents',Val}, TagIn) -> - 'enc_LogicalDeviceFeatureEvents'(Val, TagIn); +'enc_LogicalDeviceFeatureEvents'(Val) -> + 'enc_LogicalDeviceFeatureEvents'(Val, [<<3>>]). 'enc_LogicalDeviceFeatureEvents'(Val, TagIn) -> -?RT_BER:encode_bit_string([], Val, [{agentBusy,0},{agentLoggedOn,1},{agentLoggedOff,2},{agentNotReady,3},{agentReady,4},{agentWorkingAfterCall,5},{autoAnswer,6},{autoWorkMode,7},{callBack,8},{callBackMessage,9},{callerIDStatus,10},{doNotDisturb,11},{forwarding,12},{routeingMode,13},{presenceState,14}], TagIn ++ []). +encode_named_bit_string(Val, [{agentBusy,0},{agentLoggedOn,1},{agentLoggedOff,2},{agentNotReady,3},{agentReady,4},{agentWorkingAfterCall,5},{autoAnswer,6},{autoWorkMode,7},{callBack,8},{callBackMessage,9},{callerIDStatus,10},{doNotDisturb,11},{forwarding,12},{routeingMode,13},{presenceState,14}], TagIn). -'dec_LogicalDeviceFeatureEvents'(Bytes, OptOrMand) -> - 'dec_LogicalDeviceFeatureEvents'(Bytes, OptOrMand, []). +'dec_LogicalDeviceFeatureEvents'(Tlv) -> + 'dec_LogicalDeviceFeatureEvents'(Tlv, [3]). -'dec_LogicalDeviceFeatureEvents'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_bit_string(Bytes,[],[{agentBusy,0},{agentLoggedOn,1},{agentLoggedOff,2},{agentNotReady,3},{agentReady,4},{agentWorkingAfterCall,5},{autoAnswer,6},{autoWorkMode,7},{callBack,8},{callBackMessage,9},{callerIDStatus,10},{doNotDisturb,11},{forwarding,12},{routeingMode,13},{presenceState,14}],TagIn++[], no_length, OptOrMand). +'dec_LogicalDeviceFeatureEvents'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{agentBusy,0},{agentLoggedOn,1},{agentLoggedOff,2},{agentNotReady,3},{agentReady,4},{agentWorkingAfterCall,5},{autoAnswer,6},{autoWorkMode,7},{callBack,8},{callBackMessage,9},{callerIDStatus,10},{doNotDisturb,11},{forwarding,12},{routeingMode,13},{presenceState,14}], TagIn). %%================================ %% DeviceMaintenanceEvents %%================================ - -'enc_DeviceMaintenanceEvents'({'DeviceMaintenanceEvents',Val}, TagIn) -> - 'enc_DeviceMaintenanceEvents'(Val, TagIn); +'enc_DeviceMaintenanceEvents'(Val) -> + 'enc_DeviceMaintenanceEvents'(Val, [<<3>>]). 'enc_DeviceMaintenanceEvents'(Val, TagIn) -> -?RT_BER:encode_bit_string([], Val, [{backInService,0},{outOfService,1},{deviceCapabilityChanged,2},{partiallyInService,3}], TagIn ++ []). +encode_named_bit_string(Val, [{backInService,0},{outOfService,1},{deviceCapabilityChanged,2},{partiallyInService,3}], TagIn). -'dec_DeviceMaintenanceEvents'(Bytes, OptOrMand) -> - 'dec_DeviceMaintenanceEvents'(Bytes, OptOrMand, []). +'dec_DeviceMaintenanceEvents'(Tlv) -> + 'dec_DeviceMaintenanceEvents'(Tlv, [3]). -'dec_DeviceMaintenanceEvents'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_bit_string(Bytes,[],[{backInService,0},{outOfService,1},{deviceCapabilityChanged,2},{partiallyInService,3}],TagIn++[], no_length, OptOrMand). +'dec_DeviceMaintenanceEvents'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{backInService,0},{outOfService,1},{deviceCapabilityChanged,2},{partiallyInService,3}], TagIn). %%================================ %% VoiceUnitEvents %%================================ - -'enc_VoiceUnitEvents'({'VoiceUnitEvents',Val}, TagIn) -> - 'enc_VoiceUnitEvents'(Val, TagIn); +'enc_VoiceUnitEvents'(Val) -> + 'enc_VoiceUnitEvents'(Val, [<<3>>]). 'enc_VoiceUnitEvents'(Val, TagIn) -> -?RT_BER:encode_bit_string([], Val, [{stop,0},{play,1},{suspendPlay,2},{record,3},{suspendRecord,4},{review,5},{voiceAttributesChange,6},{bookmarkReached,7},{completed,8},{dtmfDetected,9},{emptied,10},{interruptionDetected,11},{notRecognized,12},{recognized,13},{started,14},{silenceTimeoutExpired,15},{speechDetected,16},{voiceErrorOccured,17}], TagIn ++ []). +encode_named_bit_string(Val, [{stop,0},{play,1},{suspendPlay,2},{record,3},{suspendRecord,4},{review,5},{voiceAttributesChange,6},{bookmarkReached,7},{completed,8},{dtmfDetected,9},{emptied,10},{interruptionDetected,11},{notRecognized,12},{recognized,13},{started,14},{silenceTimeoutExpired,15},{speechDetected,16},{voiceErrorOccured,17}], TagIn). -'dec_VoiceUnitEvents'(Bytes, OptOrMand) -> - 'dec_VoiceUnitEvents'(Bytes, OptOrMand, []). +'dec_VoiceUnitEvents'(Tlv) -> + 'dec_VoiceUnitEvents'(Tlv, [3]). -'dec_VoiceUnitEvents'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_bit_string(Bytes,[],[{stop,0},{play,1},{suspendPlay,2},{record,3},{suspendRecord,4},{review,5},{voiceAttributesChange,6},{bookmarkReached,7},{completed,8},{dtmfDetected,9},{emptied,10},{interruptionDetected,11},{notRecognized,12},{recognized,13},{started,14},{silenceTimeoutExpired,15},{speechDetected,16},{voiceErrorOccured,17}],TagIn++[], no_length, OptOrMand). +'dec_VoiceUnitEvents'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{stop,0},{play,1},{suspendPlay,2},{record,3},{suspendRecord,4},{review,5},{voiceAttributesChange,6},{bookmarkReached,7},{completed,8},{dtmfDetected,9},{emptied,10},{interruptionDetected,11},{notRecognized,12},{recognized,13},{started,14},{silenceTimeoutExpired,15},{speechDetected,16},{voiceErrorOccured,17}], TagIn). %%================================ %% VendorSpecEvents %%================================ - -'enc_VendorSpecEvents'({'VendorSpecEvents',Val}, TagIn) -> - 'enc_VendorSpecEvents'(Val, TagIn); +'enc_VendorSpecEvents'(Val) -> + 'enc_VendorSpecEvents'(Val, [<<3>>]). 'enc_VendorSpecEvents'(Val, TagIn) -> -?RT_BER:encode_bit_string([], Val, [{privateEvent,0}], TagIn ++ []). - - -'dec_VendorSpecEvents'(Bytes, OptOrMand) -> - 'dec_VendorSpecEvents'(Bytes, OptOrMand, []). - -'dec_VendorSpecEvents'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_bit_string(Bytes,[],[{privateEvent,0}],TagIn++[], no_length, OptOrMand). - +encode_named_bit_string(Val, [{privateEvent,0}], TagIn). + + +'dec_VendorSpecEvents'(Tlv) -> + 'dec_VendorSpecEvents'(Tlv, [3]). + +'dec_VendorSpecEvents'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{privateEvent,0}], TagIn). + + +%%% +%%% Run-time functions. +%%% + +'dialyzer-suppressions'(Arg) -> + ok. + +ber_decode_nif(B) -> + asn1rt_nif:decode_ber_tlv(B). + +collect_parts(TlvList) -> + collect_parts(TlvList, []). + +collect_parts([{_,L}|Rest], Acc) when is_list(L) -> + collect_parts(Rest, [collect_parts(L)|Acc]); +collect_parts([{3,<>}|Rest], _Acc) -> + collect_parts_bit(Rest, [Bits], Unused); +collect_parts([{_T,V}|Rest], Acc) -> + collect_parts(Rest, [V|Acc]); +collect_parts([], Acc) -> + list_to_binary(lists:reverse(Acc)). + +collect_parts_bit([{3,<>}|Rest], Acc, Uacc) -> + collect_parts_bit(Rest, [Bits|Acc], Unused + Uacc); +collect_parts_bit([], Acc, Uacc) -> + list_to_binary([Uacc|lists:reverse(Acc)]). + +decode_bitstring2(1, + Unused, + <>) -> + lists:sublist([B7,B6,B5,B4,B3,B2,B1,B0], 8 - Unused); +decode_bitstring2(Len, + Unused, + <>) -> + [B7,B6,B5,B4,B3,B2,B1,B0|decode_bitstring2(Len - 1, Unused, Buffer)]. + +decode_bitstring_NNL(BitList, NamedNumberList) -> + decode_bitstring_NNL(BitList, NamedNumberList, 0, []). + +decode_bitstring_NNL([], _, _No, Result) -> + lists:reverse(Result); +decode_bitstring_NNL([B|BitList], + [{Name,No}|NamedNumberList], + No, + Result) -> + if + B =:= 0 -> + decode_bitstring_NNL(BitList, + NamedNumberList, + No + 1, + Result); + true -> + decode_bitstring_NNL(BitList, + NamedNumberList, + No + 1, + [Name|Result]) + end; +decode_bitstring_NNL([1|BitList], NamedNumberList, No, Result) -> + decode_bitstring_NNL(BitList, + NamedNumberList, + No + 1, + [{bit,No}|Result]); +decode_bitstring_NNL([0|BitList], NamedNumberList, No, Result) -> + decode_bitstring_NNL(BitList, NamedNumberList, No + 1, Result). + +decode_integer(Tlv, TagIn) -> + Bin = match_tags(Tlv, TagIn), + Len = byte_size(Bin), + <> = Bin, + Int. + +decode_named_bit_string(Buffer, NamedNumberList, Tags) -> + case match_and_collect(Buffer, Tags) of + <<0>> -> + []; + <> -> + BitString = decode_bitstring2(byte_size(Bits), Unused, Bits), + decode_bitstring_NNL(BitString, NamedNumberList) + end. + +do_encode_named_bit_string([FirstVal|RestVal], NamedBitList, TagIn) -> + ToSetPos = get_all_bitposes([FirstVal|RestVal], NamedBitList, []), + Size = lists:max(ToSetPos) + 1, + BitList = make_and_set_list(Size, ToSetPos, 0), + {Len,Unused,OctetList} = encode_bitstring(BitList), + encode_tags(TagIn, [Unused|OctetList], Len + 1). + +encode_bitstring([B8,B7,B6,B5,B4,B3,B2,B1|Rest]) -> + Val = + B8 bsl 7 bor (B7 bsl 6) bor (B6 bsl 5) bor (B5 bsl 4) + bor + (B4 bsl 3) + bor + (B3 bsl 2) + bor + (B2 bsl 1) + bor + B1, + encode_bitstring(Rest, [Val], 1); +encode_bitstring(Val) -> + {Unused,Octet} = unused_bitlist(Val, 7, 0), + {1,Unused,[Octet]}. + +encode_bitstring([B8,B7,B6,B5,B4,B3,B2,B1|Rest], Ack, Len) -> + Val = + B8 bsl 7 bor (B7 bsl 6) bor (B6 bsl 5) bor (B5 bsl 4) + bor + (B4 bsl 3) + bor + (B3 bsl 2) + bor + (B2 bsl 1) + bor + B1, + encode_bitstring(Rest, [Ack,Val], Len + 1); +encode_bitstring([], Ack, Len) -> + {Len,0,Ack}; +encode_bitstring(Rest, Ack, Len) -> + {Unused,Val} = unused_bitlist(Rest, 7, 0), + {Len + 1,Unused,[Ack,Val]}. + +encode_integer(Val) -> + Bytes = + if + Val >= 0 -> + encode_integer_pos(Val, []); + true -> + encode_integer_neg(Val, []) + end, + {Bytes,length(Bytes)}. + +encode_integer(Val, Tag) when is_integer(Val) -> + encode_tags(Tag, encode_integer(Val)); +encode_integer(Val, _Tag) -> + exit({error,{asn1,{encode_integer,Val}}}). + +encode_integer_neg(- 1, [B1|_T] = L) when B1 > 127 -> + L; +encode_integer_neg(N, Acc) -> + encode_integer_neg(N bsr 8, [N band 255|Acc]). + +encode_integer_pos(0, [B|_Acc] = L) when B < 128 -> + L; +encode_integer_pos(N, Acc) -> + encode_integer_pos(N bsr 8, [N band 255|Acc]). + +encode_length(L) when L =< 127 -> + {[L],1}; +encode_length(L) -> + Oct = minimum_octets(L), + Len = length(Oct), + if + Len =< 126 -> + {[128 bor Len|Oct],Len + 1}; + true -> + exit({error,{asn1,too_long_length_oct,Len}}) + end. + +encode_named_bit_string([H|_] = Bits, NamedBitList, TagIn) + when is_atom(H) -> + do_encode_named_bit_string(Bits, NamedBitList, TagIn); +encode_named_bit_string([{bit,_}|_] = Bits, NamedBitList, TagIn) -> + do_encode_named_bit_string(Bits, NamedBitList, TagIn); +encode_named_bit_string(Bits, _NamedBitList, TagIn) + when is_bitstring(Bits) -> + encode_unnamed_bit_string(Bits, TagIn). + +encode_tags(TagIn, {BytesSoFar,LenSoFar}) -> + encode_tags(TagIn, BytesSoFar, LenSoFar). + +encode_tags([Tag|Trest], BytesSoFar, LenSoFar) -> + {Bytes2,L2} = encode_length(LenSoFar), + encode_tags(Trest, + [Tag,Bytes2|BytesSoFar], + LenSoFar + byte_size(Tag) + L2); +encode_tags([], BytesSoFar, LenSoFar) -> + {BytesSoFar,LenSoFar}. + +encode_unnamed_bit_string(Bits, TagIn) -> + Unused = (8 - bit_size(Bits) band 7) band 7, + Bin = <>, + encode_tags(TagIn, Bin, byte_size(Bin)). + +get_all_bitposes([{bit,ValPos}|Rest], NamedBitList, Ack) -> + get_all_bitposes(Rest, NamedBitList, [ValPos|Ack]); +get_all_bitposes([Val|Rest], NamedBitList, Ack) when is_atom(Val) -> + case lists:keyfind(Val, 1, NamedBitList) of + {_ValName,ValPos} -> + get_all_bitposes(Rest, NamedBitList, [ValPos|Ack]); + _ -> + exit({error,{asn1,{bitstring_namedbit,Val}}}) + end; +get_all_bitposes([], _NamedBitList, Ack) -> + lists:sort(Ack). + +make_and_set_list(0, [], _) -> + []; +make_and_set_list(0, _, _) -> + exit({error,{asn1,bitstring_sizeconstraint}}); +make_and_set_list(Len, [XPos|SetPos], XPos) -> + [1|make_and_set_list(Len - 1, SetPos, XPos + 1)]; +make_and_set_list(Len, [Pos|SetPos], XPos) -> + [0|make_and_set_list(Len - 1, [Pos|SetPos], XPos + 1)]; +make_and_set_list(Len, [], XPos) -> + [0|make_and_set_list(Len - 1, [], XPos + 1)]. + +match_and_collect(Tlv, TagsIn) -> + Val = match_tags(Tlv, TagsIn), + case Val of + [_|_] = PartList -> + collect_parts(PartList); + Bin when is_binary(Bin) -> + Bin + end. + +match_tags({T,V}, [T]) -> + V; +match_tags({T,V}, [T|Tt]) -> + match_tags(V, Tt); +match_tags([{T,V}], [T|Tt]) -> + match_tags(V, Tt); +match_tags([{T,_V}|_] = Vlist, [T]) -> + Vlist; +match_tags(Tlv, []) -> + Tlv; +match_tags({Tag,_V} = Tlv, [T|_Tt]) -> + exit({error,{asn1,{wrong_tag,{{expected,T},{got,Tag,Tlv}}}}}). + +minimum_octets(0, Acc) -> + Acc; +minimum_octets(Val, Acc) -> + minimum_octets(Val bsr 8, [Val band 255|Acc]). + +minimum_octets(Val) -> + minimum_octets(Val, []). + +unused_bitlist([], Trail, Ack) -> + {Trail + 1,Ack}; +unused_bitlist([Bit|Rest], Trail, Ack) -> + unused_bitlist(Rest, Trail - 1, Bit bsl Trail bor Ack). diff --git a/CSTA-application-context-information-csta3.hrl b/CSTA-application-context-information-csta3.hrl index 64728f5..ebcf786 100644 --- a/CSTA-application-context-information-csta3.hrl +++ b/CSTA-application-context-information-csta3.hrl @@ -1,10 +1,13 @@ -%% Generated by the Erlang ASN.1 compiler version:1.7 +%% Generated by the Erlang ASN.1 compiler version:4.0 %% Purpose: Erlang record definitions for each named and unnamed %% SEQUENCE and SET, and macro definitions for each value %% definition,in module CSTA-application-context-information-csta3 +-ifndef(_CSTA_APPLICATION_CONTEXT_INFORMATION_CSTA3_HRL_). +-define(_CSTA_APPLICATION_CONTEXT_INFORMATION_CSTA3_HRL_, true). + -record('CSTAFunctionality',{ switchingFunctionServices = asn1_DEFAULT, eventReportServices = asn1_DEFAULT, computingFunctionServices = asn1_DEFAULT, bidirectionalServices = asn1_DEFAULT, statusReportingServices = asn1_DEFAULT, inputOutputServices = asn1_DEFAULT, voiceUnitServices = asn1_DEFAULT}). @@ -14,3 +17,4 @@ cSTAVersion, cSTAFunctionsRequiredByApplication, cSTAFunctionsThatCanBeSupplied} -record('NewACSEUserInformationForCSTA',{ cSTAVersion, cSTAFunctionsRequiredByApplication = asn1_NOVALUE, cSTAFunctionsThatCanBeSupplied = asn1_NOVALUE, cSTAPrivateDataVersionList = asn1_NOVALUE}). +-endif. %% _CSTA_APPLICATION_CONTEXT_INFORMATION_CSTA3_HRL_ diff --git a/KME-specific-types.erl b/KME-specific-types.erl index d23ccf6..f230c2e 100644 --- a/KME-specific-types.erl +++ b/KME-specific-types.erl @@ -1,14 +1,23 @@ -%% Generated by the Erlang ASN.1 BER-compiler version:1.7 +%% Generated by the Erlang ASN.1 BER_V2-compiler version, utilizing bit-syntax:4.0 %% Purpose: encoder and decoder to the types in mod KME-specific-types -module('KME-specific-types'). +-compile(nowarn_unused_vars). -include("KME-specific-types.hrl"). --define('RT_BER',asn1rt_ber_bin). --asn1_info([{vsn,'1.7'}, +-asn1_info([{vsn,'4.0'}, {module,'KME-specific-types'}, - {options,[{i,[47,104,111,109,101,47,113,117,97,120,47,101,114,108,47,97,115,110]},warnings,ber,errors,{cwd,[47,104,111,109,101,47,113,117,97,120,47,101,114,108,47,97,115,110]},{outdir,[47,104,111,109,101,47,113,117,97,120,47,101,114,108,47,97,115,110]},{i,[47,104,111,109,101,47,113,117,97,120,47,101,114,108,47,97,115,110,47,99,115,116,97]},{i,[46]},{i,[47,104,111,109,101,47,113,117,97,120,47,101,114,108,47,97,115,110,47,107,109,101]}]}]). - --export([encoding_rule/0]). + {options,[{i,"/Users/quax/erl"}, + warnings,ber,errors, + {cwd,"/Users/quax/erl"}, + {outdir,"/Users/quax/erl"}, + {i,"/Users/quax/erl/acse"}, + {i,"/Users/quax/erl/csta"}, + {i,"."}, + {i,"/Users/quax/erl/kme"}]}]). + +-export([encoding_rule/0,bit_string_format/0, + legacy_erlang_types/0]). +-export(['dialyzer-suppressions'/1]). -export([ 'enc_KmeDeviceLock'/2, 'enc_KmeTimeStamp'/2, @@ -273,584 +282,472 @@ 'dec_KMESpecificPrivateData'/2 ]). --export([ -'dec_KmeDeviceLock'/3, -'dec_KmeTimeStamp'/3, -'dec_KmeSpeedDialRequest'/3, -'dec_KmeSpeedDial'/3, -'dec_KmeWakeUpTime'/3, -'dec_KmeWakeUpSchedule'/3, -'dec_KmeWakeUpInfo'/3, -'dec_KmeWakeupState'/3, -'dec_KmeAbsentMessage'/3, -'dec_KmeDnMode'/3, -'dec_KmeDayNightMode'/3, -'dec_KmeOgmPlayState'/3, -'dec_KmeForwardType'/3, -'dec_KmeSetForwardInfo'/3, -'dec_KmeFeatureList'/3, -'dec_KmeExtGroupEntry'/3, -'dec_KmeTrkGroupEntry'/3, -'dec_KmeExtMembers'/3, -'dec_KmeTrkMembers'/3, -'dec_KmeExtTrkGroupList'/3, -'dec_KmeGroupMembers'/3, -'dec_KmePckPagGroupList'/3, -'dec_KmeIcmGrpMembers'/3, -'dec_KmeIncomingGroupList'/3, -'dec_KmeDoorPhone'/3, -'dec_KmeVmGroup'/3, -'dec_KmeVmDtmfType'/3, -'dec_KmeVmGroupList'/3, -'dec_KmePsGroupList'/3, -'dec_KmeChangeExtNo'/3, -'dec_KmeChangeName'/3, -'dec_KmeDeviceCategory'/3, -'dec_KmeRequestedDevice'/3, -'dec_KmeChangedDeviceCategory'/3, -'dec_KmeDeviceStateList'/3, -'dec_KmeDeviceStateEntry'/3, -'dec_KmeDeviceState'/3, -'dec_KmeGroupType'/3, -'dec_KmePhoneProperty'/3, -'dec_KmeDeviceExtNo'/3, -'dec_KmeDeviceName'/3, -'dec_KmeFcoKeyInfo'/3, -'dec_KmeFcoKeyList'/3, -'dec_KmeExternalSensorList'/3, -'dec_KmeTenantSpeedDial'/3, -'dec_KmeDistributionMethod'/3, -'dec_KmePDFStart'/3, -'dec_KmePDFStop'/3, -'dec_KmePDFStatus'/3, -'dec_KmePDFSrvEvt'/3, -'dec_KmeSvmList'/3, -'dec_KmeExtName'/3, -'dec_NumberOfMsgPort'/3, -'dec_KmeDndOverride'/3, -'dec_KmeInteruptCall'/3, -'dec_KmeExternalFeatureAccess'/3, -'dec_KmeTempTollChange'/3, -'dec_KmeDoorOpen'/3, -'dec_KmeTwoWayRec'/3, -'dec_KmeCallBackInvokeReq'/3, -'dec_KmeCallBackInvokeRsp'/3, -'dec_CallBackNotification'/3, -'dec_KmeCallBackInvoke'/3, -'dec_KmePcRec'/3, -'dec_KmeDeviceAgentStatus'/3, -'dec_KmeDeviceCallStatus'/3, -'dec_KmeDeviceServiceStatus'/3, -'dec_KmeLineStatus'/3, -'dec_KmeLineStatusSegment'/3, -'dec_KmeStartDeviceMonitor'/3, -'dec_KmeStopDeviceMonitor'/3, -'dec_CallMonitorEvent'/3, -'dec_KmeBroadcastGroupList'/3, -'dec_KmeBroadcastGrpMembers'/3, -'dec_KmeAlterIfSrvEvt'/3, -'dec_KmeAlterIf'/3, -'dec_KmeIfAltered'/3, -'dec_IfVersion'/3, -'dec_KmeDeviceDataList'/3, -'dec_KmePdnGMembers'/3, -'dec_KmeHotelSrvEvt'/3, -'dec_KmeCheckStatusList'/3, -'dec_KmeRoomStatus'/3, -'dec_KmeCleanUpStatus'/3, -'dec_KmeGetSystemDataReq'/3, -'dec_KmeGetSystemDataRsp'/3, -'dec_KmeGetSystemData'/3, -'dec_KmeSetSystemData'/3, -'dec_KmeSystemDataChanged'/3, -'dec_KmeSystemDataLinkedReply'/3, -'dec_KmeGetSystemDataPosAck'/3, -'dec_KmeSystemCrossRefID'/3, -'dec_KmeLockSystemData'/3, -'dec_KmeSystemDataStatus'/3, -'dec_KmeSystemDataRevision'/3, -'dec_KmeGetSystemDataRevision'/3, -'dec_KmeRevisionType'/3, -'dec_ProgrammingEventOn'/3, -'dec_KmeSetProgrammingEventOn'/3, -'dec_KmeLocalAlerm'/3, -'dec_KmeTrunkId'/3, -'dec_KmeOtherDevice'/3, -'dec_KmeCdrConditionCode'/3, -'dec_KmeFeatureNumber'/3, -'dec_KmeProprietaryChars'/3, -'dec_KmeHoldType'/3, -'dec_KmeForcedAlerting'/3, -'dec_KmeDigitsReport'/3, -'dec_KmeOgmStatus'/3, -'dec_KmeWakeupResult'/3, -'dec_KmeUnconferenced'/3, -'dec_KmeTamEnded'/3, -'dec_KmePcRecEnded'/3, -'dec_KmeSwitchChannel'/3, -'dec_KmeFreeOgmPort'/3, -'dec_KmeCallControlSrvEvt'/3, -'dec_KmeDeviceStatus'/3, -'dec_KmeDeviceMonitor'/3, -'dec_KmeSystemData'/3, -'dec_KmeAdditionalData'/3, -'dec_KmePrivateEvent'/3, -'dec_KmeResourceControl'/3, -'dec_KmeOgmStart'/3, -'dec_KmeOgmStop'/3, -'dec_KmeGenericSrvEvt'/3, -'dec_KmeGenericServiceReq'/3, -'dec_KmeGenericServiceRsp'/3, -'dec_KmeGenericEvent'/3, -'dec_KMESpecificPrivateData'/3 -]). - -export([info/0]). --export([encode/2,decode/2,encode_disp/2,decode_disp/2]). +-export([encode/2,decode/2]). -encoding_rule() -> - ber. +encoding_rule() -> ber. -encode(Type,Data) -> -case catch encode_disp(Type,Data) of - {'EXIT',{error,Reason}} -> - {error,Reason}; - {'EXIT',Reason} -> - {error,{asn1,Reason}}; - {Bytes,_Len} -> - {ok,wrap_encode(Bytes)}; +bit_string_format() -> bitstring. + +legacy_erlang_types() -> false. + +encode(Type, Data) -> +try iolist_to_binary(element(1, encode_disp(Type, Data))) of Bytes -> - {ok,wrap_encode(Bytes)} + {ok,Bytes} + catch + Class:Exception when Class =:= error; Class =:= exit -> + case Exception of + {error,Reason}=Error -> + Error; + Reason -> + {error,{asn1,Reason}} + end end. decode(Type,Data) -> -case catch decode_disp(Type,wrap_decode(Data)) of - {'EXIT',{error,Reason}} -> - {error,Reason}; - {'EXIT',Reason} -> - {error,{asn1,Reason}}; - {X,_Rest} -> - {ok,X}; - {X,_Rest,_Len} -> - {ok,X} +try decode_disp(Type, element(1, ber_decode_nif(Data))) of + Result -> + {ok,Result} + catch + Class:Exception when Class =:= error; Class =:= exit -> + case Exception of + {error,Reason}=Error -> + Error; + Reason -> + {error,{asn1,Reason}} + end end. -encode_disp('KmeDeviceLock',Data) -> 'enc_KmeDeviceLock'(Data,[]); -encode_disp('KmeTimeStamp',Data) -> 'enc_KmeTimeStamp'(Data,[]); -encode_disp('KmeSpeedDialRequest',Data) -> 'enc_KmeSpeedDialRequest'(Data,[]); -encode_disp('KmeSpeedDial',Data) -> 'enc_KmeSpeedDial'(Data,[]); -encode_disp('KmeWakeUpTime',Data) -> 'enc_KmeWakeUpTime'(Data,[]); -encode_disp('KmeWakeUpSchedule',Data) -> 'enc_KmeWakeUpSchedule'(Data,[]); -encode_disp('KmeWakeUpInfo',Data) -> 'enc_KmeWakeUpInfo'(Data,[]); -encode_disp('KmeWakeupState',Data) -> 'enc_KmeWakeupState'(Data,[]); -encode_disp('KmeAbsentMessage',Data) -> 'enc_KmeAbsentMessage'(Data,[]); -encode_disp('KmeDnMode',Data) -> 'enc_KmeDnMode'(Data,[]); -encode_disp('KmeDayNightMode',Data) -> 'enc_KmeDayNightMode'(Data,[]); -encode_disp('KmeOgmPlayState',Data) -> 'enc_KmeOgmPlayState'(Data,[]); -encode_disp('KmeForwardType',Data) -> 'enc_KmeForwardType'(Data,[]); -encode_disp('KmeSetForwardInfo',Data) -> 'enc_KmeSetForwardInfo'(Data,[]); -encode_disp('KmeFeatureList',Data) -> 'enc_KmeFeatureList'(Data,[]); -encode_disp('KmeExtGroupEntry',Data) -> 'enc_KmeExtGroupEntry'(Data,[]); -encode_disp('KmeTrkGroupEntry',Data) -> 'enc_KmeTrkGroupEntry'(Data,[]); -encode_disp('KmeExtMembers',Data) -> 'enc_KmeExtMembers'(Data,[]); -encode_disp('KmeTrkMembers',Data) -> 'enc_KmeTrkMembers'(Data,[]); -encode_disp('KmeExtTrkGroupList',Data) -> 'enc_KmeExtTrkGroupList'(Data,[]); -encode_disp('KmeGroupMembers',Data) -> 'enc_KmeGroupMembers'(Data,[]); -encode_disp('KmePckPagGroupList',Data) -> 'enc_KmePckPagGroupList'(Data,[]); -encode_disp('KmeIcmGrpMembers',Data) -> 'enc_KmeIcmGrpMembers'(Data,[]); -encode_disp('KmeIncomingGroupList',Data) -> 'enc_KmeIncomingGroupList'(Data,[]); -encode_disp('KmeDoorPhone',Data) -> 'enc_KmeDoorPhone'(Data,[]); -encode_disp('KmeVmGroup',Data) -> 'enc_KmeVmGroup'(Data,[]); -encode_disp('KmeVmDtmfType',Data) -> 'enc_KmeVmDtmfType'(Data,[]); -encode_disp('KmeVmGroupList',Data) -> 'enc_KmeVmGroupList'(Data,[]); -encode_disp('KmePsGroupList',Data) -> 'enc_KmePsGroupList'(Data,[]); -encode_disp('KmeChangeExtNo',Data) -> 'enc_KmeChangeExtNo'(Data,[]); -encode_disp('KmeChangeName',Data) -> 'enc_KmeChangeName'(Data,[]); -encode_disp('KmeDeviceCategory',Data) -> 'enc_KmeDeviceCategory'(Data,[]); -encode_disp('KmeRequestedDevice',Data) -> 'enc_KmeRequestedDevice'(Data,[]); -encode_disp('KmeChangedDeviceCategory',Data) -> 'enc_KmeChangedDeviceCategory'(Data,[]); -encode_disp('KmeDeviceStateList',Data) -> 'enc_KmeDeviceStateList'(Data,[]); -encode_disp('KmeDeviceStateEntry',Data) -> 'enc_KmeDeviceStateEntry'(Data,[]); -encode_disp('KmeDeviceState',Data) -> 'enc_KmeDeviceState'(Data,[]); -encode_disp('KmeGroupType',Data) -> 'enc_KmeGroupType'(Data,[]); -encode_disp('KmePhoneProperty',Data) -> 'enc_KmePhoneProperty'(Data,[]); -encode_disp('KmeDeviceExtNo',Data) -> 'enc_KmeDeviceExtNo'(Data,[]); -encode_disp('KmeDeviceName',Data) -> 'enc_KmeDeviceName'(Data,[]); -encode_disp('KmeFcoKeyInfo',Data) -> 'enc_KmeFcoKeyInfo'(Data,[]); -encode_disp('KmeFcoKeyList',Data) -> 'enc_KmeFcoKeyList'(Data,[]); -encode_disp('KmeExternalSensorList',Data) -> 'enc_KmeExternalSensorList'(Data,[]); -encode_disp('KmeTenantSpeedDial',Data) -> 'enc_KmeTenantSpeedDial'(Data,[]); -encode_disp('KmeDistributionMethod',Data) -> 'enc_KmeDistributionMethod'(Data,[]); -encode_disp('KmePDFStart',Data) -> 'enc_KmePDFStart'(Data,[]); -encode_disp('KmePDFStop',Data) -> 'enc_KmePDFStop'(Data,[]); -encode_disp('KmePDFStatus',Data) -> 'enc_KmePDFStatus'(Data,[]); -encode_disp('KmePDFSrvEvt',Data) -> 'enc_KmePDFSrvEvt'(Data,[]); -encode_disp('KmeSvmList',Data) -> 'enc_KmeSvmList'(Data,[]); -encode_disp('KmeExtName',Data) -> 'enc_KmeExtName'(Data,[]); -encode_disp('NumberOfMsgPort',Data) -> 'enc_NumberOfMsgPort'(Data,[]); -encode_disp('KmeDndOverride',Data) -> 'enc_KmeDndOverride'(Data,[]); -encode_disp('KmeInteruptCall',Data) -> 'enc_KmeInteruptCall'(Data,[]); -encode_disp('KmeExternalFeatureAccess',Data) -> 'enc_KmeExternalFeatureAccess'(Data,[]); -encode_disp('KmeTempTollChange',Data) -> 'enc_KmeTempTollChange'(Data,[]); -encode_disp('KmeDoorOpen',Data) -> 'enc_KmeDoorOpen'(Data,[]); -encode_disp('KmeTwoWayRec',Data) -> 'enc_KmeTwoWayRec'(Data,[]); -encode_disp('KmeCallBackInvokeReq',Data) -> 'enc_KmeCallBackInvokeReq'(Data,[]); -encode_disp('KmeCallBackInvokeRsp',Data) -> 'enc_KmeCallBackInvokeRsp'(Data,[]); -encode_disp('CallBackNotification',Data) -> 'enc_CallBackNotification'(Data,[]); -encode_disp('KmeCallBackInvoke',Data) -> 'enc_KmeCallBackInvoke'(Data,[]); -encode_disp('KmePcRec',Data) -> 'enc_KmePcRec'(Data,[]); -encode_disp('KmeDeviceAgentStatus',Data) -> 'enc_KmeDeviceAgentStatus'(Data,[]); -encode_disp('KmeDeviceCallStatus',Data) -> 'enc_KmeDeviceCallStatus'(Data,[]); -encode_disp('KmeDeviceServiceStatus',Data) -> 'enc_KmeDeviceServiceStatus'(Data,[]); -encode_disp('KmeLineStatus',Data) -> 'enc_KmeLineStatus'(Data,[]); -encode_disp('KmeLineStatusSegment',Data) -> 'enc_KmeLineStatusSegment'(Data,[]); -encode_disp('KmeStartDeviceMonitor',Data) -> 'enc_KmeStartDeviceMonitor'(Data,[]); -encode_disp('KmeStopDeviceMonitor',Data) -> 'enc_KmeStopDeviceMonitor'(Data,[]); -encode_disp('CallMonitorEvent',Data) -> 'enc_CallMonitorEvent'(Data,[]); -encode_disp('KmeBroadcastGroupList',Data) -> 'enc_KmeBroadcastGroupList'(Data,[]); -encode_disp('KmeBroadcastGrpMembers',Data) -> 'enc_KmeBroadcastGrpMembers'(Data,[]); -encode_disp('KmeAlterIfSrvEvt',Data) -> 'enc_KmeAlterIfSrvEvt'(Data,[]); -encode_disp('KmeAlterIf',Data) -> 'enc_KmeAlterIf'(Data,[]); -encode_disp('KmeIfAltered',Data) -> 'enc_KmeIfAltered'(Data,[]); -encode_disp('IfVersion',Data) -> 'enc_IfVersion'(Data,[]); -encode_disp('KmeDeviceDataList',Data) -> 'enc_KmeDeviceDataList'(Data,[]); -encode_disp('KmePdnGMembers',Data) -> 'enc_KmePdnGMembers'(Data,[]); -encode_disp('KmeHotelSrvEvt',Data) -> 'enc_KmeHotelSrvEvt'(Data,[]); -encode_disp('KmeCheckStatusList',Data) -> 'enc_KmeCheckStatusList'(Data,[]); -encode_disp('KmeRoomStatus',Data) -> 'enc_KmeRoomStatus'(Data,[]); -encode_disp('KmeCleanUpStatus',Data) -> 'enc_KmeCleanUpStatus'(Data,[]); -encode_disp('KmeGetSystemDataReq',Data) -> 'enc_KmeGetSystemDataReq'(Data,[]); -encode_disp('KmeGetSystemDataRsp',Data) -> 'enc_KmeGetSystemDataRsp'(Data,[]); -encode_disp('KmeGetSystemData',Data) -> 'enc_KmeGetSystemData'(Data,[]); -encode_disp('KmeSetSystemData',Data) -> 'enc_KmeSetSystemData'(Data,[]); -encode_disp('KmeSystemDataChanged',Data) -> 'enc_KmeSystemDataChanged'(Data,[]); -encode_disp('KmeSystemDataLinkedReply',Data) -> 'enc_KmeSystemDataLinkedReply'(Data,[]); -encode_disp('KmeGetSystemDataPosAck',Data) -> 'enc_KmeGetSystemDataPosAck'(Data,[]); -encode_disp('KmeSystemCrossRefID',Data) -> 'enc_KmeSystemCrossRefID'(Data,[]); -encode_disp('KmeLockSystemData',Data) -> 'enc_KmeLockSystemData'(Data,[]); -encode_disp('KmeSystemDataStatus',Data) -> 'enc_KmeSystemDataStatus'(Data,[]); -encode_disp('KmeSystemDataRevision',Data) -> 'enc_KmeSystemDataRevision'(Data,[]); -encode_disp('KmeGetSystemDataRevision',Data) -> 'enc_KmeGetSystemDataRevision'(Data,[]); -encode_disp('KmeRevisionType',Data) -> 'enc_KmeRevisionType'(Data,[]); -encode_disp('ProgrammingEventOn',Data) -> 'enc_ProgrammingEventOn'(Data,[]); -encode_disp('KmeSetProgrammingEventOn',Data) -> 'enc_KmeSetProgrammingEventOn'(Data,[]); -encode_disp('KmeLocalAlerm',Data) -> 'enc_KmeLocalAlerm'(Data,[]); -encode_disp('KmeTrunkId',Data) -> 'enc_KmeTrunkId'(Data,[]); -encode_disp('KmeOtherDevice',Data) -> 'enc_KmeOtherDevice'(Data,[]); -encode_disp('KmeCdrConditionCode',Data) -> 'enc_KmeCdrConditionCode'(Data,[]); -encode_disp('KmeFeatureNumber',Data) -> 'enc_KmeFeatureNumber'(Data,[]); -encode_disp('KmeProprietaryChars',Data) -> 'enc_KmeProprietaryChars'(Data,[]); -encode_disp('KmeHoldType',Data) -> 'enc_KmeHoldType'(Data,[]); -encode_disp('KmeForcedAlerting',Data) -> 'enc_KmeForcedAlerting'(Data,[]); -encode_disp('KmeDigitsReport',Data) -> 'enc_KmeDigitsReport'(Data,[]); -encode_disp('KmeOgmStatus',Data) -> 'enc_KmeOgmStatus'(Data,[]); -encode_disp('KmeWakeupResult',Data) -> 'enc_KmeWakeupResult'(Data,[]); -encode_disp('KmeUnconferenced',Data) -> 'enc_KmeUnconferenced'(Data,[]); -encode_disp('KmeTamEnded',Data) -> 'enc_KmeTamEnded'(Data,[]); -encode_disp('KmePcRecEnded',Data) -> 'enc_KmePcRecEnded'(Data,[]); -encode_disp('KmeSwitchChannel',Data) -> 'enc_KmeSwitchChannel'(Data,[]); -encode_disp('KmeFreeOgmPort',Data) -> 'enc_KmeFreeOgmPort'(Data,[]); -encode_disp('KmeCallControlSrvEvt',Data) -> 'enc_KmeCallControlSrvEvt'(Data,[]); -encode_disp('KmeDeviceStatus',Data) -> 'enc_KmeDeviceStatus'(Data,[]); -encode_disp('KmeDeviceMonitor',Data) -> 'enc_KmeDeviceMonitor'(Data,[]); -encode_disp('KmeSystemData',Data) -> 'enc_KmeSystemData'(Data,[]); -encode_disp('KmeAdditionalData',Data) -> 'enc_KmeAdditionalData'(Data,[]); -encode_disp('KmePrivateEvent',Data) -> 'enc_KmePrivateEvent'(Data,[]); -encode_disp('KmeResourceControl',Data) -> 'enc_KmeResourceControl'(Data,[]); -encode_disp('KmeOgmStart',Data) -> 'enc_KmeOgmStart'(Data,[]); -encode_disp('KmeOgmStop',Data) -> 'enc_KmeOgmStop'(Data,[]); -encode_disp('KmeGenericSrvEvt',Data) -> 'enc_KmeGenericSrvEvt'(Data,[]); -encode_disp('KmeGenericServiceReq',Data) -> 'enc_KmeGenericServiceReq'(Data,[]); -encode_disp('KmeGenericServiceRsp',Data) -> 'enc_KmeGenericServiceRsp'(Data,[]); -encode_disp('KmeGenericEvent',Data) -> 'enc_KmeGenericEvent'(Data,[]); -encode_disp('KMESpecificPrivateData',Data) -> 'enc_KMESpecificPrivateData'(Data,[]); +encode_disp('KmeDeviceLock',Data) -> 'enc_KmeDeviceLock'(Data); +encode_disp('KmeTimeStamp',Data) -> 'enc_KmeTimeStamp'(Data); +encode_disp('KmeSpeedDialRequest',Data) -> 'enc_KmeSpeedDialRequest'(Data); +encode_disp('KmeSpeedDial',Data) -> 'enc_KmeSpeedDial'(Data); +encode_disp('KmeWakeUpTime',Data) -> 'enc_KmeWakeUpTime'(Data); +encode_disp('KmeWakeUpSchedule',Data) -> 'enc_KmeWakeUpSchedule'(Data); +encode_disp('KmeWakeUpInfo',Data) -> 'enc_KmeWakeUpInfo'(Data); +encode_disp('KmeWakeupState',Data) -> 'enc_KmeWakeupState'(Data); +encode_disp('KmeAbsentMessage',Data) -> 'enc_KmeAbsentMessage'(Data); +encode_disp('KmeDnMode',Data) -> 'enc_KmeDnMode'(Data); +encode_disp('KmeDayNightMode',Data) -> 'enc_KmeDayNightMode'(Data); +encode_disp('KmeOgmPlayState',Data) -> 'enc_KmeOgmPlayState'(Data); +encode_disp('KmeForwardType',Data) -> 'enc_KmeForwardType'(Data); +encode_disp('KmeSetForwardInfo',Data) -> 'enc_KmeSetForwardInfo'(Data); +encode_disp('KmeFeatureList',Data) -> 'enc_KmeFeatureList'(Data); +encode_disp('KmeExtGroupEntry',Data) -> 'enc_KmeExtGroupEntry'(Data); +encode_disp('KmeTrkGroupEntry',Data) -> 'enc_KmeTrkGroupEntry'(Data); +encode_disp('KmeExtMembers',Data) -> 'enc_KmeExtMembers'(Data); +encode_disp('KmeTrkMembers',Data) -> 'enc_KmeTrkMembers'(Data); +encode_disp('KmeExtTrkGroupList',Data) -> 'enc_KmeExtTrkGroupList'(Data); +encode_disp('KmeGroupMembers',Data) -> 'enc_KmeGroupMembers'(Data); +encode_disp('KmePckPagGroupList',Data) -> 'enc_KmePckPagGroupList'(Data); +encode_disp('KmeIcmGrpMembers',Data) -> 'enc_KmeIcmGrpMembers'(Data); +encode_disp('KmeIncomingGroupList',Data) -> 'enc_KmeIncomingGroupList'(Data); +encode_disp('KmeDoorPhone',Data) -> 'enc_KmeDoorPhone'(Data); +encode_disp('KmeVmGroup',Data) -> 'enc_KmeVmGroup'(Data); +encode_disp('KmeVmDtmfType',Data) -> 'enc_KmeVmDtmfType'(Data); +encode_disp('KmeVmGroupList',Data) -> 'enc_KmeVmGroupList'(Data); +encode_disp('KmePsGroupList',Data) -> 'enc_KmePsGroupList'(Data); +encode_disp('KmeChangeExtNo',Data) -> 'enc_KmeChangeExtNo'(Data); +encode_disp('KmeChangeName',Data) -> 'enc_KmeChangeName'(Data); +encode_disp('KmeDeviceCategory',Data) -> 'enc_KmeDeviceCategory'(Data); +encode_disp('KmeRequestedDevice',Data) -> 'enc_KmeRequestedDevice'(Data); +encode_disp('KmeChangedDeviceCategory',Data) -> 'enc_KmeChangedDeviceCategory'(Data); +encode_disp('KmeDeviceStateList',Data) -> 'enc_KmeDeviceStateList'(Data); +encode_disp('KmeDeviceStateEntry',Data) -> 'enc_KmeDeviceStateEntry'(Data); +encode_disp('KmeDeviceState',Data) -> 'enc_KmeDeviceState'(Data); +encode_disp('KmeGroupType',Data) -> 'enc_KmeGroupType'(Data); +encode_disp('KmePhoneProperty',Data) -> 'enc_KmePhoneProperty'(Data); +encode_disp('KmeDeviceExtNo',Data) -> 'enc_KmeDeviceExtNo'(Data); +encode_disp('KmeDeviceName',Data) -> 'enc_KmeDeviceName'(Data); +encode_disp('KmeFcoKeyInfo',Data) -> 'enc_KmeFcoKeyInfo'(Data); +encode_disp('KmeFcoKeyList',Data) -> 'enc_KmeFcoKeyList'(Data); +encode_disp('KmeExternalSensorList',Data) -> 'enc_KmeExternalSensorList'(Data); +encode_disp('KmeTenantSpeedDial',Data) -> 'enc_KmeTenantSpeedDial'(Data); +encode_disp('KmeDistributionMethod',Data) -> 'enc_KmeDistributionMethod'(Data); +encode_disp('KmePDFStart',Data) -> 'enc_KmePDFStart'(Data); +encode_disp('KmePDFStop',Data) -> 'enc_KmePDFStop'(Data); +encode_disp('KmePDFStatus',Data) -> 'enc_KmePDFStatus'(Data); +encode_disp('KmePDFSrvEvt',Data) -> 'enc_KmePDFSrvEvt'(Data); +encode_disp('KmeSvmList',Data) -> 'enc_KmeSvmList'(Data); +encode_disp('KmeExtName',Data) -> 'enc_KmeExtName'(Data); +encode_disp('NumberOfMsgPort',Data) -> 'enc_NumberOfMsgPort'(Data); +encode_disp('KmeDndOverride',Data) -> 'enc_KmeDndOverride'(Data); +encode_disp('KmeInteruptCall',Data) -> 'enc_KmeInteruptCall'(Data); +encode_disp('KmeExternalFeatureAccess',Data) -> 'enc_KmeExternalFeatureAccess'(Data); +encode_disp('KmeTempTollChange',Data) -> 'enc_KmeTempTollChange'(Data); +encode_disp('KmeDoorOpen',Data) -> 'enc_KmeDoorOpen'(Data); +encode_disp('KmeTwoWayRec',Data) -> 'enc_KmeTwoWayRec'(Data); +encode_disp('KmeCallBackInvokeReq',Data) -> 'enc_KmeCallBackInvokeReq'(Data); +encode_disp('KmeCallBackInvokeRsp',Data) -> 'enc_KmeCallBackInvokeRsp'(Data); +encode_disp('CallBackNotification',Data) -> 'enc_CallBackNotification'(Data); +encode_disp('KmeCallBackInvoke',Data) -> 'enc_KmeCallBackInvoke'(Data); +encode_disp('KmePcRec',Data) -> 'enc_KmePcRec'(Data); +encode_disp('KmeDeviceAgentStatus',Data) -> 'enc_KmeDeviceAgentStatus'(Data); +encode_disp('KmeDeviceCallStatus',Data) -> 'enc_KmeDeviceCallStatus'(Data); +encode_disp('KmeDeviceServiceStatus',Data) -> 'enc_KmeDeviceServiceStatus'(Data); +encode_disp('KmeLineStatus',Data) -> 'enc_KmeLineStatus'(Data); +encode_disp('KmeLineStatusSegment',Data) -> 'enc_KmeLineStatusSegment'(Data); +encode_disp('KmeStartDeviceMonitor',Data) -> 'enc_KmeStartDeviceMonitor'(Data); +encode_disp('KmeStopDeviceMonitor',Data) -> 'enc_KmeStopDeviceMonitor'(Data); +encode_disp('CallMonitorEvent',Data) -> 'enc_CallMonitorEvent'(Data); +encode_disp('KmeBroadcastGroupList',Data) -> 'enc_KmeBroadcastGroupList'(Data); +encode_disp('KmeBroadcastGrpMembers',Data) -> 'enc_KmeBroadcastGrpMembers'(Data); +encode_disp('KmeAlterIfSrvEvt',Data) -> 'enc_KmeAlterIfSrvEvt'(Data); +encode_disp('KmeAlterIf',Data) -> 'enc_KmeAlterIf'(Data); +encode_disp('KmeIfAltered',Data) -> 'enc_KmeIfAltered'(Data); +encode_disp('IfVersion',Data) -> 'enc_IfVersion'(Data); +encode_disp('KmeDeviceDataList',Data) -> 'enc_KmeDeviceDataList'(Data); +encode_disp('KmePdnGMembers',Data) -> 'enc_KmePdnGMembers'(Data); +encode_disp('KmeHotelSrvEvt',Data) -> 'enc_KmeHotelSrvEvt'(Data); +encode_disp('KmeCheckStatusList',Data) -> 'enc_KmeCheckStatusList'(Data); +encode_disp('KmeRoomStatus',Data) -> 'enc_KmeRoomStatus'(Data); +encode_disp('KmeCleanUpStatus',Data) -> 'enc_KmeCleanUpStatus'(Data); +encode_disp('KmeGetSystemDataReq',Data) -> 'enc_KmeGetSystemDataReq'(Data); +encode_disp('KmeGetSystemDataRsp',Data) -> 'enc_KmeGetSystemDataRsp'(Data); +encode_disp('KmeGetSystemData',Data) -> 'enc_KmeGetSystemData'(Data); +encode_disp('KmeSetSystemData',Data) -> 'enc_KmeSetSystemData'(Data); +encode_disp('KmeSystemDataChanged',Data) -> 'enc_KmeSystemDataChanged'(Data); +encode_disp('KmeSystemDataLinkedReply',Data) -> 'enc_KmeSystemDataLinkedReply'(Data); +encode_disp('KmeGetSystemDataPosAck',Data) -> 'enc_KmeGetSystemDataPosAck'(Data); +encode_disp('KmeSystemCrossRefID',Data) -> 'enc_KmeSystemCrossRefID'(Data); +encode_disp('KmeLockSystemData',Data) -> 'enc_KmeLockSystemData'(Data); +encode_disp('KmeSystemDataStatus',Data) -> 'enc_KmeSystemDataStatus'(Data); +encode_disp('KmeSystemDataRevision',Data) -> 'enc_KmeSystemDataRevision'(Data); +encode_disp('KmeGetSystemDataRevision',Data) -> 'enc_KmeGetSystemDataRevision'(Data); +encode_disp('KmeRevisionType',Data) -> 'enc_KmeRevisionType'(Data); +encode_disp('ProgrammingEventOn',Data) -> 'enc_ProgrammingEventOn'(Data); +encode_disp('KmeSetProgrammingEventOn',Data) -> 'enc_KmeSetProgrammingEventOn'(Data); +encode_disp('KmeLocalAlerm',Data) -> 'enc_KmeLocalAlerm'(Data); +encode_disp('KmeTrunkId',Data) -> 'enc_KmeTrunkId'(Data); +encode_disp('KmeOtherDevice',Data) -> 'enc_KmeOtherDevice'(Data); +encode_disp('KmeCdrConditionCode',Data) -> 'enc_KmeCdrConditionCode'(Data); +encode_disp('KmeFeatureNumber',Data) -> 'enc_KmeFeatureNumber'(Data); +encode_disp('KmeProprietaryChars',Data) -> 'enc_KmeProprietaryChars'(Data); +encode_disp('KmeHoldType',Data) -> 'enc_KmeHoldType'(Data); +encode_disp('KmeForcedAlerting',Data) -> 'enc_KmeForcedAlerting'(Data); +encode_disp('KmeDigitsReport',Data) -> 'enc_KmeDigitsReport'(Data); +encode_disp('KmeOgmStatus',Data) -> 'enc_KmeOgmStatus'(Data); +encode_disp('KmeWakeupResult',Data) -> 'enc_KmeWakeupResult'(Data); +encode_disp('KmeUnconferenced',Data) -> 'enc_KmeUnconferenced'(Data); +encode_disp('KmeTamEnded',Data) -> 'enc_KmeTamEnded'(Data); +encode_disp('KmePcRecEnded',Data) -> 'enc_KmePcRecEnded'(Data); +encode_disp('KmeSwitchChannel',Data) -> 'enc_KmeSwitchChannel'(Data); +encode_disp('KmeFreeOgmPort',Data) -> 'enc_KmeFreeOgmPort'(Data); +encode_disp('KmeCallControlSrvEvt',Data) -> 'enc_KmeCallControlSrvEvt'(Data); +encode_disp('KmeDeviceStatus',Data) -> 'enc_KmeDeviceStatus'(Data); +encode_disp('KmeDeviceMonitor',Data) -> 'enc_KmeDeviceMonitor'(Data); +encode_disp('KmeSystemData',Data) -> 'enc_KmeSystemData'(Data); +encode_disp('KmeAdditionalData',Data) -> 'enc_KmeAdditionalData'(Data); +encode_disp('KmePrivateEvent',Data) -> 'enc_KmePrivateEvent'(Data); +encode_disp('KmeResourceControl',Data) -> 'enc_KmeResourceControl'(Data); +encode_disp('KmeOgmStart',Data) -> 'enc_KmeOgmStart'(Data); +encode_disp('KmeOgmStop',Data) -> 'enc_KmeOgmStop'(Data); +encode_disp('KmeGenericSrvEvt',Data) -> 'enc_KmeGenericSrvEvt'(Data); +encode_disp('KmeGenericServiceReq',Data) -> 'enc_KmeGenericServiceReq'(Data); +encode_disp('KmeGenericServiceRsp',Data) -> 'enc_KmeGenericServiceRsp'(Data); +encode_disp('KmeGenericEvent',Data) -> 'enc_KmeGenericEvent'(Data); +encode_disp('KMESpecificPrivateData',Data) -> 'enc_KMESpecificPrivateData'(Data); encode_disp(Type,_Data) -> exit({error,{asn1,{undefined_type,Type}}}). -decode_disp('KmeDeviceLock',Data) -> 'dec_KmeDeviceLock'(Data,mandatory); -decode_disp('KmeTimeStamp',Data) -> 'dec_KmeTimeStamp'(Data,mandatory); -decode_disp('KmeSpeedDialRequest',Data) -> 'dec_KmeSpeedDialRequest'(Data,mandatory); -decode_disp('KmeSpeedDial',Data) -> 'dec_KmeSpeedDial'(Data,mandatory); -decode_disp('KmeWakeUpTime',Data) -> 'dec_KmeWakeUpTime'(Data,mandatory); -decode_disp('KmeWakeUpSchedule',Data) -> 'dec_KmeWakeUpSchedule'(Data,mandatory); -decode_disp('KmeWakeUpInfo',Data) -> 'dec_KmeWakeUpInfo'(Data,mandatory); -decode_disp('KmeWakeupState',Data) -> 'dec_KmeWakeupState'(Data,mandatory); -decode_disp('KmeAbsentMessage',Data) -> 'dec_KmeAbsentMessage'(Data,mandatory); -decode_disp('KmeDnMode',Data) -> 'dec_KmeDnMode'(Data,mandatory); -decode_disp('KmeDayNightMode',Data) -> 'dec_KmeDayNightMode'(Data,mandatory); -decode_disp('KmeOgmPlayState',Data) -> 'dec_KmeOgmPlayState'(Data,mandatory); -decode_disp('KmeForwardType',Data) -> 'dec_KmeForwardType'(Data,mandatory); -decode_disp('KmeSetForwardInfo',Data) -> 'dec_KmeSetForwardInfo'(Data,mandatory); -decode_disp('KmeFeatureList',Data) -> 'dec_KmeFeatureList'(Data,mandatory); -decode_disp('KmeExtGroupEntry',Data) -> 'dec_KmeExtGroupEntry'(Data,mandatory); -decode_disp('KmeTrkGroupEntry',Data) -> 'dec_KmeTrkGroupEntry'(Data,mandatory); -decode_disp('KmeExtMembers',Data) -> 'dec_KmeExtMembers'(Data,mandatory); -decode_disp('KmeTrkMembers',Data) -> 'dec_KmeTrkMembers'(Data,mandatory); -decode_disp('KmeExtTrkGroupList',Data) -> 'dec_KmeExtTrkGroupList'(Data,mandatory); -decode_disp('KmeGroupMembers',Data) -> 'dec_KmeGroupMembers'(Data,mandatory); -decode_disp('KmePckPagGroupList',Data) -> 'dec_KmePckPagGroupList'(Data,mandatory); -decode_disp('KmeIcmGrpMembers',Data) -> 'dec_KmeIcmGrpMembers'(Data,mandatory); -decode_disp('KmeIncomingGroupList',Data) -> 'dec_KmeIncomingGroupList'(Data,mandatory); -decode_disp('KmeDoorPhone',Data) -> 'dec_KmeDoorPhone'(Data,mandatory); -decode_disp('KmeVmGroup',Data) -> 'dec_KmeVmGroup'(Data,mandatory); -decode_disp('KmeVmDtmfType',Data) -> 'dec_KmeVmDtmfType'(Data,mandatory); -decode_disp('KmeVmGroupList',Data) -> 'dec_KmeVmGroupList'(Data,mandatory); -decode_disp('KmePsGroupList',Data) -> 'dec_KmePsGroupList'(Data,mandatory); -decode_disp('KmeChangeExtNo',Data) -> 'dec_KmeChangeExtNo'(Data,mandatory); -decode_disp('KmeChangeName',Data) -> 'dec_KmeChangeName'(Data,mandatory); -decode_disp('KmeDeviceCategory',Data) -> 'dec_KmeDeviceCategory'(Data,mandatory); -decode_disp('KmeRequestedDevice',Data) -> 'dec_KmeRequestedDevice'(Data,mandatory); -decode_disp('KmeChangedDeviceCategory',Data) -> 'dec_KmeChangedDeviceCategory'(Data,mandatory); -decode_disp('KmeDeviceStateList',Data) -> 'dec_KmeDeviceStateList'(Data,mandatory); -decode_disp('KmeDeviceStateEntry',Data) -> 'dec_KmeDeviceStateEntry'(Data,mandatory); -decode_disp('KmeDeviceState',Data) -> 'dec_KmeDeviceState'(Data,mandatory); -decode_disp('KmeGroupType',Data) -> 'dec_KmeGroupType'(Data,mandatory); -decode_disp('KmePhoneProperty',Data) -> 'dec_KmePhoneProperty'(Data,mandatory); -decode_disp('KmeDeviceExtNo',Data) -> 'dec_KmeDeviceExtNo'(Data,mandatory); -decode_disp('KmeDeviceName',Data) -> 'dec_KmeDeviceName'(Data,mandatory); -decode_disp('KmeFcoKeyInfo',Data) -> 'dec_KmeFcoKeyInfo'(Data,mandatory); -decode_disp('KmeFcoKeyList',Data) -> 'dec_KmeFcoKeyList'(Data,mandatory); -decode_disp('KmeExternalSensorList',Data) -> 'dec_KmeExternalSensorList'(Data,mandatory); -decode_disp('KmeTenantSpeedDial',Data) -> 'dec_KmeTenantSpeedDial'(Data,mandatory); -decode_disp('KmeDistributionMethod',Data) -> 'dec_KmeDistributionMethod'(Data,mandatory); -decode_disp('KmePDFStart',Data) -> 'dec_KmePDFStart'(Data,mandatory); -decode_disp('KmePDFStop',Data) -> 'dec_KmePDFStop'(Data,mandatory); -decode_disp('KmePDFStatus',Data) -> 'dec_KmePDFStatus'(Data,mandatory); -decode_disp('KmePDFSrvEvt',Data) -> 'dec_KmePDFSrvEvt'(Data,mandatory); -decode_disp('KmeSvmList',Data) -> 'dec_KmeSvmList'(Data,mandatory); -decode_disp('KmeExtName',Data) -> 'dec_KmeExtName'(Data,mandatory); -decode_disp('NumberOfMsgPort',Data) -> 'dec_NumberOfMsgPort'(Data,mandatory); -decode_disp('KmeDndOverride',Data) -> 'dec_KmeDndOverride'(Data,mandatory); -decode_disp('KmeInteruptCall',Data) -> 'dec_KmeInteruptCall'(Data,mandatory); -decode_disp('KmeExternalFeatureAccess',Data) -> 'dec_KmeExternalFeatureAccess'(Data,mandatory); -decode_disp('KmeTempTollChange',Data) -> 'dec_KmeTempTollChange'(Data,mandatory); -decode_disp('KmeDoorOpen',Data) -> 'dec_KmeDoorOpen'(Data,mandatory); -decode_disp('KmeTwoWayRec',Data) -> 'dec_KmeTwoWayRec'(Data,mandatory); -decode_disp('KmeCallBackInvokeReq',Data) -> 'dec_KmeCallBackInvokeReq'(Data,mandatory); -decode_disp('KmeCallBackInvokeRsp',Data) -> 'dec_KmeCallBackInvokeRsp'(Data,mandatory); -decode_disp('CallBackNotification',Data) -> 'dec_CallBackNotification'(Data,mandatory); -decode_disp('KmeCallBackInvoke',Data) -> 'dec_KmeCallBackInvoke'(Data,mandatory); -decode_disp('KmePcRec',Data) -> 'dec_KmePcRec'(Data,mandatory); -decode_disp('KmeDeviceAgentStatus',Data) -> 'dec_KmeDeviceAgentStatus'(Data,mandatory); -decode_disp('KmeDeviceCallStatus',Data) -> 'dec_KmeDeviceCallStatus'(Data,mandatory); -decode_disp('KmeDeviceServiceStatus',Data) -> 'dec_KmeDeviceServiceStatus'(Data,mandatory); -decode_disp('KmeLineStatus',Data) -> 'dec_KmeLineStatus'(Data,mandatory); -decode_disp('KmeLineStatusSegment',Data) -> 'dec_KmeLineStatusSegment'(Data,mandatory); -decode_disp('KmeStartDeviceMonitor',Data) -> 'dec_KmeStartDeviceMonitor'(Data,mandatory); -decode_disp('KmeStopDeviceMonitor',Data) -> 'dec_KmeStopDeviceMonitor'(Data,mandatory); -decode_disp('CallMonitorEvent',Data) -> 'dec_CallMonitorEvent'(Data,mandatory); -decode_disp('KmeBroadcastGroupList',Data) -> 'dec_KmeBroadcastGroupList'(Data,mandatory); -decode_disp('KmeBroadcastGrpMembers',Data) -> 'dec_KmeBroadcastGrpMembers'(Data,mandatory); -decode_disp('KmeAlterIfSrvEvt',Data) -> 'dec_KmeAlterIfSrvEvt'(Data,mandatory); -decode_disp('KmeAlterIf',Data) -> 'dec_KmeAlterIf'(Data,mandatory); -decode_disp('KmeIfAltered',Data) -> 'dec_KmeIfAltered'(Data,mandatory); -decode_disp('IfVersion',Data) -> 'dec_IfVersion'(Data,mandatory); -decode_disp('KmeDeviceDataList',Data) -> 'dec_KmeDeviceDataList'(Data,mandatory); -decode_disp('KmePdnGMembers',Data) -> 'dec_KmePdnGMembers'(Data,mandatory); -decode_disp('KmeHotelSrvEvt',Data) -> 'dec_KmeHotelSrvEvt'(Data,mandatory); -decode_disp('KmeCheckStatusList',Data) -> 'dec_KmeCheckStatusList'(Data,mandatory); -decode_disp('KmeRoomStatus',Data) -> 'dec_KmeRoomStatus'(Data,mandatory); -decode_disp('KmeCleanUpStatus',Data) -> 'dec_KmeCleanUpStatus'(Data,mandatory); -decode_disp('KmeGetSystemDataReq',Data) -> 'dec_KmeGetSystemDataReq'(Data,mandatory); -decode_disp('KmeGetSystemDataRsp',Data) -> 'dec_KmeGetSystemDataRsp'(Data,mandatory); -decode_disp('KmeGetSystemData',Data) -> 'dec_KmeGetSystemData'(Data,mandatory); -decode_disp('KmeSetSystemData',Data) -> 'dec_KmeSetSystemData'(Data,mandatory); -decode_disp('KmeSystemDataChanged',Data) -> 'dec_KmeSystemDataChanged'(Data,mandatory); -decode_disp('KmeSystemDataLinkedReply',Data) -> 'dec_KmeSystemDataLinkedReply'(Data,mandatory); -decode_disp('KmeGetSystemDataPosAck',Data) -> 'dec_KmeGetSystemDataPosAck'(Data,mandatory); -decode_disp('KmeSystemCrossRefID',Data) -> 'dec_KmeSystemCrossRefID'(Data,mandatory); -decode_disp('KmeLockSystemData',Data) -> 'dec_KmeLockSystemData'(Data,mandatory); -decode_disp('KmeSystemDataStatus',Data) -> 'dec_KmeSystemDataStatus'(Data,mandatory); -decode_disp('KmeSystemDataRevision',Data) -> 'dec_KmeSystemDataRevision'(Data,mandatory); -decode_disp('KmeGetSystemDataRevision',Data) -> 'dec_KmeGetSystemDataRevision'(Data,mandatory); -decode_disp('KmeRevisionType',Data) -> 'dec_KmeRevisionType'(Data,mandatory); -decode_disp('ProgrammingEventOn',Data) -> 'dec_ProgrammingEventOn'(Data,mandatory); -decode_disp('KmeSetProgrammingEventOn',Data) -> 'dec_KmeSetProgrammingEventOn'(Data,mandatory); -decode_disp('KmeLocalAlerm',Data) -> 'dec_KmeLocalAlerm'(Data,mandatory); -decode_disp('KmeTrunkId',Data) -> 'dec_KmeTrunkId'(Data,mandatory); -decode_disp('KmeOtherDevice',Data) -> 'dec_KmeOtherDevice'(Data,mandatory); -decode_disp('KmeCdrConditionCode',Data) -> 'dec_KmeCdrConditionCode'(Data,mandatory); -decode_disp('KmeFeatureNumber',Data) -> 'dec_KmeFeatureNumber'(Data,mandatory); -decode_disp('KmeProprietaryChars',Data) -> 'dec_KmeProprietaryChars'(Data,mandatory); -decode_disp('KmeHoldType',Data) -> 'dec_KmeHoldType'(Data,mandatory); -decode_disp('KmeForcedAlerting',Data) -> 'dec_KmeForcedAlerting'(Data,mandatory); -decode_disp('KmeDigitsReport',Data) -> 'dec_KmeDigitsReport'(Data,mandatory); -decode_disp('KmeOgmStatus',Data) -> 'dec_KmeOgmStatus'(Data,mandatory); -decode_disp('KmeWakeupResult',Data) -> 'dec_KmeWakeupResult'(Data,mandatory); -decode_disp('KmeUnconferenced',Data) -> 'dec_KmeUnconferenced'(Data,mandatory); -decode_disp('KmeTamEnded',Data) -> 'dec_KmeTamEnded'(Data,mandatory); -decode_disp('KmePcRecEnded',Data) -> 'dec_KmePcRecEnded'(Data,mandatory); -decode_disp('KmeSwitchChannel',Data) -> 'dec_KmeSwitchChannel'(Data,mandatory); -decode_disp('KmeFreeOgmPort',Data) -> 'dec_KmeFreeOgmPort'(Data,mandatory); -decode_disp('KmeCallControlSrvEvt',Data) -> 'dec_KmeCallControlSrvEvt'(Data,mandatory); -decode_disp('KmeDeviceStatus',Data) -> 'dec_KmeDeviceStatus'(Data,mandatory); -decode_disp('KmeDeviceMonitor',Data) -> 'dec_KmeDeviceMonitor'(Data,mandatory); -decode_disp('KmeSystemData',Data) -> 'dec_KmeSystemData'(Data,mandatory); -decode_disp('KmeAdditionalData',Data) -> 'dec_KmeAdditionalData'(Data,mandatory); -decode_disp('KmePrivateEvent',Data) -> 'dec_KmePrivateEvent'(Data,mandatory); -decode_disp('KmeResourceControl',Data) -> 'dec_KmeResourceControl'(Data,mandatory); -decode_disp('KmeOgmStart',Data) -> 'dec_KmeOgmStart'(Data,mandatory); -decode_disp('KmeOgmStop',Data) -> 'dec_KmeOgmStop'(Data,mandatory); -decode_disp('KmeGenericSrvEvt',Data) -> 'dec_KmeGenericSrvEvt'(Data,mandatory); -decode_disp('KmeGenericServiceReq',Data) -> 'dec_KmeGenericServiceReq'(Data,mandatory); -decode_disp('KmeGenericServiceRsp',Data) -> 'dec_KmeGenericServiceRsp'(Data,mandatory); -decode_disp('KmeGenericEvent',Data) -> 'dec_KmeGenericEvent'(Data,mandatory); -decode_disp('KMESpecificPrivateData',Data) -> 'dec_KMESpecificPrivateData'(Data,mandatory); +decode_disp('KmeDeviceLock',Data) -> 'dec_KmeDeviceLock'(Data); +decode_disp('KmeTimeStamp',Data) -> 'dec_KmeTimeStamp'(Data); +decode_disp('KmeSpeedDialRequest',Data) -> 'dec_KmeSpeedDialRequest'(Data); +decode_disp('KmeSpeedDial',Data) -> 'dec_KmeSpeedDial'(Data); +decode_disp('KmeWakeUpTime',Data) -> 'dec_KmeWakeUpTime'(Data); +decode_disp('KmeWakeUpSchedule',Data) -> 'dec_KmeWakeUpSchedule'(Data); +decode_disp('KmeWakeUpInfo',Data) -> 'dec_KmeWakeUpInfo'(Data); +decode_disp('KmeWakeupState',Data) -> 'dec_KmeWakeupState'(Data); +decode_disp('KmeAbsentMessage',Data) -> 'dec_KmeAbsentMessage'(Data); +decode_disp('KmeDnMode',Data) -> 'dec_KmeDnMode'(Data); +decode_disp('KmeDayNightMode',Data) -> 'dec_KmeDayNightMode'(Data); +decode_disp('KmeOgmPlayState',Data) -> 'dec_KmeOgmPlayState'(Data); +decode_disp('KmeForwardType',Data) -> 'dec_KmeForwardType'(Data); +decode_disp('KmeSetForwardInfo',Data) -> 'dec_KmeSetForwardInfo'(Data); +decode_disp('KmeFeatureList',Data) -> 'dec_KmeFeatureList'(Data); +decode_disp('KmeExtGroupEntry',Data) -> 'dec_KmeExtGroupEntry'(Data); +decode_disp('KmeTrkGroupEntry',Data) -> 'dec_KmeTrkGroupEntry'(Data); +decode_disp('KmeExtMembers',Data) -> 'dec_KmeExtMembers'(Data); +decode_disp('KmeTrkMembers',Data) -> 'dec_KmeTrkMembers'(Data); +decode_disp('KmeExtTrkGroupList',Data) -> 'dec_KmeExtTrkGroupList'(Data); +decode_disp('KmeGroupMembers',Data) -> 'dec_KmeGroupMembers'(Data); +decode_disp('KmePckPagGroupList',Data) -> 'dec_KmePckPagGroupList'(Data); +decode_disp('KmeIcmGrpMembers',Data) -> 'dec_KmeIcmGrpMembers'(Data); +decode_disp('KmeIncomingGroupList',Data) -> 'dec_KmeIncomingGroupList'(Data); +decode_disp('KmeDoorPhone',Data) -> 'dec_KmeDoorPhone'(Data); +decode_disp('KmeVmGroup',Data) -> 'dec_KmeVmGroup'(Data); +decode_disp('KmeVmDtmfType',Data) -> 'dec_KmeVmDtmfType'(Data); +decode_disp('KmeVmGroupList',Data) -> 'dec_KmeVmGroupList'(Data); +decode_disp('KmePsGroupList',Data) -> 'dec_KmePsGroupList'(Data); +decode_disp('KmeChangeExtNo',Data) -> 'dec_KmeChangeExtNo'(Data); +decode_disp('KmeChangeName',Data) -> 'dec_KmeChangeName'(Data); +decode_disp('KmeDeviceCategory',Data) -> 'dec_KmeDeviceCategory'(Data); +decode_disp('KmeRequestedDevice',Data) -> 'dec_KmeRequestedDevice'(Data); +decode_disp('KmeChangedDeviceCategory',Data) -> 'dec_KmeChangedDeviceCategory'(Data); +decode_disp('KmeDeviceStateList',Data) -> 'dec_KmeDeviceStateList'(Data); +decode_disp('KmeDeviceStateEntry',Data) -> 'dec_KmeDeviceStateEntry'(Data); +decode_disp('KmeDeviceState',Data) -> 'dec_KmeDeviceState'(Data); +decode_disp('KmeGroupType',Data) -> 'dec_KmeGroupType'(Data); +decode_disp('KmePhoneProperty',Data) -> 'dec_KmePhoneProperty'(Data); +decode_disp('KmeDeviceExtNo',Data) -> 'dec_KmeDeviceExtNo'(Data); +decode_disp('KmeDeviceName',Data) -> 'dec_KmeDeviceName'(Data); +decode_disp('KmeFcoKeyInfo',Data) -> 'dec_KmeFcoKeyInfo'(Data); +decode_disp('KmeFcoKeyList',Data) -> 'dec_KmeFcoKeyList'(Data); +decode_disp('KmeExternalSensorList',Data) -> 'dec_KmeExternalSensorList'(Data); +decode_disp('KmeTenantSpeedDial',Data) -> 'dec_KmeTenantSpeedDial'(Data); +decode_disp('KmeDistributionMethod',Data) -> 'dec_KmeDistributionMethod'(Data); +decode_disp('KmePDFStart',Data) -> 'dec_KmePDFStart'(Data); +decode_disp('KmePDFStop',Data) -> 'dec_KmePDFStop'(Data); +decode_disp('KmePDFStatus',Data) -> 'dec_KmePDFStatus'(Data); +decode_disp('KmePDFSrvEvt',Data) -> 'dec_KmePDFSrvEvt'(Data); +decode_disp('KmeSvmList',Data) -> 'dec_KmeSvmList'(Data); +decode_disp('KmeExtName',Data) -> 'dec_KmeExtName'(Data); +decode_disp('NumberOfMsgPort',Data) -> 'dec_NumberOfMsgPort'(Data); +decode_disp('KmeDndOverride',Data) -> 'dec_KmeDndOverride'(Data); +decode_disp('KmeInteruptCall',Data) -> 'dec_KmeInteruptCall'(Data); +decode_disp('KmeExternalFeatureAccess',Data) -> 'dec_KmeExternalFeatureAccess'(Data); +decode_disp('KmeTempTollChange',Data) -> 'dec_KmeTempTollChange'(Data); +decode_disp('KmeDoorOpen',Data) -> 'dec_KmeDoorOpen'(Data); +decode_disp('KmeTwoWayRec',Data) -> 'dec_KmeTwoWayRec'(Data); +decode_disp('KmeCallBackInvokeReq',Data) -> 'dec_KmeCallBackInvokeReq'(Data); +decode_disp('KmeCallBackInvokeRsp',Data) -> 'dec_KmeCallBackInvokeRsp'(Data); +decode_disp('CallBackNotification',Data) -> 'dec_CallBackNotification'(Data); +decode_disp('KmeCallBackInvoke',Data) -> 'dec_KmeCallBackInvoke'(Data); +decode_disp('KmePcRec',Data) -> 'dec_KmePcRec'(Data); +decode_disp('KmeDeviceAgentStatus',Data) -> 'dec_KmeDeviceAgentStatus'(Data); +decode_disp('KmeDeviceCallStatus',Data) -> 'dec_KmeDeviceCallStatus'(Data); +decode_disp('KmeDeviceServiceStatus',Data) -> 'dec_KmeDeviceServiceStatus'(Data); +decode_disp('KmeLineStatus',Data) -> 'dec_KmeLineStatus'(Data); +decode_disp('KmeLineStatusSegment',Data) -> 'dec_KmeLineStatusSegment'(Data); +decode_disp('KmeStartDeviceMonitor',Data) -> 'dec_KmeStartDeviceMonitor'(Data); +decode_disp('KmeStopDeviceMonitor',Data) -> 'dec_KmeStopDeviceMonitor'(Data); +decode_disp('CallMonitorEvent',Data) -> 'dec_CallMonitorEvent'(Data); +decode_disp('KmeBroadcastGroupList',Data) -> 'dec_KmeBroadcastGroupList'(Data); +decode_disp('KmeBroadcastGrpMembers',Data) -> 'dec_KmeBroadcastGrpMembers'(Data); +decode_disp('KmeAlterIfSrvEvt',Data) -> 'dec_KmeAlterIfSrvEvt'(Data); +decode_disp('KmeAlterIf',Data) -> 'dec_KmeAlterIf'(Data); +decode_disp('KmeIfAltered',Data) -> 'dec_KmeIfAltered'(Data); +decode_disp('IfVersion',Data) -> 'dec_IfVersion'(Data); +decode_disp('KmeDeviceDataList',Data) -> 'dec_KmeDeviceDataList'(Data); +decode_disp('KmePdnGMembers',Data) -> 'dec_KmePdnGMembers'(Data); +decode_disp('KmeHotelSrvEvt',Data) -> 'dec_KmeHotelSrvEvt'(Data); +decode_disp('KmeCheckStatusList',Data) -> 'dec_KmeCheckStatusList'(Data); +decode_disp('KmeRoomStatus',Data) -> 'dec_KmeRoomStatus'(Data); +decode_disp('KmeCleanUpStatus',Data) -> 'dec_KmeCleanUpStatus'(Data); +decode_disp('KmeGetSystemDataReq',Data) -> 'dec_KmeGetSystemDataReq'(Data); +decode_disp('KmeGetSystemDataRsp',Data) -> 'dec_KmeGetSystemDataRsp'(Data); +decode_disp('KmeGetSystemData',Data) -> 'dec_KmeGetSystemData'(Data); +decode_disp('KmeSetSystemData',Data) -> 'dec_KmeSetSystemData'(Data); +decode_disp('KmeSystemDataChanged',Data) -> 'dec_KmeSystemDataChanged'(Data); +decode_disp('KmeSystemDataLinkedReply',Data) -> 'dec_KmeSystemDataLinkedReply'(Data); +decode_disp('KmeGetSystemDataPosAck',Data) -> 'dec_KmeGetSystemDataPosAck'(Data); +decode_disp('KmeSystemCrossRefID',Data) -> 'dec_KmeSystemCrossRefID'(Data); +decode_disp('KmeLockSystemData',Data) -> 'dec_KmeLockSystemData'(Data); +decode_disp('KmeSystemDataStatus',Data) -> 'dec_KmeSystemDataStatus'(Data); +decode_disp('KmeSystemDataRevision',Data) -> 'dec_KmeSystemDataRevision'(Data); +decode_disp('KmeGetSystemDataRevision',Data) -> 'dec_KmeGetSystemDataRevision'(Data); +decode_disp('KmeRevisionType',Data) -> 'dec_KmeRevisionType'(Data); +decode_disp('ProgrammingEventOn',Data) -> 'dec_ProgrammingEventOn'(Data); +decode_disp('KmeSetProgrammingEventOn',Data) -> 'dec_KmeSetProgrammingEventOn'(Data); +decode_disp('KmeLocalAlerm',Data) -> 'dec_KmeLocalAlerm'(Data); +decode_disp('KmeTrunkId',Data) -> 'dec_KmeTrunkId'(Data); +decode_disp('KmeOtherDevice',Data) -> 'dec_KmeOtherDevice'(Data); +decode_disp('KmeCdrConditionCode',Data) -> 'dec_KmeCdrConditionCode'(Data); +decode_disp('KmeFeatureNumber',Data) -> 'dec_KmeFeatureNumber'(Data); +decode_disp('KmeProprietaryChars',Data) -> 'dec_KmeProprietaryChars'(Data); +decode_disp('KmeHoldType',Data) -> 'dec_KmeHoldType'(Data); +decode_disp('KmeForcedAlerting',Data) -> 'dec_KmeForcedAlerting'(Data); +decode_disp('KmeDigitsReport',Data) -> 'dec_KmeDigitsReport'(Data); +decode_disp('KmeOgmStatus',Data) -> 'dec_KmeOgmStatus'(Data); +decode_disp('KmeWakeupResult',Data) -> 'dec_KmeWakeupResult'(Data); +decode_disp('KmeUnconferenced',Data) -> 'dec_KmeUnconferenced'(Data); +decode_disp('KmeTamEnded',Data) -> 'dec_KmeTamEnded'(Data); +decode_disp('KmePcRecEnded',Data) -> 'dec_KmePcRecEnded'(Data); +decode_disp('KmeSwitchChannel',Data) -> 'dec_KmeSwitchChannel'(Data); +decode_disp('KmeFreeOgmPort',Data) -> 'dec_KmeFreeOgmPort'(Data); +decode_disp('KmeCallControlSrvEvt',Data) -> 'dec_KmeCallControlSrvEvt'(Data); +decode_disp('KmeDeviceStatus',Data) -> 'dec_KmeDeviceStatus'(Data); +decode_disp('KmeDeviceMonitor',Data) -> 'dec_KmeDeviceMonitor'(Data); +decode_disp('KmeSystemData',Data) -> 'dec_KmeSystemData'(Data); +decode_disp('KmeAdditionalData',Data) -> 'dec_KmeAdditionalData'(Data); +decode_disp('KmePrivateEvent',Data) -> 'dec_KmePrivateEvent'(Data); +decode_disp('KmeResourceControl',Data) -> 'dec_KmeResourceControl'(Data); +decode_disp('KmeOgmStart',Data) -> 'dec_KmeOgmStart'(Data); +decode_disp('KmeOgmStop',Data) -> 'dec_KmeOgmStop'(Data); +decode_disp('KmeGenericSrvEvt',Data) -> 'dec_KmeGenericSrvEvt'(Data); +decode_disp('KmeGenericServiceReq',Data) -> 'dec_KmeGenericServiceReq'(Data); +decode_disp('KmeGenericServiceRsp',Data) -> 'dec_KmeGenericServiceRsp'(Data); +decode_disp('KmeGenericEvent',Data) -> 'dec_KmeGenericEvent'(Data); +decode_disp('KMESpecificPrivateData',Data) -> 'dec_KMESpecificPrivateData'(Data); decode_disp(Type,_Data) -> exit({error,{asn1,{undefined_type,Type}}}). -wrap_encode(Bytes) when is_list(Bytes) -> - binary_to_list(list_to_binary(Bytes)); -wrap_encode(Bytes) when is_binary(Bytes) -> - binary_to_list(Bytes); -wrap_encode(Bytes) -> Bytes. - -wrap_decode(Bytes) when is_list(Bytes) -> - list_to_binary(Bytes); -wrap_decode(Bytes) -> Bytes. - info() -> - case ?MODULE:module_info() of - MI when is_list(MI) -> - case lists:keysearch(attributes,1,MI) of - {value,{_,Attributes}} when is_list(Attributes) -> - case lists:keysearch(asn1_info,1,Attributes) of - {value,{_,Info}} when is_list(Info) -> - Info; - _ -> - [] - end; - _ -> - [] - end + case ?MODULE:module_info(attributes) of + Attributes when is_list(Attributes) -> + case lists:keyfind(asn1_info, 1, Attributes) of + {_,Info} when is_list(Info) -> + Info; + _ -> + [] + end; + _ -> + [] end. %%================================ %% KmeDeviceLock %%================================ - -'enc_KmeDeviceLock'({'KmeDeviceLock',Val}, TagIn) -> - 'enc_KmeDeviceLock'(Val, TagIn); +'enc_KmeDeviceLock'(Val) -> + 'enc_KmeDeviceLock'(Val, [<<10>>]). 'enc_KmeDeviceLock'(Val, TagIn) -> -case (case Val of {_,Enumval1}->Enumval1;_->Val end) of -lock -> ?RT_BER:encode_enumerated(0,TagIn ++ []); -unlock -> ?RT_BER:encode_enumerated(1,TagIn ++ []); -Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) +case Val of +lock -> encode_tags(TagIn, [0], 1); +unlock -> encode_tags(TagIn, [1], 1); +Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}}) end. -'dec_KmeDeviceLock'(Bytes, OptOrMand) -> - 'dec_KmeDeviceLock'(Bytes, OptOrMand, []). +'dec_KmeDeviceLock'(Tlv) -> + 'dec_KmeDeviceLock'(Tlv, [10]). -'dec_KmeDeviceLock'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_enumerated(Bytes,[],[{lock,0},{unlock,1}],TagIn++[], OptOrMand). +'dec_KmeDeviceLock'(Tlv, TagIn) -> +case decode_integer(Tlv, TagIn) of +0 -> lock; +1 -> unlock; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end. %%================================ %% KmeTimeStamp %%================================ - -'enc_KmeTimeStamp'({'KmeTimeStamp',Val}, TagIn) -> - 'enc_KmeTimeStamp'(Val, TagIn); +'enc_KmeTimeStamp'(Val) -> + 'enc_KmeTimeStamp'(Val, [<<24>>]). 'enc_KmeTimeStamp'(Val, TagIn) -> -?RT_BER:encode_generalized_time([], Val, TagIn ++ []). +encode_restricted_string(Val, TagIn). -'dec_KmeTimeStamp'(Bytes, OptOrMand) -> - 'dec_KmeTimeStamp'(Bytes, OptOrMand, []). +'dec_KmeTimeStamp'(Tlv) -> + 'dec_KmeTimeStamp'(Tlv, [24]). -'dec_KmeTimeStamp'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_generalized_time(Bytes,[],TagIn++[], no_length, OptOrMand). +'dec_KmeTimeStamp'(Tlv, TagIn) -> +begin +binary_to_list(decode_restricted_string(Tlv, TagIn)) +end +. %%================================ %% KmeSpeedDialRequest %%================================ +'enc_KmeSpeedDialRequest'(Val) -> + 'enc_KmeSpeedDialRequest'(Val, [<<48>>]). + 'enc_KmeSpeedDialRequest'(Val, TagIn) -> +{_,Cindex1, Cindex2, Cindex3} = Val, %%------------------------------------------------- -%% attribute number 1 with type INTEGER +%% attribute startSerialNo(1) with type INTEGER %%------------------------------------------------- - {EncBytes1,EncLen1} = ?RT_BER:encode_integer([], ?RT_BER:cindex(2,Val,startSerialNo), []), + {EncBytes1,EncLen1} = encode_integer(Cindex1, [<<2>>]), %%------------------------------------------------- -%% attribute number 2 with type INTEGER +%% attribute number(2) with type INTEGER %%------------------------------------------------- - {EncBytes2,EncLen2} = ?RT_BER:encode_integer([], ?RT_BER:cindex(3,Val,number), []), + {EncBytes2,EncLen2} = encode_integer(Cindex2, [<<2>>]), %%------------------------------------------------- -%% attribute number 3 with type INTEGER OPTIONAL +%% attribute tenantNo(3) with type INTEGER OPTIONAL %%------------------------------------------------- - {EncBytes3,EncLen3} = case ?RT_BER:cindex(4,Val,tenantNo) of + {EncBytes3,EncLen3} = case Cindex3 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_integer([], ?RT_BER:cindex(4,Val,tenantNo), [{tag,128,0,'EXPLICIT',32}]) + encode_integer(Cindex3, [<<2>>,<<160>>]) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3], - LenSoFar = EncLen1 + EncLen2 + EncLen3, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2 + EncLen3, +encode_tags(TagIn, BytesSoFar, LenSoFar). -'dec_KmeSpeedDialRequest'(Bytes, OptOrMand) -> - 'dec_KmeSpeedDialRequest'(Bytes, OptOrMand, []). +'dec_KmeSpeedDialRequest'(Tlv) -> + 'dec_KmeSpeedDialRequest'(Tlv, [16]). -'dec_KmeSpeedDialRequest'(Bytes, OptOrMand, TagIn) -> +'dec_KmeSpeedDialRequest'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 with type INTEGER +%% attribute startSerialNo(1) with type INTEGER %%------------------------------------------------- - {Term1,Bytes3,Rb2} = ?RT_BER:decode_integer(Bytes2,{0,999},[], mandatory), +[V1|Tlv2] = Tlv1, +Term1 = begin +Val1 = decode_integer(V1, [2]), +if 0 =< Val1, Val1 =< 999 -> +Val1; +true -> +exit({error,{asn1,bad_range}}) +end +end, %%------------------------------------------------- -%% attribute number 2 with type INTEGER +%% attribute number(2) with type INTEGER %%------------------------------------------------- - {Term2,Bytes4,Rb3} = ?RT_BER:decode_integer(Bytes3,{1,1000},[], mandatory), +[V2|Tlv3] = Tlv2, +Term2 = begin +Val2 = decode_integer(V2, [2]), +if 1 =< Val2, Val2 =< 1000 -> +Val2; +true -> +exit({error,{asn1,bad_range}}) +end +end, %%------------------------------------------------- -%% attribute number 3 with type INTEGER OPTIONAL +%% attribute tenantNo(3) with type INTEGER OPTIONAL %%------------------------------------------------- - {Term3,Bytes5,Rb4} = case Bytes4 of -<<2:2,_:1,0:5,_/binary>> -> -?RT_BER:decode_integer(Bytes4,[],[{tag,128,0,'EXPLICIT',32}], mandatory); -_ -> -{ asn1_NOVALUE, Bytes4, 0 } +{Term3,Tlv4} = case Tlv3 of +[{131072,V3}|TempTlv4] -> + {decode_integer(V3, [2]), TempTlv4}; + _ -> + { asn1_NOVALUE, Tlv3} +end, + +case Tlv4 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowed end, + {'KmeSpeedDialRequest', Term1, Term2, Term3}. - {Bytes6,Rb5} = ?RT_BER:restbytes2(RemBytes, Bytes5,noext), - {{'KmeSpeedDialRequest', Term1, Term2, Term3}, Bytes6, Rb1+Rb2+Rb3+Rb4+Rb5}. %%================================ %% KmeSpeedDial %%================================ - -'enc_KmeSpeedDial'({'KmeSpeedDial',Val}, TagIn) -> - 'enc_KmeSpeedDial'(Val, TagIn); +'enc_KmeSpeedDial'(Val) -> + 'enc_KmeSpeedDial'(Val, [<<48>>]). 'enc_KmeSpeedDial'(Val, TagIn) -> {EncBytes,EncLen} = 'enc_KmeSpeedDial_components'(Val,[],0), - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], EncBytes, EncLen). + encode_tags(TagIn, EncBytes, EncLen). 'enc_KmeSpeedDial_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_KmeSpeedDial_components'([H|T],AccBytes, AccLen) -> - {EncBytes,EncLen} = 'enc_KmeSpeedDial_SEQOF'(H, []), + {EncBytes,EncLen} = 'enc_KmeSpeedDial_SEQOF'(H, [<<48>>]), 'enc_KmeSpeedDial_components'(T,[EncBytes|AccBytes], AccLen + EncLen). @@ -860,368 +757,449 @@ end, %% KmeSpeedDial_SEQOF %%================================ 'enc_KmeSpeedDial_SEQOF'(Val, TagIn) -> - + {_,Cindex1, Cindex2, Cindex3} = Val, + %%------------------------------------------------- -%% attribute number 1 with type INTEGER +%% attribute serialNumber(1) with type INTEGER %%------------------------------------------------- - {EncBytes1,EncLen1} = ?RT_BER:encode_integer([], ?RT_BER:cindex(2,Val,serialNumber), [{tag,128,0,'EXPLICIT',32}]), + {EncBytes1,EncLen1} = encode_integer(Cindex1, [<<2>>,<<160>>]), %%------------------------------------------------- -%% attribute number 2 with type IA5String OPTIONAL +%% attribute registeredDigits(2) with type IA5String OPTIONAL %%------------------------------------------------- - {EncBytes2,EncLen2} = case ?RT_BER:cindex(3,Val,registeredDigits) of + {EncBytes2,EncLen2} = case Cindex2 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_restricted_string([], ?RT_BER:cindex(3,Val,registeredDigits), 22, [{tag,128,1,'EXPLICIT',32}]) + encode_restricted_string(Cindex2, [<<22>>,<<161>>]) end, %%------------------------------------------------- -%% attribute number 3 with type CHOICE OPTIONAL +%% attribute callerName(3) with type CHOICE OPTIONAL %%------------------------------------------------- - {EncBytes3,EncLen3} = case ?RT_BER:cindex(4,Val,callerName) of + {EncBytes3,EncLen3} = case Cindex3 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_KmeSpeedDial_SEQOF_callerName'(?RT_BER:cindex(4,Val,callerName), [{tag,128,2,'EXPLICIT',32}]) + 'enc_KmeSpeedDial_SEQOF_callerName'(Cindex3, [<<162>>]) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3], - LenSoFar = EncLen1 + EncLen2 + EncLen3, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2 + EncLen3, +encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% KmeSpeedDial_SEQOF_callerName %%================================ - -'enc_KmeSpeedDial_SEQOF_callerName'({'KmeSpeedDial_SEQOF_callerName',Val}, TagIn) -> - 'enc_KmeSpeedDial_SEQOF_callerName'(Val, TagIn); - 'enc_KmeSpeedDial_SEQOF_callerName'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of single -> - ?RT_BER:encode_octet_string([], element(2,Val), [{tag,128,0,'EXPLICIT',32}]); + encode_restricted_string(element(2,Val), [<<4>>,<<160>>]); wide -> - ?RT_BER:encode_octet_string([], element(2,Val), [{tag,128,1,'EXPLICIT',32}]); + encode_restricted_string(element(2,Val), [<<4>>,<<161>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). +encode_tags(TagIn, EncBytes, EncLen). -'dec_KmeSpeedDial_SEQOF_callerName'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of -%% 'single' - <<2:2,_:1,0:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_octet_string(Bytes1,{1,20},[{tag,128,0,'EXPLICIT',32}], no_length, mandatory), - {{single, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; +'dec_KmeSpeedDial'(Tlv) -> + 'dec_KmeSpeedDial'(Tlv, [16]). -%% 'wide' - <<2:2,_:1,1:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_octet_string(Bytes1,{1,40},[{tag,128,1,'EXPLICIT',32}], no_length, mandatory), - {{wide, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; +'dec_KmeSpeedDial'(Tlv, TagIn) -> + %%------------------------------------------------- + %% decode tag and length + %%------------------------------------------------- +Tlv1 = match_tags(Tlv, TagIn), +['dec_KmeSpeedDial_SEQOF'(V1, [16]) || V1 <- Tlv1]. - Else -> - case OptOrMand of - mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}}); - _ ->exit({error,{asn1,{no_optional_tag,Else}}}) - end - end. -'dec_KmeSpeedDial_SEQOF'(Bytes, OptOrMand, TagIn) -> + +'dec_KmeSpeedDial_SEQOF'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 with type INTEGER +%% attribute serialNumber(1) with type INTEGER %%------------------------------------------------- - {Term1,Bytes3,Rb2} = ?RT_BER:decode_integer(Bytes2,{0,999},[{tag,128,0,'EXPLICIT',32}], mandatory), +[V1|Tlv2] = Tlv1, +Term1 = begin +Val1 = decode_integer(V1, [131072,2]), +if 0 =< Val1, Val1 =< 999 -> +Val1; +true -> +exit({error,{asn1,bad_range}}) +end +end, %%------------------------------------------------- -%% attribute number 2 with type IA5String OPTIONAL +%% attribute registeredDigits(2) with type IA5String OPTIONAL %%------------------------------------------------- - {Term2,Bytes4,Rb3} = case Bytes3 of -<<2:2,_:1,1:5,_/binary>> -> -?RT_BER:decode_restricted_string(Bytes3,{1,32},22,[{tag,128,1,'EXPLICIT',32}], no_length, mandatory); -_ -> -{ asn1_NOVALUE, Bytes3, 0 } +{Term2,Tlv3} = case Tlv2 of +[{131073,V2}|TempTlv3] -> + {begin +Val2 = decode_restricted_string(V2, [22]), +C1 = byte_size(Val2), +if 1 =< C1, C1 =< 32 -> +binary_to_list(Val2); +true -> +exit({error,{asn1,bad_range}}) +end +end, TempTlv3}; + _ -> + { asn1_NOVALUE, Tlv2} end, %%------------------------------------------------- -%% attribute number 3 with type CHOICE OPTIONAL +%% attribute callerName(3) with type CHOICE OPTIONAL %%------------------------------------------------- - {Term3,Bytes5,Rb4} = case Bytes4 of -<<2:2,_:1,2:5,_/binary>> -> -'dec_KmeSpeedDial_SEQOF_callerName'(Bytes4, opt_or_default, [{tag,128,2,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes4, 0 } +{Term3,Tlv4} = case Tlv3 of +[{131074,V3}|TempTlv4] -> + {'dec_KmeSpeedDial_SEQOF_callerName'(V3, []), TempTlv4}; + _ -> + { asn1_NOVALUE, Tlv3} end, - {Bytes6,Rb5} = ?RT_BER:restbytes2(RemBytes, Bytes5,noext), - {{'KmeSpeedDial_SEQOF', Term1, Term2, Term3}, Bytes6, Rb1+Rb2+Rb3+Rb4+Rb5}. +case Tlv4 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowed +end, + {'KmeSpeedDial_SEQOF', Term1, Term2, Term3}. +'dec_KmeSpeedDial_SEQOF_callerName'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of -'dec_KmeSpeedDial'(Bytes, OptOrMand) -> - 'dec_KmeSpeedDial'(Bytes, OptOrMand, []). +%% 'single' + {131072, V1} -> + {single, begin +Val1 = decode_octet_string(V1, [4]), +C1 = byte_size(Val1), +if 1 =< C1, C1 =< 20 -> +Val1; +true -> +exit({error,{asn1,bad_range}}) +end +end}; -'dec_KmeSpeedDial'(Bytes, OptOrMand, TagIn) -> - %%------------------------------------------------- - %% decode tag and length - %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), - ?RT_BER:decode_components(Rb1, Len, Bytes1, fun 'dec_KmeSpeedDial_SEQOF'/3, [], []). +%% 'wide' + {131073, V1} -> + {wide, begin +Val2 = decode_octet_string(V1, [4]), +C2 = byte_size(Val2), +if 1 =< C2, C2 =< 40 -> +Val2; +true -> +exit({error,{asn1,bad_range}}) +end +end}; + Else -> + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. %%================================ %% KmeWakeUpTime %%================================ +'enc_KmeWakeUpTime'(Val) -> + 'enc_KmeWakeUpTime'(Val, [<<48>>]). + 'enc_KmeWakeUpTime'(Val, TagIn) -> +{_,Cindex1, Cindex2} = Val, %%------------------------------------------------- -%% attribute number 1 with type IA5String +%% attribute hour(1) with type IA5String %%------------------------------------------------- - {EncBytes1,EncLen1} = ?RT_BER:encode_restricted_string([], ?RT_BER:cindex(2,Val,hour), 22, [{tag,128,0,'EXPLICIT',32}]), + {EncBytes1,EncLen1} = encode_restricted_string(Cindex1, [<<22>>,<<160>>]), %%------------------------------------------------- -%% attribute number 2 with type IA5String +%% attribute minute(2) with type IA5String %%------------------------------------------------- - {EncBytes2,EncLen2} = ?RT_BER:encode_restricted_string([], ?RT_BER:cindex(3,Val,minute), 22, [{tag,128,1,'EXPLICIT',32}]), + {EncBytes2,EncLen2} = encode_restricted_string(Cindex2, [<<22>>,<<161>>]), BytesSoFar = [EncBytes1, EncBytes2], - LenSoFar = EncLen1 + EncLen2, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2, +encode_tags(TagIn, BytesSoFar, LenSoFar). -'dec_KmeWakeUpTime'(Bytes, OptOrMand) -> - 'dec_KmeWakeUpTime'(Bytes, OptOrMand, []). +'dec_KmeWakeUpTime'(Tlv) -> + 'dec_KmeWakeUpTime'(Tlv, [16]). -'dec_KmeWakeUpTime'(Bytes, OptOrMand, TagIn) -> +'dec_KmeWakeUpTime'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 with type IA5String +%% attribute hour(1) with type IA5String %%------------------------------------------------- - {Term1,Bytes3,Rb2} = ?RT_BER:decode_restricted_string(Bytes2,2,22,[{tag,128,0,'EXPLICIT',32}], no_length, mandatory), +[V1|Tlv2] = Tlv1, +Term1 = begin +Val1 = decode_restricted_string(V1, [131072,22]), +C1 = byte_size(Val1), +if C1 =:= 2 -> +binary_to_list(Val1); +true -> +exit({error,{asn1,bad_range}}) +end +end, %%------------------------------------------------- -%% attribute number 2 with type IA5String +%% attribute minute(2) with type IA5String %%------------------------------------------------- - {Term2,Bytes4,Rb3} = ?RT_BER:decode_restricted_string(Bytes3,2,22,[{tag,128,1,'EXPLICIT',32}], no_length, mandatory), +[V2|Tlv3] = Tlv2, +Term2 = begin +Val2 = decode_restricted_string(V2, [131073,22]), +C2 = byte_size(Val2), +if C2 =:= 2 -> +binary_to_list(Val2); +true -> +exit({error,{asn1,bad_range}}) +end +end, + +case Tlv3 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed +end, + {'KmeWakeUpTime', Term1, Term2}. - {Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext), - {{'KmeWakeUpTime', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}. %%================================ %% KmeWakeUpSchedule %%================================ - -'enc_KmeWakeUpSchedule'({'KmeWakeUpSchedule',Val}, TagIn) -> - 'enc_KmeWakeUpSchedule'(Val, TagIn); +'enc_KmeWakeUpSchedule'(Val) -> + 'enc_KmeWakeUpSchedule'(Val, [<<10>>]). 'enc_KmeWakeUpSchedule'(Val, TagIn) -> -case (case Val of {_,Enumval1}->Enumval1;_->Val end) of -noSchedule -> ?RT_BER:encode_enumerated(0,TagIn ++ []); -once -> ?RT_BER:encode_enumerated(1,TagIn ++ []); -everyday -> ?RT_BER:encode_enumerated(2,TagIn ++ []); -Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) +case Val of +noSchedule -> encode_tags(TagIn, [0], 1); +once -> encode_tags(TagIn, [1], 1); +everyday -> encode_tags(TagIn, [2], 1); +Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}}) end. -'dec_KmeWakeUpSchedule'(Bytes, OptOrMand) -> - 'dec_KmeWakeUpSchedule'(Bytes, OptOrMand, []). +'dec_KmeWakeUpSchedule'(Tlv) -> + 'dec_KmeWakeUpSchedule'(Tlv, [10]). -'dec_KmeWakeUpSchedule'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_enumerated(Bytes,[],[{noSchedule,0},{once,1},{everyday,2}],TagIn++[], OptOrMand). +'dec_KmeWakeUpSchedule'(Tlv, TagIn) -> +case decode_integer(Tlv, TagIn) of +0 -> noSchedule; +1 -> once; +2 -> everyday; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end. %%================================ %% KmeWakeUpInfo %%================================ +'enc_KmeWakeUpInfo'(Val) -> + 'enc_KmeWakeUpInfo'(Val, [<<48>>]). + 'enc_KmeWakeUpInfo'(Val, TagIn) -> +{_,Cindex1, Cindex2} = Val, %%------------------------------------------------- -%% attribute number 1 External KME-specific-types:KmeWakeUpTime OPTIONAL +%% attribute time(1) External KME-specific-types:KmeWakeUpTime OPTIONAL %%------------------------------------------------- - {EncBytes1,EncLen1} = case ?RT_BER:cindex(2,Val,time) of + {EncBytes1,EncLen1} = case Cindex1 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_KmeWakeUpTime'(?RT_BER:cindex(2,Val,time), [{tag,128,0,'EXPLICIT',32}]) + 'enc_KmeWakeUpTime'(Cindex1, [<<48>>,<<160>>]) end, %%------------------------------------------------- -%% attribute number 2 with type ENUMERATED +%% attribute schedule(2) with type ENUMERATED %%------------------------------------------------- - {EncBytes2,EncLen2} = case (case ?RT_BER:cindex(3,Val,schedule) of {_,Enumval1}->Enumval1;_->?RT_BER:cindex(3,Val,schedule) end) of -noSchedule -> ?RT_BER:encode_enumerated(0,[{tag,128,1,'EXPLICIT',32}]); -once -> ?RT_BER:encode_enumerated(1,[{tag,128,1,'EXPLICIT',32}]); -everyday -> ?RT_BER:encode_enumerated(2,[{tag,128,1,'EXPLICIT',32}]); -Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) + {EncBytes2,EncLen2} = case Cindex2 of +noSchedule -> encode_tags([<<10>>,<<161>>], [0], 1); +once -> encode_tags([<<10>>,<<161>>], [1], 1); +everyday -> encode_tags([<<10>>,<<161>>], [2], 1); +Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}}) end, BytesSoFar = [EncBytes1, EncBytes2], - LenSoFar = EncLen1 + EncLen2, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2, +encode_tags(TagIn, BytesSoFar, LenSoFar). -'dec_KmeWakeUpInfo'(Bytes, OptOrMand) -> - 'dec_KmeWakeUpInfo'(Bytes, OptOrMand, []). +'dec_KmeWakeUpInfo'(Tlv) -> + 'dec_KmeWakeUpInfo'(Tlv, [16]). -'dec_KmeWakeUpInfo'(Bytes, OptOrMand, TagIn) -> +'dec_KmeWakeUpInfo'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 External KME-specific-types:KmeWakeUpTime OPTIONAL +%% attribute time(1) External KME-specific-types:KmeWakeUpTime OPTIONAL %%------------------------------------------------- - {Term1,Bytes3,Rb2} = case Bytes2 of -<<2:2,_:1,0:5,_/binary>> -> -'dec_KmeWakeUpTime'(Bytes2, opt_or_default, [{tag,128,0,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes2, 0 } +{Term1,Tlv2} = case Tlv1 of +[{131072,V1}|TempTlv2] -> + {'dec_KmeWakeUpTime'(V1, [16]), TempTlv2}; + _ -> + { asn1_NOVALUE, Tlv1} end, %%------------------------------------------------- -%% attribute number 2 with type ENUMERATED +%% attribute schedule(2) with type ENUMERATED %%------------------------------------------------- - {Term2,Bytes4,Rb3} = ?RT_BER:decode_enumerated(Bytes3,[],[{noSchedule,0},{once,1},{everyday,2}],[{tag,128,1,'EXPLICIT',32}], mandatory), +[V2|Tlv3] = Tlv2, +Term2 = case decode_integer(V2, [131073,10]) of +0 -> noSchedule; +1 -> once; +2 -> everyday; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end, + +case Tlv3 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed +end, + {'KmeWakeUpInfo', Term1, Term2}. - {Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext), - {{'KmeWakeUpInfo', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}. %%================================ %% KmeWakeupState %%================================ - -'enc_KmeWakeupState'({'KmeWakeupState',Val}, TagIn) -> - 'enc_KmeWakeupState'(Val, TagIn); +'enc_KmeWakeupState'(Val) -> + 'enc_KmeWakeupState'(Val, [<<10>>]). 'enc_KmeWakeupState'(Val, TagIn) -> -case (case Val of {_,Enumval1}->Enumval1;_->Val end) of -answered -> ?RT_BER:encode_enumerated(0,TagIn ++ []); -noAnswer -> ?RT_BER:encode_enumerated(1,TagIn ++ []); -Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) +case Val of +answered -> encode_tags(TagIn, [0], 1); +noAnswer -> encode_tags(TagIn, [1], 1); +Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}}) end. -'dec_KmeWakeupState'(Bytes, OptOrMand) -> - 'dec_KmeWakeupState'(Bytes, OptOrMand, []). +'dec_KmeWakeupState'(Tlv) -> + 'dec_KmeWakeupState'(Tlv, [10]). -'dec_KmeWakeupState'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_enumerated(Bytes,[],[{answered,0},{noAnswer,1}],TagIn++[], OptOrMand). +'dec_KmeWakeupState'(Tlv, TagIn) -> +case decode_integer(Tlv, TagIn) of +0 -> answered; +1 -> noAnswer; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end. %%================================ %% KmeAbsentMessage %%================================ - -'enc_KmeAbsentMessage'({'KmeAbsentMessage',Val}, TagIn) -> - 'enc_KmeAbsentMessage'(Val, TagIn); +'enc_KmeAbsentMessage'(Val) -> + 'enc_KmeAbsentMessage'(Val, []). 'enc_KmeAbsentMessage'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of single -> - ?RT_BER:encode_octet_string([], element(2,Val), [{tag,128,0,'EXPLICIT',32}]); + encode_restricted_string(element(2,Val), [<<4>>,<<160>>]); wide -> - ?RT_BER:encode_octet_string([], element(2,Val), [{tag,128,1,'EXPLICIT',32}]); + encode_restricted_string(element(2,Val), [<<4>>,<<161>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). +encode_tags(TagIn, EncBytes, EncLen). -'dec_KmeAbsentMessage'(Bytes, OptOrMand) -> - 'dec_KmeAbsentMessage'(Bytes, OptOrMand, []). +'dec_KmeAbsentMessage'(Tlv) -> + 'dec_KmeAbsentMessage'(Tlv, []). -'dec_KmeAbsentMessage'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of +'dec_KmeAbsentMessage'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of %% 'single' - <<2:2,_:1,0:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_octet_string(Bytes1,{0,16},[{tag,128,0,'EXPLICIT',32}], no_length, mandatory), - {{single, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131072, V1} -> + {single, begin +Val1 = decode_octet_string(V1, [4]), +C1 = byte_size(Val1), +if 0 =< C1, C1 =< 16 -> +Val1; +true -> +exit({error,{asn1,bad_range}}) +end +end}; %% 'wide' - <<2:2,_:1,1:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_octet_string(Bytes1,{0,32},[{tag,128,1,'EXPLICIT',32}], no_length, mandatory), - {{wide, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131073, V1} -> + {wide, begin +Val2 = decode_octet_string(V1, [4]), +C2 = byte_size(Val2), +if 0 =< C2, C2 =< 32 -> +Val2; +true -> +exit({error,{asn1,bad_range}}) +end +end}; Else -> - case OptOrMand of - mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}}); - _ ->exit({error,{asn1,{no_optional_tag,Else}}}) - end - end. + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. %%================================ %% KmeDnMode %%================================ - -'enc_KmeDnMode'({'KmeDnMode',Val}, TagIn) -> - 'enc_KmeDnMode'(Val, TagIn); +'enc_KmeDnMode'(Val) -> + 'enc_KmeDnMode'(Val, [<<10>>]). 'enc_KmeDnMode'(Val, TagIn) -> -case (case Val of {_,Enumval1}->Enumval1;_->Val end) of -day -> ?RT_BER:encode_enumerated(0,TagIn ++ []); -lunch -> ?RT_BER:encode_enumerated(1,TagIn ++ []); -break -> ?RT_BER:encode_enumerated(2,TagIn ++ []); -night -> ?RT_BER:encode_enumerated(3,TagIn ++ []); -Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) +case Val of +day -> encode_tags(TagIn, [0], 1); +lunch -> encode_tags(TagIn, [1], 1); +break -> encode_tags(TagIn, [2], 1); +night -> encode_tags(TagIn, [3], 1); +Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}}) end. -'dec_KmeDnMode'(Bytes, OptOrMand) -> - 'dec_KmeDnMode'(Bytes, OptOrMand, []). +'dec_KmeDnMode'(Tlv) -> + 'dec_KmeDnMode'(Tlv, [10]). -'dec_KmeDnMode'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_enumerated(Bytes,[],[{day,0},{lunch,1},{break,2},{night,3}],TagIn++[], OptOrMand). +'dec_KmeDnMode'(Tlv, TagIn) -> +case decode_integer(Tlv, TagIn) of +0 -> day; +1 -> lunch; +2 -> break; +3 -> night; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end. %%================================ %% KmeDayNightMode %%================================ - -'enc_KmeDayNightMode'({'KmeDayNightMode',Val}, TagIn) -> - 'enc_KmeDayNightMode'(Val, TagIn); +'enc_KmeDayNightMode'(Val) -> + 'enc_KmeDayNightMode'(Val, [<<48>>]). 'enc_KmeDayNightMode'(Val, TagIn) -> {EncBytes,EncLen} = 'enc_KmeDayNightMode_components'(Val,[],0), - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], EncBytes, EncLen). + encode_tags(TagIn, EncBytes, EncLen). 'enc_KmeDayNightMode_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_KmeDayNightMode_components'([H|T],AccBytes, AccLen) -> - {EncBytes,EncLen} = 'enc_KmeDayNightMode_SEQOF'(H, []), + {EncBytes,EncLen} = 'enc_KmeDayNightMode_SEQOF'(H, [<<48>>]), 'enc_KmeDayNightMode_components'(T,[EncBytes|AccBytes], AccLen + EncLen). @@ -1231,215 +1209,269 @@ end. %% KmeDayNightMode_SEQOF %%================================ 'enc_KmeDayNightMode_SEQOF'(Val, TagIn) -> - + {_,Cindex1, Cindex2} = Val, + %%------------------------------------------------- -%% attribute number 1 with type INTEGER +%% attribute tenantNo(1) with type INTEGER %%------------------------------------------------- - {EncBytes1,EncLen1} = ?RT_BER:encode_integer([], ?RT_BER:cindex(2,Val,tenantNo), [{tag,128,0,'EXPLICIT',32}]), + {EncBytes1,EncLen1} = encode_integer(Cindex1, [<<2>>,<<160>>]), %%------------------------------------------------- -%% attribute number 2 with type ENUMERATED +%% attribute mode(2) with type ENUMERATED %%------------------------------------------------- - {EncBytes2,EncLen2} = case (case ?RT_BER:cindex(3,Val,mode) of {_,Enumval2}->Enumval2;_->?RT_BER:cindex(3,Val,mode) end) of -day -> ?RT_BER:encode_enumerated(0,[{tag,128,1,'EXPLICIT',32}]); -lunch -> ?RT_BER:encode_enumerated(1,[{tag,128,1,'EXPLICIT',32}]); -break -> ?RT_BER:encode_enumerated(2,[{tag,128,1,'EXPLICIT',32}]); -night -> ?RT_BER:encode_enumerated(3,[{tag,128,1,'EXPLICIT',32}]); -Enumval3 -> exit({error,{asn1, {enumerated_not_in_range,Enumval3}}}) + {EncBytes2,EncLen2} = case Cindex2 of +day -> encode_tags([<<10>>,<<161>>], [0], 1); +lunch -> encode_tags([<<10>>,<<161>>], [1], 1); +break -> encode_tags([<<10>>,<<161>>], [2], 1); +night -> encode_tags([<<10>>,<<161>>], [3], 1); +Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) end, BytesSoFar = [EncBytes1, EncBytes2], - LenSoFar = EncLen1 + EncLen2, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). -'dec_KmeDayNightMode_SEQOF'(Bytes, OptOrMand, TagIn) -> +LenSoFar = EncLen1 + EncLen2, +encode_tags(TagIn, BytesSoFar, LenSoFar). + + +'dec_KmeDayNightMode'(Tlv) -> + 'dec_KmeDayNightMode'(Tlv, [16]). + +'dec_KmeDayNightMode'(Tlv, TagIn) -> + %%------------------------------------------------- + %% decode tag and length + %%------------------------------------------------- +Tlv1 = match_tags(Tlv, TagIn), +['dec_KmeDayNightMode_SEQOF'(V1, [16]) || V1 <- Tlv1]. + + +'dec_KmeDayNightMode_SEQOF'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 with type INTEGER +%% attribute tenantNo(1) with type INTEGER %%------------------------------------------------- - {Term1,Bytes3,Rb2} = ?RT_BER:decode_integer(Bytes2,[],[{tag,128,0,'EXPLICIT',32}], mandatory), +[V1|Tlv2] = Tlv1, +Term1 = decode_integer(V1, [131072,2]), %%------------------------------------------------- -%% attribute number 2 with type ENUMERATED +%% attribute mode(2) with type ENUMERATED %%------------------------------------------------- - {Term2,Bytes4,Rb3} = ?RT_BER:decode_enumerated(Bytes3,[],[{day,0},{lunch,1},{break,2},{night,3}],[{tag,128,1,'EXPLICIT',32}], mandatory), - - {Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext), - {{'KmeDayNightMode_SEQOF', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}. - - -'dec_KmeDayNightMode'(Bytes, OptOrMand) -> - 'dec_KmeDayNightMode'(Bytes, OptOrMand, []). - -'dec_KmeDayNightMode'(Bytes, OptOrMand, TagIn) -> - %%------------------------------------------------- - %% decode tag and length - %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), - ?RT_BER:decode_components(Rb1, Len, Bytes1, fun 'dec_KmeDayNightMode_SEQOF'/3, [], []). +[V2|Tlv3] = Tlv2, +Term2 = case decode_integer(V2, [131073,10]) of +0 -> day; +1 -> lunch; +2 -> break; +3 -> night; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end, +case Tlv3 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed +end, + {'KmeDayNightMode_SEQOF', Term1, Term2}. %%================================ %% KmeOgmPlayState %%================================ - -'enc_KmeOgmPlayState'({'KmeOgmPlayState',Val}, TagIn) -> - 'enc_KmeOgmPlayState'(Val, TagIn); +'enc_KmeOgmPlayState'(Val) -> + 'enc_KmeOgmPlayState'(Val, [<<10>>]). 'enc_KmeOgmPlayState'(Val, TagIn) -> -case (case Val of {_,Enumval1}->Enumval1;_->Val end) of -started -> ?RT_BER:encode_enumerated(0,TagIn ++ []); -ended -> ?RT_BER:encode_enumerated(1,TagIn ++ []); -Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) +case Val of +started -> encode_tags(TagIn, [0], 1); +ended -> encode_tags(TagIn, [1], 1); +Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}}) end. -'dec_KmeOgmPlayState'(Bytes, OptOrMand) -> - 'dec_KmeOgmPlayState'(Bytes, OptOrMand, []). +'dec_KmeOgmPlayState'(Tlv) -> + 'dec_KmeOgmPlayState'(Tlv, [10]). -'dec_KmeOgmPlayState'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_enumerated(Bytes,[],[{started,0},{ended,1}],TagIn++[], OptOrMand). +'dec_KmeOgmPlayState'(Tlv, TagIn) -> +case decode_integer(Tlv, TagIn) of +0 -> started; +1 -> ended; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end. %%================================ %% KmeForwardType %%================================ - -'enc_KmeForwardType'({'KmeForwardType',Val}, TagIn) -> - 'enc_KmeForwardType'(Val, TagIn); +'enc_KmeForwardType'(Val) -> + 'enc_KmeForwardType'(Val, [<<10>>]). 'enc_KmeForwardType'(Val, TagIn) -> -case (case Val of {_,Enumval1}->Enumval1;_->Val end) of -forwardImmediate -> ?RT_BER:encode_enumerated(0,TagIn ++ []); -forwardBusy -> ?RT_BER:encode_enumerated(1,TagIn ++ []); -forwardNoAns -> ?RT_BER:encode_enumerated(2,TagIn ++ []); -forwardBusyInt -> ?RT_BER:encode_enumerated(3,TagIn ++ []); -forwardBusyExt -> ?RT_BER:encode_enumerated(4,TagIn ++ []); -forwardNoAnsInt -> ?RT_BER:encode_enumerated(5,TagIn ++ []); -forwardNoAnsExt -> ?RT_BER:encode_enumerated(6,TagIn ++ []); -forwardImmInt -> ?RT_BER:encode_enumerated(7,TagIn ++ []); -forwardImmExt -> ?RT_BER:encode_enumerated(8,TagIn ++ []); -forwardDND -> ?RT_BER:encode_enumerated(9,TagIn ++ []); -forwardDNDInt -> ?RT_BER:encode_enumerated(10,TagIn ++ []); -forwardDNDExt -> ?RT_BER:encode_enumerated(11,TagIn ++ []); -forwardBusyNoAnswer -> ?RT_BER:encode_enumerated(12,TagIn ++ []); -forwardBusyNoAnswerInt -> ?RT_BER:encode_enumerated(13,TagIn ++ []); -forwardBusyNoAnswerExt -> ?RT_BER:encode_enumerated(14,TagIn ++ []); -Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) +case Val of +forwardImmediate -> encode_tags(TagIn, [0], 1); +forwardBusy -> encode_tags(TagIn, [1], 1); +forwardNoAns -> encode_tags(TagIn, [2], 1); +forwardBusyInt -> encode_tags(TagIn, [3], 1); +forwardBusyExt -> encode_tags(TagIn, [4], 1); +forwardNoAnsInt -> encode_tags(TagIn, [5], 1); +forwardNoAnsExt -> encode_tags(TagIn, [6], 1); +forwardImmInt -> encode_tags(TagIn, [7], 1); +forwardImmExt -> encode_tags(TagIn, [8], 1); +forwardDND -> encode_tags(TagIn, [9], 1); +forwardDNDInt -> encode_tags(TagIn, [10], 1); +forwardDNDExt -> encode_tags(TagIn, [11], 1); +forwardBusyNoAnswer -> encode_tags(TagIn, [12], 1); +forwardBusyNoAnswerInt -> encode_tags(TagIn, [13], 1); +forwardBusyNoAnswerExt -> encode_tags(TagIn, [14], 1); +Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}}) end. -'dec_KmeForwardType'(Bytes, OptOrMand) -> - 'dec_KmeForwardType'(Bytes, OptOrMand, []). - -'dec_KmeForwardType'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_enumerated(Bytes,[],[{forwardImmediate,0},{forwardBusy,1},{forwardNoAns,2},{forwardBusyInt,3},{forwardBusyExt,4},{forwardNoAnsInt,5},{forwardNoAnsExt,6},{forwardImmInt,7},{forwardImmExt,8},{forwardDND,9},{forwardDNDInt,10},{forwardDNDExt,11},{forwardBusyNoAnswer,12},{forwardBusyNoAnswerInt,13},{forwardBusyNoAnswerExt,14}],TagIn++[], OptOrMand). +'dec_KmeForwardType'(Tlv) -> + 'dec_KmeForwardType'(Tlv, [10]). + +'dec_KmeForwardType'(Tlv, TagIn) -> +case decode_integer(Tlv, TagIn) of +0 -> forwardImmediate; +1 -> forwardBusy; +2 -> forwardNoAns; +3 -> forwardBusyInt; +4 -> forwardBusyExt; +5 -> forwardNoAnsInt; +6 -> forwardNoAnsExt; +7 -> forwardImmInt; +8 -> forwardImmExt; +9 -> forwardDND; +10 -> forwardDNDInt; +11 -> forwardDNDExt; +12 -> forwardBusyNoAnswer; +13 -> forwardBusyNoAnswerInt; +14 -> forwardBusyNoAnswerExt; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end. %%================================ %% KmeSetForwardInfo %%================================ -'enc_KmeSetForwardInfo'(Val, TagIn) -> +'enc_KmeSetForwardInfo'(Val) -> + 'enc_KmeSetForwardInfo'(Val, [<<48>>]). -%%------------------------------------------------- -%% attribute number 1 with type ENUMERATED -%%------------------------------------------------- - {EncBytes1,EncLen1} = case (case ?RT_BER:cindex(2,Val,forwardingType) of {_,Enumval1}->Enumval1;_->?RT_BER:cindex(2,Val,forwardingType) end) of -forwardImmediate -> ?RT_BER:encode_enumerated(0,[{tag,128,0,'EXPLICIT',32}]); -forwardBusy -> ?RT_BER:encode_enumerated(1,[{tag,128,0,'EXPLICIT',32}]); -forwardNoAns -> ?RT_BER:encode_enumerated(2,[{tag,128,0,'EXPLICIT',32}]); -forwardBusyInt -> ?RT_BER:encode_enumerated(3,[{tag,128,0,'EXPLICIT',32}]); -forwardBusyExt -> ?RT_BER:encode_enumerated(4,[{tag,128,0,'EXPLICIT',32}]); -forwardNoAnsInt -> ?RT_BER:encode_enumerated(5,[{tag,128,0,'EXPLICIT',32}]); -forwardNoAnsExt -> ?RT_BER:encode_enumerated(6,[{tag,128,0,'EXPLICIT',32}]); -forwardImmInt -> ?RT_BER:encode_enumerated(7,[{tag,128,0,'EXPLICIT',32}]); -forwardImmExt -> ?RT_BER:encode_enumerated(8,[{tag,128,0,'EXPLICIT',32}]); -forwardDND -> ?RT_BER:encode_enumerated(9,[{tag,128,0,'EXPLICIT',32}]); -forwardDNDInt -> ?RT_BER:encode_enumerated(10,[{tag,128,0,'EXPLICIT',32}]); -forwardDNDExt -> ?RT_BER:encode_enumerated(11,[{tag,128,0,'EXPLICIT',32}]); -forwardBusyNoAnswer -> ?RT_BER:encode_enumerated(12,[{tag,128,0,'EXPLICIT',32}]); -forwardBusyNoAnswerInt -> ?RT_BER:encode_enumerated(13,[{tag,128,0,'EXPLICIT',32}]); -forwardBusyNoAnswerExt -> ?RT_BER:encode_enumerated(14,[{tag,128,0,'EXPLICIT',32}]); -Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) +'enc_KmeSetForwardInfo'(Val, TagIn) -> +{_,Cindex1, Cindex2, Cindex3} = Val, + +%%------------------------------------------------- +%% attribute forwardingType(1) with type ENUMERATED +%%------------------------------------------------- + {EncBytes1,EncLen1} = case Cindex1 of +forwardImmediate -> encode_tags([<<10>>,<<160>>], [0], 1); +forwardBusy -> encode_tags([<<10>>,<<160>>], [1], 1); +forwardNoAns -> encode_tags([<<10>>,<<160>>], [2], 1); +forwardBusyInt -> encode_tags([<<10>>,<<160>>], [3], 1); +forwardBusyExt -> encode_tags([<<10>>,<<160>>], [4], 1); +forwardNoAnsInt -> encode_tags([<<10>>,<<160>>], [5], 1); +forwardNoAnsExt -> encode_tags([<<10>>,<<160>>], [6], 1); +forwardImmInt -> encode_tags([<<10>>,<<160>>], [7], 1); +forwardImmExt -> encode_tags([<<10>>,<<160>>], [8], 1); +forwardDND -> encode_tags([<<10>>,<<160>>], [9], 1); +forwardDNDInt -> encode_tags([<<10>>,<<160>>], [10], 1); +forwardDNDExt -> encode_tags([<<10>>,<<160>>], [11], 1); +forwardBusyNoAnswer -> encode_tags([<<10>>,<<160>>], [12], 1); +forwardBusyNoAnswerInt -> encode_tags([<<10>>,<<160>>], [13], 1); +forwardBusyNoAnswerExt -> encode_tags([<<10>>,<<160>>], [14], 1); +Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}}) end, %%------------------------------------------------- -%% attribute number 2 with type BOOLEAN +%% attribute activateForward(2) with type BOOLEAN %%------------------------------------------------- - {EncBytes2,EncLen2} = ?RT_BER:encode_boolean(?RT_BER:cindex(3,Val,activateForward), [{tag,128,1,'EXPLICIT',32}]), + {EncBytes2,EncLen2} = encode_boolean(Cindex2, [<<1>>,<<161>>]), %%------------------------------------------------- -%% attribute number 3 External CSTA-device-identifiers:DeviceID OPTIONAL +%% attribute forwardDN(3) External CSTA-device-identifiers:DeviceID OPTIONAL %%------------------------------------------------- - {EncBytes3,EncLen3} = case ?RT_BER:cindex(4,Val,forwardDN) of + {EncBytes3,EncLen3} = case Cindex3 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'CSTA-device-identifiers':'enc_DeviceID'(?RT_BER:cindex(4,Val,forwardDN), [{tag,128,2,'EXPLICIT',32}]) + 'CSTA-device-identifiers':'enc_DeviceID'(Cindex3, [<<48>>,<<162>>]) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3], - LenSoFar = EncLen1 + EncLen2 + EncLen3, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2 + EncLen3, +encode_tags(TagIn, BytesSoFar, LenSoFar). -'dec_KmeSetForwardInfo'(Bytes, OptOrMand) -> - 'dec_KmeSetForwardInfo'(Bytes, OptOrMand, []). +'dec_KmeSetForwardInfo'(Tlv) -> + 'dec_KmeSetForwardInfo'(Tlv, [16]). -'dec_KmeSetForwardInfo'(Bytes, OptOrMand, TagIn) -> +'dec_KmeSetForwardInfo'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), + +%%------------------------------------------------- +%% attribute forwardingType(1) with type ENUMERATED +%%------------------------------------------------- +[V1|Tlv2] = Tlv1, +Term1 = case decode_integer(V1, [131072,10]) of +0 -> forwardImmediate; +1 -> forwardBusy; +2 -> forwardNoAns; +3 -> forwardBusyInt; +4 -> forwardBusyExt; +5 -> forwardNoAnsInt; +6 -> forwardNoAnsExt; +7 -> forwardImmInt; +8 -> forwardImmExt; +9 -> forwardDND; +10 -> forwardDNDInt; +11 -> forwardDNDExt; +12 -> forwardBusyNoAnswer; +13 -> forwardBusyNoAnswerInt; +14 -> forwardBusyNoAnswerExt; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end, %%------------------------------------------------- -%% attribute number 1 with type ENUMERATED +%% attribute activateForward(2) with type BOOLEAN %%------------------------------------------------- - {Term1,Bytes3,Rb2} = ?RT_BER:decode_enumerated(Bytes2,[],[{forwardImmediate,0},{forwardBusy,1},{forwardNoAns,2},{forwardBusyInt,3},{forwardBusyExt,4},{forwardNoAnsInt,5},{forwardNoAnsExt,6},{forwardImmInt,7},{forwardImmExt,8},{forwardDND,9},{forwardDNDInt,10},{forwardDNDExt,11},{forwardBusyNoAnswer,12},{forwardBusyNoAnswerInt,13},{forwardBusyNoAnswerExt,14}],[{tag,128,0,'EXPLICIT',32}], mandatory), +[V2|Tlv3] = Tlv2, +Term2 = decode_boolean(V2, [131073,1]), %%------------------------------------------------- -%% attribute number 2 with type BOOLEAN +%% attribute forwardDN(3) External CSTA-device-identifiers:DeviceID OPTIONAL %%------------------------------------------------- - {Term2,Bytes4,Rb3} = ?RT_BER:decode_boolean(Bytes3,[{tag,128,1,'EXPLICIT',32}], mandatory), +{Term3,Tlv4} = case Tlv3 of +[{131074,V3}|TempTlv4] -> + {'CSTA-device-identifiers':'dec_DeviceID'(V3, [16]), TempTlv4}; + _ -> + { asn1_NOVALUE, Tlv3} +end, -%%------------------------------------------------- -%% attribute number 3 External CSTA-device-identifiers:DeviceID OPTIONAL -%%------------------------------------------------- - {Term3,Bytes5,Rb4} = case Bytes4 of -<<2:2,_:1,2:5,_/binary>> -> -'CSTA-device-identifiers':'dec_DeviceID'(Bytes4, opt_or_default, [{tag,128,2,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes4, 0 } +case Tlv4 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowed end, + {'KmeSetForwardInfo', Term1, Term2, Term3}. - {Bytes6,Rb5} = ?RT_BER:restbytes2(RemBytes, Bytes5,noext), - {{'KmeSetForwardInfo', Term1, Term2, Term3}, Bytes6, Rb1+Rb2+Rb3+Rb4+Rb5}. %%================================ %% KmeFeatureList %%================================ - -'enc_KmeFeatureList'({'KmeFeatureList',Val}, TagIn) -> - 'enc_KmeFeatureList'(Val, TagIn); +'enc_KmeFeatureList'(Val) -> + 'enc_KmeFeatureList'(Val, [<<48>>]). 'enc_KmeFeatureList'(Val, TagIn) -> {EncBytes,EncLen} = 'enc_KmeFeatureList_components'(Val,[],0), - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], EncBytes, EncLen). + encode_tags(TagIn, EncBytes, EncLen). 'enc_KmeFeatureList_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_KmeFeatureList_components'([H|T],AccBytes, AccLen) -> - {EncBytes,EncLen} = 'enc_KmeFeatureList_SEQOF'(H, []), + {EncBytes,EncLen} = 'enc_KmeFeatureList_SEQOF'(H, [<<48>>]), 'enc_KmeFeatureList_components'(T,[EncBytes|AccBytes], AccLen + EncLen). @@ -1449,519 +1481,582 @@ end, %% KmeFeatureList_SEQOF %%================================ 'enc_KmeFeatureList_SEQOF'(Val, TagIn) -> - + {_,Cindex1, Cindex2} = Val, + %%------------------------------------------------- -%% attribute number 1 with type INTEGER +%% attribute featureNo(1) with type INTEGER %%------------------------------------------------- - {EncBytes1,EncLen1} = ?RT_BER:encode_integer([], ?RT_BER:cindex(2,Val,featureNo), [{tag,128,0,'EXPLICIT',32}]), + {EncBytes1,EncLen1} = encode_integer(Cindex1, [<<2>>,<<160>>]), %%------------------------------------------------- -%% attribute number 2 with type IA5String OPTIONAL +%% attribute featureDigits(2) with type IA5String OPTIONAL %%------------------------------------------------- - {EncBytes2,EncLen2} = case ?RT_BER:cindex(3,Val,featureDigits) of + {EncBytes2,EncLen2} = case Cindex2 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_restricted_string([], ?RT_BER:cindex(3,Val,featureDigits), 22, [{tag,128,1,'EXPLICIT',32}]) + encode_restricted_string(Cindex2, [<<22>>,<<161>>]) end, BytesSoFar = [EncBytes1, EncBytes2], - LenSoFar = EncLen1 + EncLen2, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). -'dec_KmeFeatureList_SEQOF'(Bytes, OptOrMand, TagIn) -> +LenSoFar = EncLen1 + EncLen2, +encode_tags(TagIn, BytesSoFar, LenSoFar). + + +'dec_KmeFeatureList'(Tlv) -> + 'dec_KmeFeatureList'(Tlv, [16]). + +'dec_KmeFeatureList'(Tlv, TagIn) -> + %%------------------------------------------------- + %% decode tag and length + %%------------------------------------------------- +Tlv1 = match_tags(Tlv, TagIn), +['dec_KmeFeatureList_SEQOF'(V1, [16]) || V1 <- Tlv1]. + + +'dec_KmeFeatureList_SEQOF'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 with type INTEGER +%% attribute featureNo(1) with type INTEGER %%------------------------------------------------- - {Term1,Bytes3,Rb2} = ?RT_BER:decode_integer(Bytes2,[],[{tag,128,0,'EXPLICIT',32}], mandatory), +[V1|Tlv2] = Tlv1, +Term1 = decode_integer(V1, [131072,2]), %%------------------------------------------------- -%% attribute number 2 with type IA5String OPTIONAL +%% attribute featureDigits(2) with type IA5String OPTIONAL %%------------------------------------------------- - {Term2,Bytes4,Rb3} = case Bytes3 of -<<2:2,_:1,1:5,_/binary>> -> -?RT_BER:decode_restricted_string(Bytes3,{1,6},22,[{tag,128,1,'EXPLICIT',32}], no_length, mandatory); -_ -> -{ asn1_NOVALUE, Bytes3, 0 } +{Term2,Tlv3} = case Tlv2 of +[{131073,V2}|TempTlv3] -> + {begin +Val1 = decode_restricted_string(V2, [22]), +C1 = byte_size(Val1), +if 1 =< C1, C1 =< 6 -> +binary_to_list(Val1); +true -> +exit({error,{asn1,bad_range}}) +end +end, TempTlv3}; + _ -> + { asn1_NOVALUE, Tlv2} end, - {Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext), - {{'KmeFeatureList_SEQOF', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}. - - -'dec_KmeFeatureList'(Bytes, OptOrMand) -> - 'dec_KmeFeatureList'(Bytes, OptOrMand, []). - -'dec_KmeFeatureList'(Bytes, OptOrMand, TagIn) -> - %%------------------------------------------------- - %% decode tag and length - %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), - ?RT_BER:decode_components(Rb1, Len, Bytes1, fun 'dec_KmeFeatureList_SEQOF'/3, [], []). - +case Tlv3 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed +end, + {'KmeFeatureList_SEQOF', Term1, Term2}. %%================================ %% KmeExtGroupEntry %%================================ +'enc_KmeExtGroupEntry'(Val) -> + 'enc_KmeExtGroupEntry'(Val, [<<48>>]). + 'enc_KmeExtGroupEntry'(Val, TagIn) -> +{_,Cindex1, Cindex2, Cindex3, Cindex4, Cindex5, Cindex6} = Val, %%------------------------------------------------- -%% attribute number 1 External CSTA-device-identifiers:DeviceID +%% attribute device(1) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {EncBytes1,EncLen1} = 'CSTA-device-identifiers':'enc_DeviceID'(?RT_BER:cindex(2,Val,device), [{tag,128,0,'EXPLICIT',32}]), + {EncBytes1,EncLen1} = 'CSTA-device-identifiers':'enc_DeviceID'(Cindex1, [<<48>>,<<160>>]), %%------------------------------------------------- -%% attribute number 2 with type CHOICE OPTIONAL +%% attribute name(2) with type CHOICE OPTIONAL %%------------------------------------------------- - {EncBytes2,EncLen2} = case ?RT_BER:cindex(3,Val,name) of + {EncBytes2,EncLen2} = case Cindex2 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_KmeExtGroupEntry_name'(?RT_BER:cindex(3,Val,name), [{tag,128,1,'EXPLICIT',32}]) + 'enc_KmeExtGroupEntry_name'(Cindex2, [<<161>>]) end, %%------------------------------------------------- -%% attribute number 3 External CSTA-device-identifiers:DeviceID +%% attribute devNumber(3) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {EncBytes3,EncLen3} = 'CSTA-device-identifiers':'enc_DeviceID'(?RT_BER:cindex(4,Val,devNumber), [{tag,128,2,'EXPLICIT',32}]), + {EncBytes3,EncLen3} = 'CSTA-device-identifiers':'enc_DeviceID'(Cindex3, [<<48>>,<<162>>]), %%------------------------------------------------- -%% attribute number 4 with type INTEGER OPTIONAL +%% attribute cabinetNO(4) with type INTEGER OPTIONAL %%------------------------------------------------- - {EncBytes4,EncLen4} = case ?RT_BER:cindex(5,Val,cabinetNO) of + {EncBytes4,EncLen4} = case Cindex4 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_integer([], ?RT_BER:cindex(5,Val,cabinetNO), [{tag,128,3,'EXPLICIT',32}]) + encode_integer(Cindex4, [<<2>>,<<163>>]) end, %%------------------------------------------------- -%% attribute number 5 with type IA5String OPTIONAL +%% attribute psNo(5) with type IA5String OPTIONAL %%------------------------------------------------- - {EncBytes5,EncLen5} = case ?RT_BER:cindex(6,Val,psNo) of + {EncBytes5,EncLen5} = case Cindex5 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_restricted_string([], ?RT_BER:cindex(6,Val,psNo), 22, [{tag,128,4,'EXPLICIT',32}]) + encode_restricted_string(Cindex5, [<<22>>,<<164>>]) end, %%------------------------------------------------- -%% attribute number 6 with type INTEGER OPTIONAL +%% attribute numberOfBch(6) with type INTEGER OPTIONAL %%------------------------------------------------- - {EncBytes6,EncLen6} = case ?RT_BER:cindex(7,Val,numberOfBch) of + {EncBytes6,EncLen6} = case Cindex6 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_integer([], ?RT_BER:cindex(7,Val,numberOfBch), [{tag,128,5,'EXPLICIT',32}]) + encode_integer(Cindex6, [<<2>>,<<165>>]) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4, EncBytes5, EncBytes6], - LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5 + EncLen6, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5 + EncLen6, +encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% KmeExtGroupEntry_name %%================================ - -'enc_KmeExtGroupEntry_name'({'KmeExtGroupEntry_name',Val}, TagIn) -> - 'enc_KmeExtGroupEntry_name'(Val, TagIn); - 'enc_KmeExtGroupEntry_name'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of single -> - ?RT_BER:encode_octet_string([], element(2,Val), [{tag,128,0,'EXPLICIT',32}]); + encode_restricted_string(element(2,Val), [<<4>>,<<160>>]); wide -> - ?RT_BER:encode_octet_string([], element(2,Val), [{tag,128,1,'EXPLICIT',32}]); + encode_restricted_string(element(2,Val), [<<4>>,<<161>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). +encode_tags(TagIn, EncBytes, EncLen). -'dec_KmeExtGroupEntry_name'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of - -%% 'single' - <<2:2,_:1,0:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_octet_string(Bytes1,{1,20},[{tag,128,0,'EXPLICIT',32}], no_length, mandatory), - {{single, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; - - -%% 'wide' - <<2:2,_:1,1:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_octet_string(Bytes1,{1,40},[{tag,128,1,'EXPLICIT',32}], no_length, mandatory), - {{wide, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; - - Else -> - case OptOrMand of - mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}}); - _ ->exit({error,{asn1,{no_optional_tag,Else}}}) - end - end. -'dec_KmeExtGroupEntry'(Bytes, OptOrMand) -> - 'dec_KmeExtGroupEntry'(Bytes, OptOrMand, []). +'dec_KmeExtGroupEntry'(Tlv) -> + 'dec_KmeExtGroupEntry'(Tlv, [16]). -'dec_KmeExtGroupEntry'(Bytes, OptOrMand, TagIn) -> +'dec_KmeExtGroupEntry'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 External CSTA-device-identifiers:DeviceID +%% attribute device(1) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {Term1,Bytes3,Rb2} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes2, mandatory, [{tag,128,0,'EXPLICIT',32}]), +[V1|Tlv2] = Tlv1, +Term1 = 'CSTA-device-identifiers':'dec_DeviceID'(V1, [131072,16]), %%------------------------------------------------- -%% attribute number 2 with type CHOICE OPTIONAL +%% attribute name(2) with type CHOICE OPTIONAL %%------------------------------------------------- - {Term2,Bytes4,Rb3} = case Bytes3 of -<<2:2,_:1,1:5,_/binary>> -> -'dec_KmeExtGroupEntry_name'(Bytes3, opt_or_default, [{tag,128,1,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes3, 0 } +{Term2,Tlv3} = case Tlv2 of +[{131073,V2}|TempTlv3] -> + {'dec_KmeExtGroupEntry_name'(V2, []), TempTlv3}; + _ -> + { asn1_NOVALUE, Tlv2} end, %%------------------------------------------------- -%% attribute number 3 External CSTA-device-identifiers:DeviceID +%% attribute devNumber(3) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {Term3,Bytes5,Rb4} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes4, mandatory, [{tag,128,2,'EXPLICIT',32}]), +[V3|Tlv4] = Tlv3, +Term3 = 'CSTA-device-identifiers':'dec_DeviceID'(V3, [131074,16]), %%------------------------------------------------- -%% attribute number 4 with type INTEGER OPTIONAL +%% attribute cabinetNO(4) with type INTEGER OPTIONAL %%------------------------------------------------- - {Term4,Bytes6,Rb5} = case Bytes5 of -<<2:2,_:1,3:5,_/binary>> -> -?RT_BER:decode_integer(Bytes5,[],[{tag,128,3,'EXPLICIT',32}], mandatory); -_ -> -{ asn1_NOVALUE, Bytes5, 0 } +{Term4,Tlv5} = case Tlv4 of +[{131075,V4}|TempTlv5] -> + {decode_integer(V4, [2]), TempTlv5}; + _ -> + { asn1_NOVALUE, Tlv4} end, %%------------------------------------------------- -%% attribute number 5 with type IA5String OPTIONAL +%% attribute psNo(5) with type IA5String OPTIONAL %%------------------------------------------------- - {Term5,Bytes7,Rb6} = case Bytes6 of -<<2:2,_:1,4:5,_/binary>> -> -?RT_BER:decode_restricted_string(Bytes6,{1,3},22,[{tag,128,4,'EXPLICIT',32}], no_length, mandatory); -_ -> -{ asn1_NOVALUE, Bytes6, 0 } +{Term5,Tlv6} = case Tlv5 of +[{131076,V5}|TempTlv6] -> + {begin +Val1 = decode_restricted_string(V5, [22]), +C1 = byte_size(Val1), +if 1 =< C1, C1 =< 3 -> +binary_to_list(Val1); +true -> +exit({error,{asn1,bad_range}}) +end +end, TempTlv6}; + _ -> + { asn1_NOVALUE, Tlv5} end, %%------------------------------------------------- -%% attribute number 6 with type INTEGER OPTIONAL +%% attribute numberOfBch(6) with type INTEGER OPTIONAL %%------------------------------------------------- - {Term6,Bytes8,Rb7} = case Bytes7 of -<<2:2,_:1,5:5,_/binary>> -> -?RT_BER:decode_integer(Bytes7,[],[{tag,128,5,'EXPLICIT',32}], mandatory); -_ -> -{ asn1_NOVALUE, Bytes7, 0 } +{Term6,Tlv7} = case Tlv6 of +[{131077,V6}|TempTlv7] -> + {decode_integer(V6, [2]), TempTlv7}; + _ -> + { asn1_NOVALUE, Tlv6} +end, + +case Tlv7 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv7}}}) % extra fields not allowed end, + {'KmeExtGroupEntry', Term1, Term2, Term3, Term4, Term5, Term6}. + +'dec_KmeExtGroupEntry_name'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of + +%% 'single' + {131072, V1} -> + {single, begin +Val1 = decode_octet_string(V1, [4]), +C1 = byte_size(Val1), +if 1 =< C1, C1 =< 20 -> +Val1; +true -> +exit({error,{asn1,bad_range}}) +end +end}; + - {Bytes9,Rb8} = ?RT_BER:restbytes2(RemBytes, Bytes8,noext), - {{'KmeExtGroupEntry', Term1, Term2, Term3, Term4, Term5, Term6}, Bytes9, Rb1+Rb2+Rb3+Rb4+Rb5+Rb6+Rb7+Rb8}. +%% 'wide' + {131073, V1} -> + {wide, begin +Val2 = decode_octet_string(V1, [4]), +C2 = byte_size(Val2), +if 1 =< C2, C2 =< 40 -> +Val2; +true -> +exit({error,{asn1,bad_range}}) +end +end}; + + Else -> + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. %%================================ %% KmeTrkGroupEntry %%================================ +'enc_KmeTrkGroupEntry'(Val) -> + 'enc_KmeTrkGroupEntry'(Val, [<<48>>]). + 'enc_KmeTrkGroupEntry'(Val, TagIn) -> +{_,Cindex1, Cindex2, Cindex3, Cindex4} = Val, %%------------------------------------------------- -%% attribute number 1 External CSTA-device-identifiers:DeviceID +%% attribute device(1) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {EncBytes1,EncLen1} = 'CSTA-device-identifiers':'enc_DeviceID'(?RT_BER:cindex(2,Val,device), [{tag,128,0,'EXPLICIT',32}]), + {EncBytes1,EncLen1} = 'CSTA-device-identifiers':'enc_DeviceID'(Cindex1, [<<48>>,<<160>>]), %%------------------------------------------------- -%% attribute number 2 with type CHOICE OPTIONAL +%% attribute name(2) with type CHOICE OPTIONAL %%------------------------------------------------- - {EncBytes2,EncLen2} = case ?RT_BER:cindex(3,Val,name) of + {EncBytes2,EncLen2} = case Cindex2 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_KmeTrkGroupEntry_name'(?RT_BER:cindex(3,Val,name), [{tag,128,1,'EXPLICIT',32}]) + 'enc_KmeTrkGroupEntry_name'(Cindex2, [<<161>>]) end, %%------------------------------------------------- -%% attribute number 3 with type IA5String +%% attribute coNo(3) with type IA5String %%------------------------------------------------- - {EncBytes3,EncLen3} = ?RT_BER:encode_restricted_string([], ?RT_BER:cindex(4,Val,coNo), 22, [{tag,128,2,'EXPLICIT',32}]), + {EncBytes3,EncLen3} = encode_restricted_string(Cindex3, [<<22>>,<<162>>]), %%------------------------------------------------- -%% attribute number 4 with type INTEGER OPTIONAL +%% attribute cabinetNO(4) with type INTEGER OPTIONAL %%------------------------------------------------- - {EncBytes4,EncLen4} = case ?RT_BER:cindex(5,Val,cabinetNO) of + {EncBytes4,EncLen4} = case Cindex4 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_integer([], ?RT_BER:cindex(5,Val,cabinetNO), [{tag,128,3,'EXPLICIT',32}]) + encode_integer(Cindex4, [<<2>>,<<163>>]) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4], - LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4, +encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% KmeTrkGroupEntry_name %%================================ - -'enc_KmeTrkGroupEntry_name'({'KmeTrkGroupEntry_name',Val}, TagIn) -> - 'enc_KmeTrkGroupEntry_name'(Val, TagIn); - 'enc_KmeTrkGroupEntry_name'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of single -> - ?RT_BER:encode_octet_string([], element(2,Val), [{tag,128,0,'EXPLICIT',32}]); + encode_restricted_string(element(2,Val), [<<4>>,<<160>>]); wide -> - ?RT_BER:encode_octet_string([], element(2,Val), [{tag,128,1,'EXPLICIT',32}]); + encode_restricted_string(element(2,Val), [<<4>>,<<161>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). - +encode_tags(TagIn, EncBytes, EncLen). -'dec_KmeTrkGroupEntry_name'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of -%% 'single' - <<2:2,_:1,0:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_octet_string(Bytes1,{1,20},[{tag,128,0,'EXPLICIT',32}], no_length, mandatory), - {{single, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; - - -%% 'wide' - <<2:2,_:1,1:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_octet_string(Bytes1,{1,40},[{tag,128,1,'EXPLICIT',32}], no_length, mandatory), - {{wide, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; - Else -> - case OptOrMand of - mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}}); - _ ->exit({error,{asn1,{no_optional_tag,Else}}}) - end - end. +'dec_KmeTrkGroupEntry'(Tlv) -> + 'dec_KmeTrkGroupEntry'(Tlv, [16]). -'dec_KmeTrkGroupEntry'(Bytes, OptOrMand) -> - 'dec_KmeTrkGroupEntry'(Bytes, OptOrMand, []). - -'dec_KmeTrkGroupEntry'(Bytes, OptOrMand, TagIn) -> +'dec_KmeTrkGroupEntry'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 External CSTA-device-identifiers:DeviceID +%% attribute device(1) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {Term1,Bytes3,Rb2} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes2, mandatory, [{tag,128,0,'EXPLICIT',32}]), +[V1|Tlv2] = Tlv1, +Term1 = 'CSTA-device-identifiers':'dec_DeviceID'(V1, [131072,16]), %%------------------------------------------------- -%% attribute number 2 with type CHOICE OPTIONAL +%% attribute name(2) with type CHOICE OPTIONAL %%------------------------------------------------- - {Term2,Bytes4,Rb3} = case Bytes3 of -<<2:2,_:1,1:5,_/binary>> -> -'dec_KmeTrkGroupEntry_name'(Bytes3, opt_or_default, [{tag,128,1,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes3, 0 } +{Term2,Tlv3} = case Tlv2 of +[{131073,V2}|TempTlv3] -> + {'dec_KmeTrkGroupEntry_name'(V2, []), TempTlv3}; + _ -> + { asn1_NOVALUE, Tlv2} end, %%------------------------------------------------- -%% attribute number 3 with type IA5String +%% attribute coNo(3) with type IA5String %%------------------------------------------------- - {Term3,Bytes5,Rb4} = ?RT_BER:decode_restricted_string(Bytes4,{1,3},22,[{tag,128,2,'EXPLICIT',32}], no_length, mandatory), +[V3|Tlv4] = Tlv3, +Term3 = begin +Val1 = decode_restricted_string(V3, [131074,22]), +C1 = byte_size(Val1), +if 1 =< C1, C1 =< 3 -> +binary_to_list(Val1); +true -> +exit({error,{asn1,bad_range}}) +end +end, %%------------------------------------------------- -%% attribute number 4 with type INTEGER OPTIONAL +%% attribute cabinetNO(4) with type INTEGER OPTIONAL %%------------------------------------------------- - {Term4,Bytes6,Rb5} = case Bytes5 of -<<2:2,_:1,3:5,_/binary>> -> -?RT_BER:decode_integer(Bytes5,[],[{tag,128,3,'EXPLICIT',32}], mandatory); -_ -> -{ asn1_NOVALUE, Bytes5, 0 } +{Term4,Tlv5} = case Tlv4 of +[{131075,V4}|TempTlv5] -> + {decode_integer(V4, [2]), TempTlv5}; + _ -> + { asn1_NOVALUE, Tlv4} +end, + +case Tlv5 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv5}}}) % extra fields not allowed end, + {'KmeTrkGroupEntry', Term1, Term2, Term3, Term4}. + +'dec_KmeTrkGroupEntry_name'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of + +%% 'single' + {131072, V1} -> + {single, begin +Val1 = decode_octet_string(V1, [4]), +C1 = byte_size(Val1), +if 1 =< C1, C1 =< 20 -> +Val1; +true -> +exit({error,{asn1,bad_range}}) +end +end}; + - {Bytes7,Rb6} = ?RT_BER:restbytes2(RemBytes, Bytes6,noext), - {{'KmeTrkGroupEntry', Term1, Term2, Term3, Term4}, Bytes7, Rb1+Rb2+Rb3+Rb4+Rb5+Rb6}. +%% 'wide' + {131073, V1} -> + {wide, begin +Val2 = decode_octet_string(V1, [4]), +C2 = byte_size(Val2), +if 1 =< C2, C2 =< 40 -> +Val2; +true -> +exit({error,{asn1,bad_range}}) +end +end}; + + Else -> + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. %%================================ %% KmeExtMembers %%================================ +'enc_KmeExtMembers'(Val) -> + 'enc_KmeExtMembers'(Val, [<<48>>]). + 'enc_KmeExtMembers'(Val, TagIn) -> +{_,Cindex1, Cindex2} = Val, %%------------------------------------------------- -%% attribute number 1 with type INTEGER +%% attribute groupNo(1) with type INTEGER %%------------------------------------------------- - {EncBytes1,EncLen1} = ?RT_BER:encode_integer([], ?RT_BER:cindex(2,Val,groupNo), [{tag,128,0,'IMPLICIT',32}]), + {EncBytes1,EncLen1} = encode_integer(Cindex1, [<<128>>]), %%------------------------------------------------- -%% attribute number 2 with type SEQUENCE OF +%% attribute members(2) with type SEQUENCE OF %%------------------------------------------------- - {EncBytes2,EncLen2} = 'enc_KmeExtMembers_members'(?RT_BER:cindex(3,Val,members), [{tag,128,1,'IMPLICIT',32}]), + {EncBytes2,EncLen2} = 'enc_KmeExtMembers_members'(Cindex2, [<<161>>]), BytesSoFar = [EncBytes1, EncBytes2], - LenSoFar = EncLen1 + EncLen2, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2, +encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% KmeExtMembers_members %%================================ - -'enc_KmeExtMembers_members'({'KmeExtMembers_members',Val}, TagIn) -> - 'enc_KmeExtMembers_members'(Val, TagIn); - 'enc_KmeExtMembers_members'(Val, TagIn) -> {EncBytes,EncLen} = 'enc_KmeExtMembers_members_components'(Val,[],0), - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], EncBytes, EncLen). + encode_tags(TagIn, EncBytes, EncLen). 'enc_KmeExtMembers_members_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_KmeExtMembers_members_components'([H|T],AccBytes, AccLen) -> - {EncBytes,EncLen} = 'enc_KmeExtGroupEntry'(H, []), + {EncBytes,EncLen} = 'enc_KmeExtGroupEntry'(H, [<<48>>]), 'enc_KmeExtMembers_members_components'(T,[EncBytes|AccBytes], AccLen + EncLen). -'dec_KmeExtMembers_members'(Bytes, OptOrMand, TagIn) -> - %%------------------------------------------------- - %% decode tag and length - %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), - ?RT_BER:decode_components(Rb1, Len, Bytes1, fun 'dec_KmeExtGroupEntry'/3, [], []). - - -'dec_KmeExtMembers'(Bytes, OptOrMand) -> - 'dec_KmeExtMembers'(Bytes, OptOrMand, []). +'dec_KmeExtMembers'(Tlv) -> + 'dec_KmeExtMembers'(Tlv, [16]). -'dec_KmeExtMembers'(Bytes, OptOrMand, TagIn) -> +'dec_KmeExtMembers'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 with type INTEGER +%% attribute groupNo(1) with type INTEGER %%------------------------------------------------- - {Term1,Bytes3,Rb2} = ?RT_BER:decode_integer(Bytes2,[],[{tag,128,0,'IMPLICIT',32}], mandatory), +[V1|Tlv2] = Tlv1, +Term1 = decode_integer(V1, [131072]), %%------------------------------------------------- -%% attribute number 2 with type SEQUENCE OF +%% attribute members(2) with type SEQUENCE OF %%------------------------------------------------- - {Term2,Bytes4,Rb3} = 'dec_KmeExtMembers_members'(Bytes3, mandatory, [{tag,128,1,'IMPLICIT',32}]), +[V2|Tlv3] = Tlv2, +Term2 = 'dec_KmeExtMembers_members'(V2, [131073]), + +case Tlv3 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed +end, + {'KmeExtMembers', Term1, Term2}. + +'dec_KmeExtMembers_members'(Tlv, TagIn) -> + %%------------------------------------------------- + %% decode tag and length + %%------------------------------------------------- +Tlv1 = match_tags(Tlv, TagIn), +['dec_KmeExtGroupEntry'(V1, [16]) || V1 <- Tlv1]. + - {Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext), - {{'KmeExtMembers', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}. %%================================ %% KmeTrkMembers %%================================ +'enc_KmeTrkMembers'(Val) -> + 'enc_KmeTrkMembers'(Val, [<<48>>]). + 'enc_KmeTrkMembers'(Val, TagIn) -> +{_,Cindex1, Cindex2} = Val, %%------------------------------------------------- -%% attribute number 1 with type INTEGER +%% attribute groupNo(1) with type INTEGER %%------------------------------------------------- - {EncBytes1,EncLen1} = ?RT_BER:encode_integer([], ?RT_BER:cindex(2,Val,groupNo), [{tag,128,0,'IMPLICIT',32}]), + {EncBytes1,EncLen1} = encode_integer(Cindex1, [<<128>>]), %%------------------------------------------------- -%% attribute number 2 with type SEQUENCE OF +%% attribute members(2) with type SEQUENCE OF %%------------------------------------------------- - {EncBytes2,EncLen2} = 'enc_KmeTrkMembers_members'(?RT_BER:cindex(3,Val,members), [{tag,128,1,'IMPLICIT',32}]), + {EncBytes2,EncLen2} = 'enc_KmeTrkMembers_members'(Cindex2, [<<161>>]), BytesSoFar = [EncBytes1, EncBytes2], - LenSoFar = EncLen1 + EncLen2, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2, +encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% KmeTrkMembers_members %%================================ - -'enc_KmeTrkMembers_members'({'KmeTrkMembers_members',Val}, TagIn) -> - 'enc_KmeTrkMembers_members'(Val, TagIn); - 'enc_KmeTrkMembers_members'(Val, TagIn) -> {EncBytes,EncLen} = 'enc_KmeTrkMembers_members_components'(Val,[],0), - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], EncBytes, EncLen). + encode_tags(TagIn, EncBytes, EncLen). 'enc_KmeTrkMembers_members_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_KmeTrkMembers_members_components'([H|T],AccBytes, AccLen) -> - {EncBytes,EncLen} = 'enc_KmeTrkGroupEntry'(H, []), + {EncBytes,EncLen} = 'enc_KmeTrkGroupEntry'(H, [<<48>>]), 'enc_KmeTrkMembers_members_components'(T,[EncBytes|AccBytes], AccLen + EncLen). -'dec_KmeTrkMembers_members'(Bytes, OptOrMand, TagIn) -> - %%------------------------------------------------- - %% decode tag and length - %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), - ?RT_BER:decode_components(Rb1, Len, Bytes1, fun 'dec_KmeTrkGroupEntry'/3, [], []). - +'dec_KmeTrkMembers'(Tlv) -> + 'dec_KmeTrkMembers'(Tlv, [16]). -'dec_KmeTrkMembers'(Bytes, OptOrMand) -> - 'dec_KmeTrkMembers'(Bytes, OptOrMand, []). - -'dec_KmeTrkMembers'(Bytes, OptOrMand, TagIn) -> +'dec_KmeTrkMembers'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 with type INTEGER +%% attribute groupNo(1) with type INTEGER %%------------------------------------------------- - {Term1,Bytes3,Rb2} = ?RT_BER:decode_integer(Bytes2,[],[{tag,128,0,'IMPLICIT',32}], mandatory), +[V1|Tlv2] = Tlv1, +Term1 = decode_integer(V1, [131072]), %%------------------------------------------------- -%% attribute number 2 with type SEQUENCE OF +%% attribute members(2) with type SEQUENCE OF %%------------------------------------------------- - {Term2,Bytes4,Rb3} = 'dec_KmeTrkMembers_members'(Bytes3, mandatory, [{tag,128,1,'IMPLICIT',32}]), +[V2|Tlv3] = Tlv2, +Term2 = 'dec_KmeTrkMembers_members'(V2, [131073]), + +case Tlv3 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed +end, + {'KmeTrkMembers', Term1, Term2}. + +'dec_KmeTrkMembers_members'(Tlv, TagIn) -> + %%------------------------------------------------- + %% decode tag and length + %%------------------------------------------------- +Tlv1 = match_tags(Tlv, TagIn), +['dec_KmeTrkGroupEntry'(V1, [16]) || V1 <- Tlv1]. + - {Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext), - {{'KmeTrkMembers', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}. %%================================ %% KmeExtTrkGroupList %%================================ - -'enc_KmeExtTrkGroupList'({'KmeExtTrkGroupList',Val}, TagIn) -> - 'enc_KmeExtTrkGroupList'(Val, TagIn); +'enc_KmeExtTrkGroupList'(Val) -> + 'enc_KmeExtTrkGroupList'(Val, [<<48>>]). 'enc_KmeExtTrkGroupList'(Val, TagIn) -> {EncBytes,EncLen} = 'enc_KmeExtTrkGroupList_components'(Val,[],0), - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], EncBytes, EncLen). + encode_tags(TagIn, EncBytes, EncLen). 'enc_KmeExtTrkGroupList_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_KmeExtTrkGroupList_components'([H|T],AccBytes, AccLen) -> - {EncBytes,EncLen} = 'enc_KmeExtTrkGroupList_SEQOF'(H, []), + {EncBytes,EncLen} = 'enc_KmeExtTrkGroupList_SEQOF'(H, [<<48>>]), 'enc_KmeExtTrkGroupList_components'(T,[EncBytes|AccBytes], AccLen + EncLen). @@ -1971,163 +2066,171 @@ end, %% KmeExtTrkGroupList_SEQOF %%================================ 'enc_KmeExtTrkGroupList_SEQOF'(Val, TagIn) -> - + {_,Cindex1, Cindex2, Cindex3} = Val, + %%------------------------------------------------- -%% attribute number 1 with type INTEGER +%% attribute groupNo(1) with type INTEGER %%------------------------------------------------- - {EncBytes1,EncLen1} = ?RT_BER:encode_integer([], ?RT_BER:cindex(2,Val,groupNo), [{tag,128,0,'EXPLICIT',32}]), + {EncBytes1,EncLen1} = encode_integer(Cindex1, [<<2>>,<<160>>]), %%------------------------------------------------- -%% attribute number 2 with type CHOICE OPTIONAL +%% attribute name(2) with type CHOICE OPTIONAL %%------------------------------------------------- - {EncBytes2,EncLen2} = case ?RT_BER:cindex(3,Val,name) of + {EncBytes2,EncLen2} = case Cindex2 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_KmeExtTrkGroupList_SEQOF_name'(?RT_BER:cindex(3,Val,name), [{tag,128,1,'EXPLICIT',32}]) + 'enc_KmeExtTrkGroupList_SEQOF_name'(Cindex2, [<<161>>]) end, %%------------------------------------------------- -%% attribute number 3 with type INTEGER OPTIONAL +%% attribute tenantNo(3) with type INTEGER OPTIONAL %%------------------------------------------------- - {EncBytes3,EncLen3} = case ?RT_BER:cindex(4,Val,tenantNo) of + {EncBytes3,EncLen3} = case Cindex3 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_integer([], ?RT_BER:cindex(4,Val,tenantNo), [{tag,128,2,'EXPLICIT',32}]) + encode_integer(Cindex3, [<<2>>,<<162>>]) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3], - LenSoFar = EncLen1 + EncLen2 + EncLen3, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2 + EncLen3, +encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% KmeExtTrkGroupList_SEQOF_name %%================================ - -'enc_KmeExtTrkGroupList_SEQOF_name'({'KmeExtTrkGroupList_SEQOF_name',Val}, TagIn) -> - 'enc_KmeExtTrkGroupList_SEQOF_name'(Val, TagIn); - 'enc_KmeExtTrkGroupList_SEQOF_name'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of single -> - ?RT_BER:encode_octet_string([], element(2,Val), [{tag,128,0,'EXPLICIT',32}]); + encode_restricted_string(element(2,Val), [<<4>>,<<160>>]); wide -> - ?RT_BER:encode_octet_string([], element(2,Val), [{tag,128,1,'EXPLICIT',32}]); + encode_restricted_string(element(2,Val), [<<4>>,<<161>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). +encode_tags(TagIn, EncBytes, EncLen). -'dec_KmeExtTrkGroupList_SEQOF_name'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of -%% 'single' - <<2:2,_:1,0:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_octet_string(Bytes1,{1,20},[{tag,128,0,'EXPLICIT',32}], no_length, mandatory), - {{single, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; +'dec_KmeExtTrkGroupList'(Tlv) -> + 'dec_KmeExtTrkGroupList'(Tlv, [16]). -%% 'wide' - <<2:2,_:1,1:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_octet_string(Bytes1,{1,40},[{tag,128,1,'EXPLICIT',32}], no_length, mandatory), - {{wide, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; +'dec_KmeExtTrkGroupList'(Tlv, TagIn) -> + %%------------------------------------------------- + %% decode tag and length + %%------------------------------------------------- +Tlv1 = match_tags(Tlv, TagIn), +['dec_KmeExtTrkGroupList_SEQOF'(V1, [16]) || V1 <- Tlv1]. - Else -> - case OptOrMand of - mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}}); - _ ->exit({error,{asn1,{no_optional_tag,Else}}}) - end - end. -'dec_KmeExtTrkGroupList_SEQOF'(Bytes, OptOrMand, TagIn) -> + +'dec_KmeExtTrkGroupList_SEQOF'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 with type INTEGER +%% attribute groupNo(1) with type INTEGER %%------------------------------------------------- - {Term1,Bytes3,Rb2} = ?RT_BER:decode_integer(Bytes2,[],[{tag,128,0,'EXPLICIT',32}], mandatory), +[V1|Tlv2] = Tlv1, +Term1 = decode_integer(V1, [131072,2]), %%------------------------------------------------- -%% attribute number 2 with type CHOICE OPTIONAL +%% attribute name(2) with type CHOICE OPTIONAL %%------------------------------------------------- - {Term2,Bytes4,Rb3} = case Bytes3 of -<<2:2,_:1,1:5,_/binary>> -> -'dec_KmeExtTrkGroupList_SEQOF_name'(Bytes3, opt_or_default, [{tag,128,1,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes3, 0 } +{Term2,Tlv3} = case Tlv2 of +[{131073,V2}|TempTlv3] -> + {'dec_KmeExtTrkGroupList_SEQOF_name'(V2, []), TempTlv3}; + _ -> + { asn1_NOVALUE, Tlv2} end, %%------------------------------------------------- -%% attribute number 3 with type INTEGER OPTIONAL +%% attribute tenantNo(3) with type INTEGER OPTIONAL %%------------------------------------------------- - {Term3,Bytes5,Rb4} = case Bytes4 of -<<2:2,_:1,2:5,_/binary>> -> -?RT_BER:decode_integer(Bytes4,[],[{tag,128,2,'EXPLICIT',32}], mandatory); -_ -> -{ asn1_NOVALUE, Bytes4, 0 } +{Term3,Tlv4} = case Tlv3 of +[{131074,V3}|TempTlv4] -> + {decode_integer(V3, [2]), TempTlv4}; + _ -> + { asn1_NOVALUE, Tlv3} end, - {Bytes6,Rb5} = ?RT_BER:restbytes2(RemBytes, Bytes5,noext), - {{'KmeExtTrkGroupList_SEQOF', Term1, Term2, Term3}, Bytes6, Rb1+Rb2+Rb3+Rb4+Rb5}. +case Tlv4 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowed +end, + {'KmeExtTrkGroupList_SEQOF', Term1, Term2, Term3}. +'dec_KmeExtTrkGroupList_SEQOF_name'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of -'dec_KmeExtTrkGroupList'(Bytes, OptOrMand) -> - 'dec_KmeExtTrkGroupList'(Bytes, OptOrMand, []). +%% 'single' + {131072, V1} -> + {single, begin +Val1 = decode_octet_string(V1, [4]), +C1 = byte_size(Val1), +if 1 =< C1, C1 =< 20 -> +Val1; +true -> +exit({error,{asn1,bad_range}}) +end +end}; -'dec_KmeExtTrkGroupList'(Bytes, OptOrMand, TagIn) -> - %%------------------------------------------------- - %% decode tag and length - %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), - ?RT_BER:decode_components(Rb1, Len, Bytes1, fun 'dec_KmeExtTrkGroupList_SEQOF'/3, [], []). +%% 'wide' + {131073, V1} -> + {wide, begin +Val2 = decode_octet_string(V1, [4]), +C2 = byte_size(Val2), +if 1 =< C2, C2 =< 40 -> +Val2; +true -> +exit({error,{asn1,bad_range}}) +end +end}; + Else -> + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. %%================================ %% KmeGroupMembers %%================================ - -'enc_KmeGroupMembers'({'KmeGroupMembers',Val}, TagIn) -> - 'enc_KmeGroupMembers'(Val, TagIn); +'enc_KmeGroupMembers'(Val) -> + 'enc_KmeGroupMembers'(Val, [<<3>>]). 'enc_KmeGroupMembers'(Val, TagIn) -> -?RT_BER:encode_bit_string([], Val, [{one,0},{two,1},{three,2},{four,3},{five,4},{six,5},{seven,6},{eight,7},{nine,8},{ten,9},{eleven,10},{twelve,11},{thirteen,12},{fourteen,13},{fifteen,14},{sixteen,15},{seventeen,16},{eighteen,17},{nineteen,18},{twenty,19},{twentyOne,20},{twentyTwo,21},{twentyThree,22},{twentyFour,23},{twentyFive,24},{twentySix,25},{twentySeven,26},{twentyEight,27},{twentyNine,28},{thirty,29},{thirtyOne,30},{thirtyTwo,31},{thirtyThree,32},{thirtyFour,33},{thirtyFive,34},{thirtySix,35},{thirtySeven,36},{thirtyEight,37},{thirtyNine,38},{fourty,39},{fourtyOne,40},{fourtyTwo,41},{fourtyThree,42},{fourtyFour,43},{fourtyFive,44},{fourtySix,45},{fourtySeven,46},{fourtyEight,47},{fourtyNine,48},{fifty,49},{fiftyOne,50},{fiftyTwo,51},{fiftyThree,52},{fiftyFour,53},{fiftyFive,54},{fiftySix,55},{fiftySeven,56},{fiftyEight,57},{fiftyNine,58},{sixty,59},{sixtyOne,60},{sixtyTwo,61},{sixtyThree,62},{sixtyFour,63},{sixtyFive,64},{sixtySix,65},{sixtySeven,66},{sixtyEight,67},{sixtyNine,68},{seventy,69},{seventyOne,70},{seventyTwo,71},{seventyThree,72},{seventyFour,73},{seventyFive,74},{seventySix,75},{seventySeven,76},{seventyEight,77},{seventyNine,78},{eighty,79},{eightyOne,80},{eightyTwo,81},{eightyThree,82},{eightyFour,83},{eightyFive,84},{eightySix,85},{eightySeven,86},{eightyEight,87},{eightyNine,88},{ninety,89},{ninetyOne,90},{ninetyTwo,91},{ninetyThree,92},{ninetyFour,93},{ninetyFive,94},{ninetySix,95},{ninetySeven,96},{ninetyEight,97},{ninetyNine,98},{oneHundred,99},{oneHundredOne,100},{oneHundredTwo,101},{oneHundredThree,102},{oneHundredFour,103},{oneHundredFive,104},{oneHundredSix,105},{oneHundredSeven,106},{oneHundredEitht,107},{oneHundredNine,108},{oneHundredTen,109},{oneHundredEleven,110},{oneHundredTwelve,111},{oneHundredThirteen,112},{oneHundredFourteen,113},{oneHundredFifteen,114},{oneHundredSixteen,115},{oneHundredSeventeen,116},{oneHundredEithteen,117},{oneHundredNineteen,118},{oneHundredTwenty,119},{oneHundredTwentyOne,120},{oneHundredTwentyTwo,121},{oneHundredTwentyThree,122},{oneHundredTwentyFour,123},{oneHundredTwentyFive,124},{oneHundredTwentySix,125},{oneHundredTwentySeven,126},{oneHundredTwentyEight,127}], TagIn ++ []). +encode_named_bit_string(Val, [{one,0},{two,1},{three,2},{four,3},{five,4},{six,5},{seven,6},{eight,7},{nine,8},{ten,9},{eleven,10},{twelve,11},{thirteen,12},{fourteen,13},{fifteen,14},{sixteen,15},{seventeen,16},{eighteen,17},{nineteen,18},{twenty,19},{twentyOne,20},{twentyTwo,21},{twentyThree,22},{twentyFour,23},{twentyFive,24},{twentySix,25},{twentySeven,26},{twentyEight,27},{twentyNine,28},{thirty,29},{thirtyOne,30},{thirtyTwo,31},{thirtyThree,32},{thirtyFour,33},{thirtyFive,34},{thirtySix,35},{thirtySeven,36},{thirtyEight,37},{thirtyNine,38},{fourty,39},{fourtyOne,40},{fourtyTwo,41},{fourtyThree,42},{fourtyFour,43},{fourtyFive,44},{fourtySix,45},{fourtySeven,46},{fourtyEight,47},{fourtyNine,48},{fifty,49},{fiftyOne,50},{fiftyTwo,51},{fiftyThree,52},{fiftyFour,53},{fiftyFive,54},{fiftySix,55},{fiftySeven,56},{fiftyEight,57},{fiftyNine,58},{sixty,59},{sixtyOne,60},{sixtyTwo,61},{sixtyThree,62},{sixtyFour,63},{sixtyFive,64},{sixtySix,65},{sixtySeven,66},{sixtyEight,67},{sixtyNine,68},{seventy,69},{seventyOne,70},{seventyTwo,71},{seventyThree,72},{seventyFour,73},{seventyFive,74},{seventySix,75},{seventySeven,76},{seventyEight,77},{seventyNine,78},{eighty,79},{eightyOne,80},{eightyTwo,81},{eightyThree,82},{eightyFour,83},{eightyFive,84},{eightySix,85},{eightySeven,86},{eightyEight,87},{eightyNine,88},{ninety,89},{ninetyOne,90},{ninetyTwo,91},{ninetyThree,92},{ninetyFour,93},{ninetyFive,94},{ninetySix,95},{ninetySeven,96},{ninetyEight,97},{ninetyNine,98},{oneHundred,99},{oneHundredOne,100},{oneHundredTwo,101},{oneHundredThree,102},{oneHundredFour,103},{oneHundredFive,104},{oneHundredSix,105},{oneHundredSeven,106},{oneHundredEitht,107},{oneHundredNine,108},{oneHundredTen,109},{oneHundredEleven,110},{oneHundredTwelve,111},{oneHundredThirteen,112},{oneHundredFourteen,113},{oneHundredFifteen,114},{oneHundredSixteen,115},{oneHundredSeventeen,116},{oneHundredEithteen,117},{oneHundredNineteen,118},{oneHundredTwenty,119},{oneHundredTwentyOne,120},{oneHundredTwentyTwo,121},{oneHundredTwentyThree,122},{oneHundredTwentyFour,123},{oneHundredTwentyFive,124},{oneHundredTwentySix,125},{oneHundredTwentySeven,126},{oneHundredTwentyEight,127}], TagIn). -'dec_KmeGroupMembers'(Bytes, OptOrMand) -> - 'dec_KmeGroupMembers'(Bytes, OptOrMand, []). +'dec_KmeGroupMembers'(Tlv) -> + 'dec_KmeGroupMembers'(Tlv, [3]). -'dec_KmeGroupMembers'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_bit_string(Bytes,[],[{one,0},{two,1},{three,2},{four,3},{five,4},{six,5},{seven,6},{eight,7},{nine,8},{ten,9},{eleven,10},{twelve,11},{thirteen,12},{fourteen,13},{fifteen,14},{sixteen,15},{seventeen,16},{eighteen,17},{nineteen,18},{twenty,19},{twentyOne,20},{twentyTwo,21},{twentyThree,22},{twentyFour,23},{twentyFive,24},{twentySix,25},{twentySeven,26},{twentyEight,27},{twentyNine,28},{thirty,29},{thirtyOne,30},{thirtyTwo,31},{thirtyThree,32},{thirtyFour,33},{thirtyFive,34},{thirtySix,35},{thirtySeven,36},{thirtyEight,37},{thirtyNine,38},{fourty,39},{fourtyOne,40},{fourtyTwo,41},{fourtyThree,42},{fourtyFour,43},{fourtyFive,44},{fourtySix,45},{fourtySeven,46},{fourtyEight,47},{fourtyNine,48},{fifty,49},{fiftyOne,50},{fiftyTwo,51},{fiftyThree,52},{fiftyFour,53},{fiftyFive,54},{fiftySix,55},{fiftySeven,56},{fiftyEight,57},{fiftyNine,58},{sixty,59},{sixtyOne,60},{sixtyTwo,61},{sixtyThree,62},{sixtyFour,63},{sixtyFive,64},{sixtySix,65},{sixtySeven,66},{sixtyEight,67},{sixtyNine,68},{seventy,69},{seventyOne,70},{seventyTwo,71},{seventyThree,72},{seventyFour,73},{seventyFive,74},{seventySix,75},{seventySeven,76},{seventyEight,77},{seventyNine,78},{eighty,79},{eightyOne,80},{eightyTwo,81},{eightyThree,82},{eightyFour,83},{eightyFive,84},{eightySix,85},{eightySeven,86},{eightyEight,87},{eightyNine,88},{ninety,89},{ninetyOne,90},{ninetyTwo,91},{ninetyThree,92},{ninetyFour,93},{ninetyFive,94},{ninetySix,95},{ninetySeven,96},{ninetyEight,97},{ninetyNine,98},{oneHundred,99},{oneHundredOne,100},{oneHundredTwo,101},{oneHundredThree,102},{oneHundredFour,103},{oneHundredFive,104},{oneHundredSix,105},{oneHundredSeven,106},{oneHundredEitht,107},{oneHundredNine,108},{oneHundredTen,109},{oneHundredEleven,110},{oneHundredTwelve,111},{oneHundredThirteen,112},{oneHundredFourteen,113},{oneHundredFifteen,114},{oneHundredSixteen,115},{oneHundredSeventeen,116},{oneHundredEithteen,117},{oneHundredNineteen,118},{oneHundredTwenty,119},{oneHundredTwentyOne,120},{oneHundredTwentyTwo,121},{oneHundredTwentyThree,122},{oneHundredTwentyFour,123},{oneHundredTwentyFive,124},{oneHundredTwentySix,125},{oneHundredTwentySeven,126},{oneHundredTwentyEight,127}],TagIn++[], no_length, OptOrMand). +'dec_KmeGroupMembers'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{one,0},{two,1},{three,2},{four,3},{five,4},{six,5},{seven,6},{eight,7},{nine,8},{ten,9},{eleven,10},{twelve,11},{thirteen,12},{fourteen,13},{fifteen,14},{sixteen,15},{seventeen,16},{eighteen,17},{nineteen,18},{twenty,19},{twentyOne,20},{twentyTwo,21},{twentyThree,22},{twentyFour,23},{twentyFive,24},{twentySix,25},{twentySeven,26},{twentyEight,27},{twentyNine,28},{thirty,29},{thirtyOne,30},{thirtyTwo,31},{thirtyThree,32},{thirtyFour,33},{thirtyFive,34},{thirtySix,35},{thirtySeven,36},{thirtyEight,37},{thirtyNine,38},{fourty,39},{fourtyOne,40},{fourtyTwo,41},{fourtyThree,42},{fourtyFour,43},{fourtyFive,44},{fourtySix,45},{fourtySeven,46},{fourtyEight,47},{fourtyNine,48},{fifty,49},{fiftyOne,50},{fiftyTwo,51},{fiftyThree,52},{fiftyFour,53},{fiftyFive,54},{fiftySix,55},{fiftySeven,56},{fiftyEight,57},{fiftyNine,58},{sixty,59},{sixtyOne,60},{sixtyTwo,61},{sixtyThree,62},{sixtyFour,63},{sixtyFive,64},{sixtySix,65},{sixtySeven,66},{sixtyEight,67},{sixtyNine,68},{seventy,69},{seventyOne,70},{seventyTwo,71},{seventyThree,72},{seventyFour,73},{seventyFive,74},{seventySix,75},{seventySeven,76},{seventyEight,77},{seventyNine,78},{eighty,79},{eightyOne,80},{eightyTwo,81},{eightyThree,82},{eightyFour,83},{eightyFive,84},{eightySix,85},{eightySeven,86},{eightyEight,87},{eightyNine,88},{ninety,89},{ninetyOne,90},{ninetyTwo,91},{ninetyThree,92},{ninetyFour,93},{ninetyFive,94},{ninetySix,95},{ninetySeven,96},{ninetyEight,97},{ninetyNine,98},{oneHundred,99},{oneHundredOne,100},{oneHundredTwo,101},{oneHundredThree,102},{oneHundredFour,103},{oneHundredFive,104},{oneHundredSix,105},{oneHundredSeven,106},{oneHundredEitht,107},{oneHundredNine,108},{oneHundredTen,109},{oneHundredEleven,110},{oneHundredTwelve,111},{oneHundredThirteen,112},{oneHundredFourteen,113},{oneHundredFifteen,114},{oneHundredSixteen,115},{oneHundredSeventeen,116},{oneHundredEithteen,117},{oneHundredNineteen,118},{oneHundredTwenty,119},{oneHundredTwentyOne,120},{oneHundredTwentyTwo,121},{oneHundredTwentyThree,122},{oneHundredTwentyFour,123},{oneHundredTwentyFive,124},{oneHundredTwentySix,125},{oneHundredTwentySeven,126},{oneHundredTwentyEight,127}], TagIn). %%================================ %% KmePckPagGroupList %%================================ - -'enc_KmePckPagGroupList'({'KmePckPagGroupList',Val}, TagIn) -> - 'enc_KmePckPagGroupList'(Val, TagIn); +'enc_KmePckPagGroupList'(Val) -> + 'enc_KmePckPagGroupList'(Val, [<<48>>]). 'enc_KmePckPagGroupList'(Val, TagIn) -> {EncBytes,EncLen} = 'enc_KmePckPagGroupList_components'(Val,[],0), - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], EncBytes, EncLen). + encode_tags(TagIn, EncBytes, EncLen). 'enc_KmePckPagGroupList_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_KmePckPagGroupList_components'([H|T],AccBytes, AccLen) -> - {EncBytes,EncLen} = 'enc_KmePckPagGroupList_SEQOF'(H, []), + {EncBytes,EncLen} = 'enc_KmePckPagGroupList_SEQOF'(H, [<<48>>]), 'enc_KmePckPagGroupList_components'(T,[EncBytes|AccBytes], AccLen + EncLen). @@ -2137,152 +2240,159 @@ end, %% KmePckPagGroupList_SEQOF %%================================ 'enc_KmePckPagGroupList_SEQOF'(Val, TagIn) -> - + {_,Cindex1, Cindex2} = Val, + %%------------------------------------------------- -%% attribute number 1 with type INTEGER +%% attribute groupNo(1) with type INTEGER %%------------------------------------------------- - {EncBytes1,EncLen1} = ?RT_BER:encode_integer([], ?RT_BER:cindex(2,Val,groupNo), [{tag,128,0,'EXPLICIT',32}]), + {EncBytes1,EncLen1} = encode_integer(Cindex1, [<<2>>,<<160>>]), %%------------------------------------------------- -%% attribute number 2 with type BIT STRING OPTIONAL +%% attribute memberList(2) with type BIT STRING OPTIONAL %%------------------------------------------------- - {EncBytes2,EncLen2} = case ?RT_BER:cindex(3,Val,memberList) of + {EncBytes2,EncLen2} = case Cindex2 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_bit_string([], ?RT_BER:cindex(3,Val,memberList), [{one,0},{two,1},{three,2},{four,3},{five,4},{six,5},{seven,6},{eight,7},{nine,8},{ten,9},{eleven,10},{twelve,11},{thirteen,12},{fourteen,13},{fifteen,14},{sixteen,15},{seventeen,16},{eighteen,17},{nineteen,18},{twenty,19},{twentyOne,20},{twentyTwo,21},{twentyThree,22},{twentyFour,23},{twentyFive,24},{twentySix,25},{twentySeven,26},{twentyEight,27},{twentyNine,28},{thirty,29},{thirtyOne,30},{thirtyTwo,31},{thirtyThree,32},{thirtyFour,33},{thirtyFive,34},{thirtySix,35},{thirtySeven,36},{thirtyEight,37},{thirtyNine,38},{fourty,39},{fourtyOne,40},{fourtyTwo,41},{fourtyThree,42},{fourtyFour,43},{fourtyFive,44},{fourtySix,45},{fourtySeven,46},{fourtyEight,47},{fourtyNine,48},{fifty,49},{fiftyOne,50},{fiftyTwo,51},{fiftyThree,52},{fiftyFour,53},{fiftyFive,54},{fiftySix,55},{fiftySeven,56},{fiftyEight,57},{fiftyNine,58},{sixty,59},{sixtyOne,60},{sixtyTwo,61},{sixtyThree,62},{sixtyFour,63},{sixtyFive,64},{sixtySix,65},{sixtySeven,66},{sixtyEight,67},{sixtyNine,68},{seventy,69},{seventyOne,70},{seventyTwo,71},{seventyThree,72},{seventyFour,73},{seventyFive,74},{seventySix,75},{seventySeven,76},{seventyEight,77},{seventyNine,78},{eighty,79},{eightyOne,80},{eightyTwo,81},{eightyThree,82},{eightyFour,83},{eightyFive,84},{eightySix,85},{eightySeven,86},{eightyEight,87},{eightyNine,88},{ninety,89},{ninetyOne,90},{ninetyTwo,91},{ninetyThree,92},{ninetyFour,93},{ninetyFive,94},{ninetySix,95},{ninetySeven,96},{ninetyEight,97},{ninetyNine,98},{oneHundred,99},{oneHundredOne,100},{oneHundredTwo,101},{oneHundredThree,102},{oneHundredFour,103},{oneHundredFive,104},{oneHundredSix,105},{oneHundredSeven,106},{oneHundredEitht,107},{oneHundredNine,108},{oneHundredTen,109},{oneHundredEleven,110},{oneHundredTwelve,111},{oneHundredThirteen,112},{oneHundredFourteen,113},{oneHundredFifteen,114},{oneHundredSixteen,115},{oneHundredSeventeen,116},{oneHundredEithteen,117},{oneHundredNineteen,118},{oneHundredTwenty,119},{oneHundredTwentyOne,120},{oneHundredTwentyTwo,121},{oneHundredTwentyThree,122},{oneHundredTwentyFour,123},{oneHundredTwentyFive,124},{oneHundredTwentySix,125},{oneHundredTwentySeven,126},{oneHundredTwentyEight,127}], [{tag,128,1,'EXPLICIT',32}]) + encode_named_bit_string(Cindex2, [{one,0},{two,1},{three,2},{four,3},{five,4},{six,5},{seven,6},{eight,7},{nine,8},{ten,9},{eleven,10},{twelve,11},{thirteen,12},{fourteen,13},{fifteen,14},{sixteen,15},{seventeen,16},{eighteen,17},{nineteen,18},{twenty,19},{twentyOne,20},{twentyTwo,21},{twentyThree,22},{twentyFour,23},{twentyFive,24},{twentySix,25},{twentySeven,26},{twentyEight,27},{twentyNine,28},{thirty,29},{thirtyOne,30},{thirtyTwo,31},{thirtyThree,32},{thirtyFour,33},{thirtyFive,34},{thirtySix,35},{thirtySeven,36},{thirtyEight,37},{thirtyNine,38},{fourty,39},{fourtyOne,40},{fourtyTwo,41},{fourtyThree,42},{fourtyFour,43},{fourtyFive,44},{fourtySix,45},{fourtySeven,46},{fourtyEight,47},{fourtyNine,48},{fifty,49},{fiftyOne,50},{fiftyTwo,51},{fiftyThree,52},{fiftyFour,53},{fiftyFive,54},{fiftySix,55},{fiftySeven,56},{fiftyEight,57},{fiftyNine,58},{sixty,59},{sixtyOne,60},{sixtyTwo,61},{sixtyThree,62},{sixtyFour,63},{sixtyFive,64},{sixtySix,65},{sixtySeven,66},{sixtyEight,67},{sixtyNine,68},{seventy,69},{seventyOne,70},{seventyTwo,71},{seventyThree,72},{seventyFour,73},{seventyFive,74},{seventySix,75},{seventySeven,76},{seventyEight,77},{seventyNine,78},{eighty,79},{eightyOne,80},{eightyTwo,81},{eightyThree,82},{eightyFour,83},{eightyFive,84},{eightySix,85},{eightySeven,86},{eightyEight,87},{eightyNine,88},{ninety,89},{ninetyOne,90},{ninetyTwo,91},{ninetyThree,92},{ninetyFour,93},{ninetyFive,94},{ninetySix,95},{ninetySeven,96},{ninetyEight,97},{ninetyNine,98},{oneHundred,99},{oneHundredOne,100},{oneHundredTwo,101},{oneHundredThree,102},{oneHundredFour,103},{oneHundredFive,104},{oneHundredSix,105},{oneHundredSeven,106},{oneHundredEitht,107},{oneHundredNine,108},{oneHundredTen,109},{oneHundredEleven,110},{oneHundredTwelve,111},{oneHundredThirteen,112},{oneHundredFourteen,113},{oneHundredFifteen,114},{oneHundredSixteen,115},{oneHundredSeventeen,116},{oneHundredEithteen,117},{oneHundredNineteen,118},{oneHundredTwenty,119},{oneHundredTwentyOne,120},{oneHundredTwentyTwo,121},{oneHundredTwentyThree,122},{oneHundredTwentyFour,123},{oneHundredTwentyFive,124},{oneHundredTwentySix,125},{oneHundredTwentySeven,126},{oneHundredTwentyEight,127}], [<<3>>,<<161>>]) end, BytesSoFar = [EncBytes1, EncBytes2], - LenSoFar = EncLen1 + EncLen2, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). -'dec_KmePckPagGroupList_SEQOF'(Bytes, OptOrMand, TagIn) -> +LenSoFar = EncLen1 + EncLen2, +encode_tags(TagIn, BytesSoFar, LenSoFar). + + +'dec_KmePckPagGroupList'(Tlv) -> + 'dec_KmePckPagGroupList'(Tlv, [16]). + +'dec_KmePckPagGroupList'(Tlv, TagIn) -> + %%------------------------------------------------- + %% decode tag and length + %%------------------------------------------------- +Tlv1 = match_tags(Tlv, TagIn), +['dec_KmePckPagGroupList_SEQOF'(V1, [16]) || V1 <- Tlv1]. + + +'dec_KmePckPagGroupList_SEQOF'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 with type INTEGER +%% attribute groupNo(1) with type INTEGER %%------------------------------------------------- - {Term1,Bytes3,Rb2} = ?RT_BER:decode_integer(Bytes2,[],[{tag,128,0,'EXPLICIT',32}], mandatory), +[V1|Tlv2] = Tlv1, +Term1 = decode_integer(V1, [131072,2]), %%------------------------------------------------- -%% attribute number 2 with type BIT STRING OPTIONAL +%% attribute memberList(2) with type BIT STRING OPTIONAL %%------------------------------------------------- - {Term2,Bytes4,Rb3} = case Bytes3 of -<<2:2,_:1,1:5,_/binary>> -> -?RT_BER:decode_bit_string(Bytes3,[],[{one,0},{two,1},{three,2},{four,3},{five,4},{six,5},{seven,6},{eight,7},{nine,8},{ten,9},{eleven,10},{twelve,11},{thirteen,12},{fourteen,13},{fifteen,14},{sixteen,15},{seventeen,16},{eighteen,17},{nineteen,18},{twenty,19},{twentyOne,20},{twentyTwo,21},{twentyThree,22},{twentyFour,23},{twentyFive,24},{twentySix,25},{twentySeven,26},{twentyEight,27},{twentyNine,28},{thirty,29},{thirtyOne,30},{thirtyTwo,31},{thirtyThree,32},{thirtyFour,33},{thirtyFive,34},{thirtySix,35},{thirtySeven,36},{thirtyEight,37},{thirtyNine,38},{fourty,39},{fourtyOne,40},{fourtyTwo,41},{fourtyThree,42},{fourtyFour,43},{fourtyFive,44},{fourtySix,45},{fourtySeven,46},{fourtyEight,47},{fourtyNine,48},{fifty,49},{fiftyOne,50},{fiftyTwo,51},{fiftyThree,52},{fiftyFour,53},{fiftyFive,54},{fiftySix,55},{fiftySeven,56},{fiftyEight,57},{fiftyNine,58},{sixty,59},{sixtyOne,60},{sixtyTwo,61},{sixtyThree,62},{sixtyFour,63},{sixtyFive,64},{sixtySix,65},{sixtySeven,66},{sixtyEight,67},{sixtyNine,68},{seventy,69},{seventyOne,70},{seventyTwo,71},{seventyThree,72},{seventyFour,73},{seventyFive,74},{seventySix,75},{seventySeven,76},{seventyEight,77},{seventyNine,78},{eighty,79},{eightyOne,80},{eightyTwo,81},{eightyThree,82},{eightyFour,83},{eightyFive,84},{eightySix,85},{eightySeven,86},{eightyEight,87},{eightyNine,88},{ninety,89},{ninetyOne,90},{ninetyTwo,91},{ninetyThree,92},{ninetyFour,93},{ninetyFive,94},{ninetySix,95},{ninetySeven,96},{ninetyEight,97},{ninetyNine,98},{oneHundred,99},{oneHundredOne,100},{oneHundredTwo,101},{oneHundredThree,102},{oneHundredFour,103},{oneHundredFive,104},{oneHundredSix,105},{oneHundredSeven,106},{oneHundredEitht,107},{oneHundredNine,108},{oneHundredTen,109},{oneHundredEleven,110},{oneHundredTwelve,111},{oneHundredThirteen,112},{oneHundredFourteen,113},{oneHundredFifteen,114},{oneHundredSixteen,115},{oneHundredSeventeen,116},{oneHundredEithteen,117},{oneHundredNineteen,118},{oneHundredTwenty,119},{oneHundredTwentyOne,120},{oneHundredTwentyTwo,121},{oneHundredTwentyThree,122},{oneHundredTwentyFour,123},{oneHundredTwentyFive,124},{oneHundredTwentySix,125},{oneHundredTwentySeven,126},{oneHundredTwentyEight,127}],[{tag,128,1,'EXPLICIT',32}], no_length, mandatory); -_ -> -{ asn1_NOVALUE, Bytes3, 0 } +{Term2,Tlv3} = case Tlv2 of +[{131073,V2}|TempTlv3] -> + {decode_named_bit_string(V2, [{one,0},{two,1},{three,2},{four,3},{five,4},{six,5},{seven,6},{eight,7},{nine,8},{ten,9},{eleven,10},{twelve,11},{thirteen,12},{fourteen,13},{fifteen,14},{sixteen,15},{seventeen,16},{eighteen,17},{nineteen,18},{twenty,19},{twentyOne,20},{twentyTwo,21},{twentyThree,22},{twentyFour,23},{twentyFive,24},{twentySix,25},{twentySeven,26},{twentyEight,27},{twentyNine,28},{thirty,29},{thirtyOne,30},{thirtyTwo,31},{thirtyThree,32},{thirtyFour,33},{thirtyFive,34},{thirtySix,35},{thirtySeven,36},{thirtyEight,37},{thirtyNine,38},{fourty,39},{fourtyOne,40},{fourtyTwo,41},{fourtyThree,42},{fourtyFour,43},{fourtyFive,44},{fourtySix,45},{fourtySeven,46},{fourtyEight,47},{fourtyNine,48},{fifty,49},{fiftyOne,50},{fiftyTwo,51},{fiftyThree,52},{fiftyFour,53},{fiftyFive,54},{fiftySix,55},{fiftySeven,56},{fiftyEight,57},{fiftyNine,58},{sixty,59},{sixtyOne,60},{sixtyTwo,61},{sixtyThree,62},{sixtyFour,63},{sixtyFive,64},{sixtySix,65},{sixtySeven,66},{sixtyEight,67},{sixtyNine,68},{seventy,69},{seventyOne,70},{seventyTwo,71},{seventyThree,72},{seventyFour,73},{seventyFive,74},{seventySix,75},{seventySeven,76},{seventyEight,77},{seventyNine,78},{eighty,79},{eightyOne,80},{eightyTwo,81},{eightyThree,82},{eightyFour,83},{eightyFive,84},{eightySix,85},{eightySeven,86},{eightyEight,87},{eightyNine,88},{ninety,89},{ninetyOne,90},{ninetyTwo,91},{ninetyThree,92},{ninetyFour,93},{ninetyFive,94},{ninetySix,95},{ninetySeven,96},{ninetyEight,97},{ninetyNine,98},{oneHundred,99},{oneHundredOne,100},{oneHundredTwo,101},{oneHundredThree,102},{oneHundredFour,103},{oneHundredFive,104},{oneHundredSix,105},{oneHundredSeven,106},{oneHundredEitht,107},{oneHundredNine,108},{oneHundredTen,109},{oneHundredEleven,110},{oneHundredTwelve,111},{oneHundredThirteen,112},{oneHundredFourteen,113},{oneHundredFifteen,114},{oneHundredSixteen,115},{oneHundredSeventeen,116},{oneHundredEithteen,117},{oneHundredNineteen,118},{oneHundredTwenty,119},{oneHundredTwentyOne,120},{oneHundredTwentyTwo,121},{oneHundredTwentyThree,122},{oneHundredTwentyFour,123},{oneHundredTwentyFive,124},{oneHundredTwentySix,125},{oneHundredTwentySeven,126},{oneHundredTwentyEight,127}], [3]), TempTlv3}; + _ -> + { asn1_NOVALUE, Tlv2} end, - {Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext), - {{'KmePckPagGroupList_SEQOF', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}. - - -'dec_KmePckPagGroupList'(Bytes, OptOrMand) -> - 'dec_KmePckPagGroupList'(Bytes, OptOrMand, []). - -'dec_KmePckPagGroupList'(Bytes, OptOrMand, TagIn) -> - %%------------------------------------------------- - %% decode tag and length - %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), - ?RT_BER:decode_components(Rb1, Len, Bytes1, fun 'dec_KmePckPagGroupList_SEQOF'/3, [], []). - +case Tlv3 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed +end, + {'KmePckPagGroupList_SEQOF', Term1, Term2}. %%================================ %% KmeIcmGrpMembers %%================================ +'enc_KmeIcmGrpMembers'(Val) -> + 'enc_KmeIcmGrpMembers'(Val, [<<48>>]). + 'enc_KmeIcmGrpMembers'(Val, TagIn) -> +{_,Cindex1, Cindex2} = Val, %%------------------------------------------------- -%% attribute number 1 External CSTA-device-identifiers:DeviceID +%% attribute grpDevice(1) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {EncBytes1,EncLen1} = 'CSTA-device-identifiers':'enc_DeviceID'(?RT_BER:cindex(2,Val,grpDevice), [{tag,128,0,'IMPLICIT',32}]), + {EncBytes1,EncLen1} = 'CSTA-device-identifiers':'enc_DeviceID'(Cindex1, [<<160>>]), %%------------------------------------------------- -%% attribute number 2 with type SEQUENCE OF +%% attribute members(2) with type SEQUENCE OF %%------------------------------------------------- - {EncBytes2,EncLen2} = 'enc_KmeIcmGrpMembers_members'(?RT_BER:cindex(3,Val,members), [{tag,128,1,'IMPLICIT',32}]), + {EncBytes2,EncLen2} = 'enc_KmeIcmGrpMembers_members'(Cindex2, [<<161>>]), BytesSoFar = [EncBytes1, EncBytes2], - LenSoFar = EncLen1 + EncLen2, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2, +encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% KmeIcmGrpMembers_members %%================================ - -'enc_KmeIcmGrpMembers_members'({'KmeIcmGrpMembers_members',Val}, TagIn) -> - 'enc_KmeIcmGrpMembers_members'(Val, TagIn); - 'enc_KmeIcmGrpMembers_members'(Val, TagIn) -> {EncBytes,EncLen} = 'enc_KmeIcmGrpMembers_members_components'(Val,[],0), - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], EncBytes, EncLen). + encode_tags(TagIn, EncBytes, EncLen). 'enc_KmeIcmGrpMembers_members_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_KmeIcmGrpMembers_members_components'([H|T],AccBytes, AccLen) -> - {EncBytes,EncLen} = 'CSTA-device-identifiers':'enc_DeviceID'(H, []), + {EncBytes,EncLen} = 'CSTA-device-identifiers':'enc_DeviceID'(H, [<<48>>]), 'enc_KmeIcmGrpMembers_members_components'(T,[EncBytes|AccBytes], AccLen + EncLen). -'dec_KmeIcmGrpMembers_members'(Bytes, OptOrMand, TagIn) -> - %%------------------------------------------------- - %% decode tag and length - %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), - ?RT_BER:decode_components(Rb1, Len, Bytes1, fun 'CSTA-device-identifiers':'dec_DeviceID'/3, [], []). - - -'dec_KmeIcmGrpMembers'(Bytes, OptOrMand) -> - 'dec_KmeIcmGrpMembers'(Bytes, OptOrMand, []). +'dec_KmeIcmGrpMembers'(Tlv) -> + 'dec_KmeIcmGrpMembers'(Tlv, [16]). -'dec_KmeIcmGrpMembers'(Bytes, OptOrMand, TagIn) -> +'dec_KmeIcmGrpMembers'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 External CSTA-device-identifiers:DeviceID +%% attribute grpDevice(1) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {Term1,Bytes3,Rb2} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes2, mandatory, [{tag,128,0,'IMPLICIT',32}]), +[V1|Tlv2] = Tlv1, +Term1 = 'CSTA-device-identifiers':'dec_DeviceID'(V1, [131072]), %%------------------------------------------------- -%% attribute number 2 with type SEQUENCE OF +%% attribute members(2) with type SEQUENCE OF %%------------------------------------------------- - {Term2,Bytes4,Rb3} = 'dec_KmeIcmGrpMembers_members'(Bytes3, mandatory, [{tag,128,1,'IMPLICIT',32}]), +[V2|Tlv3] = Tlv2, +Term2 = 'dec_KmeIcmGrpMembers_members'(V2, [131073]), - {Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext), - {{'KmeIcmGrpMembers', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}. +case Tlv3 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed +end, + {'KmeIcmGrpMembers', Term1, Term2}. + +'dec_KmeIcmGrpMembers_members'(Tlv, TagIn) -> + %%------------------------------------------------- + %% decode tag and length + %%------------------------------------------------- +Tlv1 = match_tags(Tlv, TagIn), +['CSTA-device-identifiers':'dec_DeviceID'(V1, [16]) || V1 <- Tlv1]. -%%================================ -%% KmeIncomingGroupList -%%================================ -'enc_KmeIncomingGroupList'({'KmeIncomingGroupList',Val}, TagIn) -> - 'enc_KmeIncomingGroupList'(Val, TagIn); + +%%================================ +%% KmeIncomingGroupList +%%================================ +'enc_KmeIncomingGroupList'(Val) -> + 'enc_KmeIncomingGroupList'(Val, [<<48>>]). 'enc_KmeIncomingGroupList'(Val, TagIn) -> {EncBytes,EncLen} = 'enc_KmeIncomingGroupList_components'(Val,[],0), - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], EncBytes, EncLen). + encode_tags(TagIn, EncBytes, EncLen). 'enc_KmeIncomingGroupList_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_KmeIncomingGroupList_components'([H|T],AccBytes, AccLen) -> - {EncBytes,EncLen} = 'enc_KmeIncomingGroupList_SEQOF'(H, []), + {EncBytes,EncLen} = 'enc_KmeIncomingGroupList_SEQOF'(H, [<<48>>]), 'enc_KmeIncomingGroupList_components'(T,[EncBytes|AccBytes], AccLen + EncLen). @@ -2292,208 +2402,234 @@ end, %% KmeIncomingGroupList_SEQOF %%================================ 'enc_KmeIncomingGroupList_SEQOF'(Val, TagIn) -> - + {_,Cindex1, Cindex2, Cindex3, Cindex4, Cindex5, Cindex6, Cindex7, Cindex8} = Val, + %%------------------------------------------------- -%% attribute number 1 with type INTEGER +%% attribute groupNo(1) with type INTEGER %%------------------------------------------------- - {EncBytes1,EncLen1} = ?RT_BER:encode_integer([], ?RT_BER:cindex(2,Val,groupNo), [{tag,128,0,'EXPLICIT',32}]), + {EncBytes1,EncLen1} = encode_integer(Cindex1, [<<2>>,<<160>>]), %%------------------------------------------------- -%% attribute number 2 External CSTA-device-identifiers:DeviceID +%% attribute device(2) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {EncBytes2,EncLen2} = 'CSTA-device-identifiers':'enc_DeviceID'(?RT_BER:cindex(3,Val,device), [{tag,128,1,'EXPLICIT',32}]), + {EncBytes2,EncLen2} = 'CSTA-device-identifiers':'enc_DeviceID'(Cindex2, [<<48>>,<<161>>]), %%------------------------------------------------- -%% attribute number 3 with type CHOICE OPTIONAL +%% attribute name(3) with type CHOICE OPTIONAL %%------------------------------------------------- - {EncBytes3,EncLen3} = case ?RT_BER:cindex(4,Val,name) of + {EncBytes3,EncLen3} = case Cindex3 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_KmeIncomingGroupList_SEQOF_name'(?RT_BER:cindex(4,Val,name), [{tag,128,2,'EXPLICIT',32}]) + 'enc_KmeIncomingGroupList_SEQOF_name'(Cindex3, [<<162>>]) end, %%------------------------------------------------- -%% attribute number 4 with type IA5String OPTIONAL +%% attribute extNo(4) with type IA5String OPTIONAL %%------------------------------------------------- - {EncBytes4,EncLen4} = case ?RT_BER:cindex(5,Val,extNo) of + {EncBytes4,EncLen4} = case Cindex4 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_restricted_string([], ?RT_BER:cindex(5,Val,extNo), 22, [{tag,128,3,'EXPLICIT',32}]) + encode_restricted_string(Cindex4, [<<22>>,<<163>>]) end, %%------------------------------------------------- -%% attribute number 5 with type ENUMERATED +%% attribute groupType(5) with type ENUMERATED %%------------------------------------------------- - {EncBytes5,EncLen5} = case (case ?RT_BER:cindex(6,Val,groupType) of {_,Enumval3}->Enumval3;_->?RT_BER:cindex(6,Val,groupType) end) of -ucd -> ?RT_BER:encode_enumerated(0,[{tag,128,4,'EXPLICIT',32}]); -ring -> ?RT_BER:encode_enumerated(1,[{tag,128,4,'EXPLICIT',32}]); -hunt -> ?RT_BER:encode_enumerated(2,[{tag,128,4,'EXPLICIT',32}]); -Enumval4 -> exit({error,{asn1, {enumerated_not_in_range,Enumval4}}}) + {EncBytes5,EncLen5} = case Cindex5 of +ucd -> encode_tags([<<10>>,<<164>>], [0], 1); +ring -> encode_tags([<<10>>,<<164>>], [1], 1); +hunt -> encode_tags([<<10>>,<<164>>], [2], 1); +Enumval3 -> exit({error,{asn1, {enumerated_not_in_range,Enumval3}}}) end, %%------------------------------------------------- -%% attribute number 6 with type BOOLEAN +%% attribute acdMode(6) with type BOOLEAN %%------------------------------------------------- - {EncBytes6,EncLen6} = ?RT_BER:encode_boolean(?RT_BER:cindex(7,Val,acdMode), [{tag,128,5,'EXPLICIT',32}]), + {EncBytes6,EncLen6} = encode_boolean(Cindex6, [<<1>>,<<165>>]), %%------------------------------------------------- -%% attribute number 7 with type INTEGER +%% attribute ctiWaitTime(7) with type INTEGER %%------------------------------------------------- - {EncBytes7,EncLen7} = ?RT_BER:encode_integer([], ?RT_BER:cindex(8,Val,ctiWaitTime), [{tag,128,6,'EXPLICIT',32}]), + {EncBytes7,EncLen7} = encode_integer(Cindex7, [<<2>>,<<166>>]), %%------------------------------------------------- -%% attribute number 8 with type INTEGER OPTIONAL +%% attribute queueSize(8) with type INTEGER OPTIONAL %%------------------------------------------------- - {EncBytes8,EncLen8} = case ?RT_BER:cindex(9,Val,queueSize) of + {EncBytes8,EncLen8} = case Cindex8 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_integer([], ?RT_BER:cindex(9,Val,queueSize), [{tag,128,7,'EXPLICIT',32}]) + encode_integer(Cindex8, [<<2>>,<<167>>]) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4, EncBytes5, EncBytes6, EncBytes7, EncBytes8], - LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5 + EncLen6 + EncLen7 + EncLen8, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5 + EncLen6 + EncLen7 + EncLen8, +encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% KmeIncomingGroupList_SEQOF_name %%================================ - -'enc_KmeIncomingGroupList_SEQOF_name'({'KmeIncomingGroupList_SEQOF_name',Val}, TagIn) -> - 'enc_KmeIncomingGroupList_SEQOF_name'(Val, TagIn); - 'enc_KmeIncomingGroupList_SEQOF_name'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of single -> - ?RT_BER:encode_octet_string([], element(2,Val), [{tag,128,0,'EXPLICIT',32}]); + encode_restricted_string(element(2,Val), [<<4>>,<<160>>]); wide -> - ?RT_BER:encode_octet_string([], element(2,Val), [{tag,128,1,'EXPLICIT',32}]); + encode_restricted_string(element(2,Val), [<<4>>,<<161>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). +encode_tags(TagIn, EncBytes, EncLen). -'dec_KmeIncomingGroupList_SEQOF_name'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of -%% 'single' - <<2:2,_:1,0:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_octet_string(Bytes1,{1,20},[{tag,128,0,'EXPLICIT',32}], no_length, mandatory), - {{single, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; +'dec_KmeIncomingGroupList'(Tlv) -> + 'dec_KmeIncomingGroupList'(Tlv, [16]). -%% 'wide' - <<2:2,_:1,1:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_octet_string(Bytes1,{1,40},[{tag,128,1,'EXPLICIT',32}], no_length, mandatory), - {{wide, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; +'dec_KmeIncomingGroupList'(Tlv, TagIn) -> + %%------------------------------------------------- + %% decode tag and length + %%------------------------------------------------- +Tlv1 = match_tags(Tlv, TagIn), +['dec_KmeIncomingGroupList_SEQOF'(V1, [16]) || V1 <- Tlv1]. - Else -> - case OptOrMand of - mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}}); - _ ->exit({error,{asn1,{no_optional_tag,Else}}}) - end - end. -'dec_KmeIncomingGroupList_SEQOF'(Bytes, OptOrMand, TagIn) -> + +'dec_KmeIncomingGroupList_SEQOF'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 with type INTEGER +%% attribute groupNo(1) with type INTEGER %%------------------------------------------------- - {Term1,Bytes3,Rb2} = ?RT_BER:decode_integer(Bytes2,[],[{tag,128,0,'EXPLICIT',32}], mandatory), +[V1|Tlv2] = Tlv1, +Term1 = decode_integer(V1, [131072,2]), %%------------------------------------------------- -%% attribute number 2 External CSTA-device-identifiers:DeviceID +%% attribute device(2) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {Term2,Bytes4,Rb3} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes3, mandatory, [{tag,128,1,'EXPLICIT',32}]), +[V2|Tlv3] = Tlv2, +Term2 = 'CSTA-device-identifiers':'dec_DeviceID'(V2, [131073,16]), %%------------------------------------------------- -%% attribute number 3 with type CHOICE OPTIONAL +%% attribute name(3) with type CHOICE OPTIONAL %%------------------------------------------------- - {Term3,Bytes5,Rb4} = case Bytes4 of -<<2:2,_:1,2:5,_/binary>> -> -'dec_KmeIncomingGroupList_SEQOF_name'(Bytes4, opt_or_default, [{tag,128,2,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes4, 0 } +{Term3,Tlv4} = case Tlv3 of +[{131074,V3}|TempTlv4] -> + {'dec_KmeIncomingGroupList_SEQOF_name'(V3, []), TempTlv4}; + _ -> + { asn1_NOVALUE, Tlv3} end, %%------------------------------------------------- -%% attribute number 4 with type IA5String OPTIONAL +%% attribute extNo(4) with type IA5String OPTIONAL %%------------------------------------------------- - {Term4,Bytes6,Rb5} = case Bytes5 of -<<2:2,_:1,3:5,_/binary>> -> -?RT_BER:decode_restricted_string(Bytes5,{1,5},22,[{tag,128,3,'EXPLICIT',32}], no_length, mandatory); -_ -> -{ asn1_NOVALUE, Bytes5, 0 } +{Term4,Tlv5} = case Tlv4 of +[{131075,V4}|TempTlv5] -> + {begin +Val1 = decode_restricted_string(V4, [22]), +C1 = byte_size(Val1), +if 1 =< C1, C1 =< 5 -> +binary_to_list(Val1); +true -> +exit({error,{asn1,bad_range}}) +end +end, TempTlv5}; + _ -> + { asn1_NOVALUE, Tlv4} end, %%------------------------------------------------- -%% attribute number 5 with type ENUMERATED +%% attribute groupType(5) with type ENUMERATED %%------------------------------------------------- - {Term5,Bytes7,Rb6} = ?RT_BER:decode_enumerated(Bytes6,[],[{ucd,0},{ring,1},{hunt,2}],[{tag,128,4,'EXPLICIT',32}], mandatory), +[V5|Tlv6] = Tlv5, +Term5 = case decode_integer(V5, [131076,10]) of +0 -> ucd; +1 -> ring; +2 -> hunt; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end, %%------------------------------------------------- -%% attribute number 6 with type BOOLEAN +%% attribute acdMode(6) with type BOOLEAN %%------------------------------------------------- - {Term6,Bytes8,Rb7} = ?RT_BER:decode_boolean(Bytes7,[{tag,128,5,'EXPLICIT',32}], mandatory), +[V6|Tlv7] = Tlv6, +Term6 = decode_boolean(V6, [131077,1]), %%------------------------------------------------- -%% attribute number 7 with type INTEGER +%% attribute ctiWaitTime(7) with type INTEGER %%------------------------------------------------- - {Term7,Bytes9,Rb8} = ?RT_BER:decode_integer(Bytes8,[],[{tag,128,6,'EXPLICIT',32}], mandatory), +[V7|Tlv8] = Tlv7, +Term7 = decode_integer(V7, [131078,2]), %%------------------------------------------------- -%% attribute number 8 with type INTEGER OPTIONAL +%% attribute queueSize(8) with type INTEGER OPTIONAL %%------------------------------------------------- - {Term8,Bytes10,Rb9} = case Bytes9 of -<<2:2,_:1,7:5,_/binary>> -> -?RT_BER:decode_integer(Bytes9,[],[{tag,128,7,'EXPLICIT',32}], mandatory); -_ -> -{ asn1_NOVALUE, Bytes9, 0 } +{Term8,Tlv9} = case Tlv8 of +[{131079,V8}|TempTlv9] -> + {decode_integer(V8, [2]), TempTlv9}; + _ -> + { asn1_NOVALUE, Tlv8} end, - {Bytes11,Rb10} = ?RT_BER:restbytes2(RemBytes, Bytes10,noext), - {{'KmeIncomingGroupList_SEQOF', Term1, Term2, Term3, Term4, Term5, Term6, Term7, Term8}, Bytes11, Rb1+Rb2+Rb3+Rb4+Rb5+Rb6+Rb7+Rb8+Rb9+Rb10}. +case Tlv9 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv9}}}) % extra fields not allowed +end, + {'KmeIncomingGroupList_SEQOF', Term1, Term2, Term3, Term4, Term5, Term6, Term7, Term8}. +'dec_KmeIncomingGroupList_SEQOF_name'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of -'dec_KmeIncomingGroupList'(Bytes, OptOrMand) -> - 'dec_KmeIncomingGroupList'(Bytes, OptOrMand, []). +%% 'single' + {131072, V1} -> + {single, begin +Val1 = decode_octet_string(V1, [4]), +C1 = byte_size(Val1), +if 1 =< C1, C1 =< 20 -> +Val1; +true -> +exit({error,{asn1,bad_range}}) +end +end}; -'dec_KmeIncomingGroupList'(Bytes, OptOrMand, TagIn) -> - %%------------------------------------------------- - %% decode tag and length - %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), - ?RT_BER:decode_components(Rb1, Len, Bytes1, fun 'dec_KmeIncomingGroupList_SEQOF'/3, [], []). +%% 'wide' + {131073, V1} -> + {wide, begin +Val2 = decode_octet_string(V1, [4]), +C2 = byte_size(Val2), +if 1 =< C2, C2 =< 40 -> +Val2; +true -> +exit({error,{asn1,bad_range}}) +end +end}; + Else -> + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. %%================================ %% KmeDoorPhone %%================================ - -'enc_KmeDoorPhone'({'KmeDoorPhone',Val}, TagIn) -> - 'enc_KmeDoorPhone'(Val, TagIn); +'enc_KmeDoorPhone'(Val) -> + 'enc_KmeDoorPhone'(Val, [<<48>>]). 'enc_KmeDoorPhone'(Val, TagIn) -> {EncBytes,EncLen} = 'enc_KmeDoorPhone_components'(Val,[],0), - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], EncBytes, EncLen). + encode_tags(TagIn, EncBytes, EncLen). 'enc_KmeDoorPhone_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_KmeDoorPhone_components'([H|T],AccBytes, AccLen) -> - {EncBytes,EncLen} = 'enc_KmeDoorPhone_SEQOF'(H, []), + {EncBytes,EncLen} = 'enc_KmeDoorPhone_SEQOF'(H, [<<48>>]), 'enc_KmeDoorPhone_components'(T,[EncBytes|AccBytes], AccLen + EncLen). @@ -2503,181 +2639,205 @@ end, %% KmeDoorPhone_SEQOF %%================================ 'enc_KmeDoorPhone_SEQOF'(Val, TagIn) -> - + {_,Cindex1, Cindex2, Cindex3} = Val, + %%------------------------------------------------- -%% attribute number 1 with type IA5String +%% attribute doorPhoneNo(1) with type IA5String %%------------------------------------------------- - {EncBytes1,EncLen1} = ?RT_BER:encode_restricted_string([], ?RT_BER:cindex(2,Val,doorPhoneNo), 22, [{tag,128,0,'EXPLICIT',32}]), + {EncBytes1,EncLen1} = encode_restricted_string(Cindex1, [<<22>>,<<160>>]), %%------------------------------------------------- -%% attribute number 2 External CSTA-device-identifiers:DeviceID +%% attribute device(2) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {EncBytes2,EncLen2} = 'CSTA-device-identifiers':'enc_DeviceID'(?RT_BER:cindex(3,Val,device), [{tag,128,1,'EXPLICIT',32}]), + {EncBytes2,EncLen2} = 'CSTA-device-identifiers':'enc_DeviceID'(Cindex2, [<<48>>,<<161>>]), %%------------------------------------------------- -%% attribute number 3 with type CHOICE OPTIONAL +%% attribute name(3) with type CHOICE OPTIONAL %%------------------------------------------------- - {EncBytes3,EncLen3} = case ?RT_BER:cindex(4,Val,name) of + {EncBytes3,EncLen3} = case Cindex3 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_KmeDoorPhone_SEQOF_name'(?RT_BER:cindex(4,Val,name), [{tag,128,2,'EXPLICIT',32}]) + 'enc_KmeDoorPhone_SEQOF_name'(Cindex3, [<<162>>]) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3], - LenSoFar = EncLen1 + EncLen2 + EncLen3, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2 + EncLen3, +encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% KmeDoorPhone_SEQOF_name %%================================ - -'enc_KmeDoorPhone_SEQOF_name'({'KmeDoorPhone_SEQOF_name',Val}, TagIn) -> - 'enc_KmeDoorPhone_SEQOF_name'(Val, TagIn); - 'enc_KmeDoorPhone_SEQOF_name'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of single -> - ?RT_BER:encode_octet_string([], element(2,Val), [{tag,128,0,'EXPLICIT',32}]); + encode_restricted_string(element(2,Val), [<<4>>,<<160>>]); wide -> - ?RT_BER:encode_octet_string([], element(2,Val), [{tag,128,1,'EXPLICIT',32}]); + encode_restricted_string(element(2,Val), [<<4>>,<<161>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). +encode_tags(TagIn, EncBytes, EncLen). -'dec_KmeDoorPhone_SEQOF_name'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of -%% 'single' - <<2:2,_:1,0:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_octet_string(Bytes1,{1,20},[{tag,128,0,'EXPLICIT',32}], no_length, mandatory), - {{single, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; +'dec_KmeDoorPhone'(Tlv) -> + 'dec_KmeDoorPhone'(Tlv, [16]). -%% 'wide' - <<2:2,_:1,1:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_octet_string(Bytes1,{1,40},[{tag,128,1,'EXPLICIT',32}], no_length, mandatory), - {{wide, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; +'dec_KmeDoorPhone'(Tlv, TagIn) -> + %%------------------------------------------------- + %% decode tag and length + %%------------------------------------------------- +Tlv1 = match_tags(Tlv, TagIn), +['dec_KmeDoorPhone_SEQOF'(V1, [16]) || V1 <- Tlv1]. - Else -> - case OptOrMand of - mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}}); - _ ->exit({error,{asn1,{no_optional_tag,Else}}}) - end - end. -'dec_KmeDoorPhone_SEQOF'(Bytes, OptOrMand, TagIn) -> + +'dec_KmeDoorPhone_SEQOF'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 with type IA5String +%% attribute doorPhoneNo(1) with type IA5String %%------------------------------------------------- - {Term1,Bytes3,Rb2} = ?RT_BER:decode_restricted_string(Bytes2,{1,2},22,[{tag,128,0,'EXPLICIT',32}], no_length, mandatory), +[V1|Tlv2] = Tlv1, +Term1 = begin +Val1 = decode_restricted_string(V1, [131072,22]), +C1 = byte_size(Val1), +if 1 =< C1, C1 =< 2 -> +binary_to_list(Val1); +true -> +exit({error,{asn1,bad_range}}) +end +end, %%------------------------------------------------- -%% attribute number 2 External CSTA-device-identifiers:DeviceID +%% attribute device(2) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {Term2,Bytes4,Rb3} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes3, mandatory, [{tag,128,1,'EXPLICIT',32}]), +[V2|Tlv3] = Tlv2, +Term2 = 'CSTA-device-identifiers':'dec_DeviceID'(V2, [131073,16]), %%------------------------------------------------- -%% attribute number 3 with type CHOICE OPTIONAL +%% attribute name(3) with type CHOICE OPTIONAL %%------------------------------------------------- - {Term3,Bytes5,Rb4} = case Bytes4 of -<<2:2,_:1,2:5,_/binary>> -> -'dec_KmeDoorPhone_SEQOF_name'(Bytes4, opt_or_default, [{tag,128,2,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes4, 0 } +{Term3,Tlv4} = case Tlv3 of +[{131074,V3}|TempTlv4] -> + {'dec_KmeDoorPhone_SEQOF_name'(V3, []), TempTlv4}; + _ -> + { asn1_NOVALUE, Tlv3} end, - {Bytes6,Rb5} = ?RT_BER:restbytes2(RemBytes, Bytes5,noext), - {{'KmeDoorPhone_SEQOF', Term1, Term2, Term3}, Bytes6, Rb1+Rb2+Rb3+Rb4+Rb5}. +case Tlv4 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowed +end, + {'KmeDoorPhone_SEQOF', Term1, Term2, Term3}. +'dec_KmeDoorPhone_SEQOF_name'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of -'dec_KmeDoorPhone'(Bytes, OptOrMand) -> - 'dec_KmeDoorPhone'(Bytes, OptOrMand, []). +%% 'single' + {131072, V1} -> + {single, begin +Val1 = decode_octet_string(V1, [4]), +C1 = byte_size(Val1), +if 1 =< C1, C1 =< 20 -> +Val1; +true -> +exit({error,{asn1,bad_range}}) +end +end}; -'dec_KmeDoorPhone'(Bytes, OptOrMand, TagIn) -> - %%------------------------------------------------- - %% decode tag and length - %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), - ?RT_BER:decode_components(Rb1, Len, Bytes1, fun 'dec_KmeDoorPhone_SEQOF'/3, [], []). +%% 'wide' + {131073, V1} -> + {wide, begin +Val2 = decode_octet_string(V1, [4]), +C2 = byte_size(Val2), +if 1 =< C2, C2 =< 40 -> +Val2; +true -> +exit({error,{asn1,bad_range}}) +end +end}; + Else -> + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. %%================================ %% KmeVmGroup %%================================ - -'enc_KmeVmGroup'({'KmeVmGroup',Val}, TagIn) -> - 'enc_KmeVmGroup'(Val, TagIn); +'enc_KmeVmGroup'(Val) -> + 'enc_KmeVmGroup'(Val, [<<10>>]). 'enc_KmeVmGroup'(Val, TagIn) -> -case (case Val of {_,Enumval1}->Enumval1;_->Val end) of -dpt -> ?RT_BER:encode_enumerated(0,TagIn ++ []); -dtmf -> ?RT_BER:encode_enumerated(1,TagIn ++ []); -Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) +case Val of +dpt -> encode_tags(TagIn, [0], 1); +dtmf -> encode_tags(TagIn, [1], 1); +Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}}) end. -'dec_KmeVmGroup'(Bytes, OptOrMand) -> - 'dec_KmeVmGroup'(Bytes, OptOrMand, []). +'dec_KmeVmGroup'(Tlv) -> + 'dec_KmeVmGroup'(Tlv, [10]). -'dec_KmeVmGroup'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_enumerated(Bytes,[],[{dpt,0},{dtmf,1}],TagIn++[], OptOrMand). +'dec_KmeVmGroup'(Tlv, TagIn) -> +case decode_integer(Tlv, TagIn) of +0 -> dpt; +1 -> dtmf; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end. %%================================ %% KmeVmDtmfType %%================================ - -'enc_KmeVmDtmfType'({'KmeVmDtmfType',Val}, TagIn) -> - 'enc_KmeVmDtmfType'(Val, TagIn); +'enc_KmeVmDtmfType'(Val) -> + 'enc_KmeVmDtmfType'(Val, [<<10>>]). 'enc_KmeVmDtmfType'(Val, TagIn) -> -case (case Val of {_,Enumval1}->Enumval1;_->Val end) of -aa -> ?RT_BER:encode_enumerated(0,TagIn ++ []); -vm -> ?RT_BER:encode_enumerated(1,TagIn ++ []); -Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) +case Val of +aa -> encode_tags(TagIn, [0], 1); +vm -> encode_tags(TagIn, [1], 1); +Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}}) end. -'dec_KmeVmDtmfType'(Bytes, OptOrMand) -> - 'dec_KmeVmDtmfType'(Bytes, OptOrMand, []). +'dec_KmeVmDtmfType'(Tlv) -> + 'dec_KmeVmDtmfType'(Tlv, [10]). -'dec_KmeVmDtmfType'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_enumerated(Bytes,[],[{aa,0},{vm,1}],TagIn++[], OptOrMand). +'dec_KmeVmDtmfType'(Tlv, TagIn) -> +case decode_integer(Tlv, TagIn) of +0 -> aa; +1 -> vm; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end. %%================================ %% KmeVmGroupList %%================================ - -'enc_KmeVmGroupList'({'KmeVmGroupList',Val}, TagIn) -> - 'enc_KmeVmGroupList'(Val, TagIn); +'enc_KmeVmGroupList'(Val) -> + 'enc_KmeVmGroupList'(Val, [<<48>>]). 'enc_KmeVmGroupList'(Val, TagIn) -> {EncBytes,EncLen} = 'enc_KmeVmGroupList_components'(Val,[],0), - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], EncBytes, EncLen). + encode_tags(TagIn, EncBytes, EncLen). 'enc_KmeVmGroupList_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_KmeVmGroupList_components'([H|T],AccBytes, AccLen) -> - {EncBytes,EncLen} = 'enc_KmeVmGroupList_SEQOF'(H, []), + {EncBytes,EncLen} = 'enc_KmeVmGroupList_SEQOF'(H, [<<48>>]), 'enc_KmeVmGroupList_components'(T,[EncBytes|AccBytes], AccLen + EncLen). @@ -2687,160 +2847,182 @@ end. %% KmeVmGroupList_SEQOF %%================================ 'enc_KmeVmGroupList_SEQOF'(Val, TagIn) -> - + {_,Cindex1, Cindex2, Cindex3, Cindex4} = Val, + %%------------------------------------------------- -%% attribute number 1 External CSTA-device-identifiers:DeviceID +%% attribute device(1) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {EncBytes1,EncLen1} = 'CSTA-device-identifiers':'enc_DeviceID'(?RT_BER:cindex(2,Val,device), []), + {EncBytes1,EncLen1} = 'CSTA-device-identifiers':'enc_DeviceID'(Cindex1, [<<48>>]), %%------------------------------------------------- -%% attribute number 2 with type ENUMERATED +%% attribute vmType(2) with type ENUMERATED %%------------------------------------------------- - {EncBytes2,EncLen2} = case (case ?RT_BER:cindex(3,Val,vmType) of {_,Enumval1}->Enumval1;_->?RT_BER:cindex(3,Val,vmType) end) of -dpt -> ?RT_BER:encode_enumerated(0,[]); -dtmf -> ?RT_BER:encode_enumerated(1,[]); -Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) + {EncBytes2,EncLen2} = case Cindex2 of +dpt -> encode_tags([<<10>>], [0], 1); +dtmf -> encode_tags([<<10>>], [1], 1); +Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}}) end, %%------------------------------------------------- -%% attribute number 3 with type CHOICE OPTIONAL +%% attribute name(3) with type CHOICE OPTIONAL %%------------------------------------------------- - {EncBytes3,EncLen3} = case ?RT_BER:cindex(4,Val,name) of + {EncBytes3,EncLen3} = case Cindex3 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_KmeVmGroupList_SEQOF_name'(?RT_BER:cindex(4,Val,name), []) + 'enc_KmeVmGroupList_SEQOF_name'(Cindex3, []) end, %%------------------------------------------------- -%% attribute number 4 with type ENUMERATED OPTIONAL +%% attribute dtmfType(4) with type ENUMERATED OPTIONAL %%------------------------------------------------- - {EncBytes4,EncLen4} = case ?RT_BER:cindex(5,Val,dtmfType) of + {EncBytes4,EncLen4} = case Cindex4 of asn1_NOVALUE -> {<<>>,0}; _ -> - case (case ?RT_BER:cindex(5,Val,dtmfType) of {_,Enumval3}->Enumval3;_->?RT_BER:cindex(5,Val,dtmfType) end) of -aa -> ?RT_BER:encode_enumerated(0,[]); -vm -> ?RT_BER:encode_enumerated(1,[]); -Enumval4 -> exit({error,{asn1, {enumerated_not_in_range,Enumval4}}}) + case Cindex4 of +aa -> encode_tags([<<10>>], [0], 1); +vm -> encode_tags([<<10>>], [1], 1); +Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) end end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4], - LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4, +encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% KmeVmGroupList_SEQOF_name %%================================ - -'enc_KmeVmGroupList_SEQOF_name'({'KmeVmGroupList_SEQOF_name',Val}, TagIn) -> - 'enc_KmeVmGroupList_SEQOF_name'(Val, TagIn); - 'enc_KmeVmGroupList_SEQOF_name'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of single -> - ?RT_BER:encode_octet_string([], element(2,Val), [{tag,128,0,'EXPLICIT',32}]); + encode_restricted_string(element(2,Val), [<<4>>,<<160>>]); wide -> - ?RT_BER:encode_octet_string([], element(2,Val), [{tag,128,1,'EXPLICIT',32}]); + encode_restricted_string(element(2,Val), [<<4>>,<<161>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). +encode_tags(TagIn, EncBytes, EncLen). -'dec_KmeVmGroupList_SEQOF_name'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of -%% 'single' - <<2:2,_:1,0:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_octet_string(Bytes1,{1,20},[{tag,128,0,'EXPLICIT',32}], no_length, mandatory), - {{single, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; +'dec_KmeVmGroupList'(Tlv) -> + 'dec_KmeVmGroupList'(Tlv, [16]). -%% 'wide' - <<2:2,_:1,1:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_octet_string(Bytes1,{1,40},[{tag,128,1,'EXPLICIT',32}], no_length, mandatory), - {{wide, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; +'dec_KmeVmGroupList'(Tlv, TagIn) -> + %%------------------------------------------------- + %% decode tag and length + %%------------------------------------------------- +Tlv1 = match_tags(Tlv, TagIn), +['dec_KmeVmGroupList_SEQOF'(V1, [16]) || V1 <- Tlv1]. - Else -> - case OptOrMand of - mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}}); - _ ->exit({error,{asn1,{no_optional_tag,Else}}}) - end - end. -'dec_KmeVmGroupList_SEQOF'(Bytes, OptOrMand, TagIn) -> + +'dec_KmeVmGroupList_SEQOF'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 External CSTA-device-identifiers:DeviceID +%% attribute device(1) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {Term1,Bytes3,Rb2} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes2, mandatory, []), +[V1|Tlv2] = Tlv1, +Term1 = 'CSTA-device-identifiers':'dec_DeviceID'(V1, [16]), %%------------------------------------------------- -%% attribute number 2 with type ENUMERATED +%% attribute vmType(2) with type ENUMERATED %%------------------------------------------------- - {Term2,Bytes4,Rb3} = ?RT_BER:decode_enumerated(Bytes3,[],[{dpt,0},{dtmf,1}],[], mandatory), +[V2|Tlv3] = Tlv2, +Term2 = case decode_integer(V2, [10]) of +0 -> dpt; +1 -> dtmf; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end, %%------------------------------------------------- -%% attribute number 3 with type CHOICE OPTIONAL +%% attribute name(3) with type CHOICE OPTIONAL %%------------------------------------------------- - {Term3,Bytes5,Rb4} = case (catch 'dec_KmeVmGroupList_SEQOF_name'(Bytes4, opt_or_default, [])) of -{'EXIT',{error,{asn1,{no_optional_tag,_}}}} -> { asn1_NOVALUE, Bytes4, 0 }; -Casetmp1-> Casetmp1 +{Term3,Tlv4} = case Tlv3 of +[V3 = {131072,_}|TempTlv4] -> + {'dec_KmeVmGroupList_SEQOF_name'(V3, []), TempTlv4}; +[V3 = {131073,_}|TempTlv4] -> + {'dec_KmeVmGroupList_SEQOF_name'(V3, []), TempTlv4}; + _ -> + { asn1_NOVALUE, Tlv3} end, %%------------------------------------------------- -%% attribute number 4 with type ENUMERATED OPTIONAL +%% attribute dtmfType(4) with type ENUMERATED OPTIONAL %%------------------------------------------------- - {Term4,Bytes6,Rb5} = case Bytes5 of -<<0:2,_:1,10:5,_/binary>> -> -?RT_BER:decode_enumerated(Bytes5,[],[{aa,0},{vm,1}],[], mandatory); -_ -> -{ asn1_NOVALUE, Bytes5, 0 } +{Term4,Tlv5} = case Tlv4 of +[{10,V4}|TempTlv5] -> + {case decode_integer(V4, []) of +0 -> aa; +1 -> vm; +Default2 -> exit({error,{asn1,{illegal_enumerated,Default2}}}) +end, TempTlv5}; + _ -> + { asn1_NOVALUE, Tlv4} end, - {Bytes7,Rb6} = ?RT_BER:restbytes2(RemBytes, Bytes6,noext), - {{'KmeVmGroupList_SEQOF', Term1, Term2, Term3, Term4}, Bytes7, Rb1+Rb2+Rb3+Rb4+Rb5+Rb6}. +case Tlv5 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv5}}}) % extra fields not allowed +end, + {'KmeVmGroupList_SEQOF', Term1, Term2, Term3, Term4}. +'dec_KmeVmGroupList_SEQOF_name'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of -'dec_KmeVmGroupList'(Bytes, OptOrMand) -> - 'dec_KmeVmGroupList'(Bytes, OptOrMand, []). +%% 'single' + {131072, V1} -> + {single, begin +Val1 = decode_octet_string(V1, [4]), +C1 = byte_size(Val1), +if 1 =< C1, C1 =< 20 -> +Val1; +true -> +exit({error,{asn1,bad_range}}) +end +end}; -'dec_KmeVmGroupList'(Bytes, OptOrMand, TagIn) -> - %%------------------------------------------------- - %% decode tag and length - %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), - ?RT_BER:decode_components(Rb1, Len, Bytes1, fun 'dec_KmeVmGroupList_SEQOF'/3, [], []). +%% 'wide' + {131073, V1} -> + {wide, begin +Val2 = decode_octet_string(V1, [4]), +C2 = byte_size(Val2), +if 1 =< C2, C2 =< 40 -> +Val2; +true -> +exit({error,{asn1,bad_range}}) +end +end}; + Else -> + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. %%================================ %% KmePsGroupList %%================================ - -'enc_KmePsGroupList'({'KmePsGroupList',Val}, TagIn) -> - 'enc_KmePsGroupList'(Val, TagIn); +'enc_KmePsGroupList'(Val) -> + 'enc_KmePsGroupList'(Val, [<<48>>]). 'enc_KmePsGroupList'(Val, TagIn) -> {EncBytes,EncLen} = 'enc_KmePsGroupList_components'(Val,[],0), - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], EncBytes, EncLen). + encode_tags(TagIn, EncBytes, EncLen). 'enc_KmePsGroupList_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_KmePsGroupList_components'([H|T],AccBytes, AccLen) -> - {EncBytes,EncLen} = 'enc_KmePsGroupList_SEQOF'(H, []), + {EncBytes,EncLen} = 'enc_KmePsGroupList_SEQOF'(H, [<<48>>]), 'enc_KmePsGroupList_components'(T,[EncBytes|AccBytes], AccLen + EncLen). @@ -2850,579 +3032,671 @@ end, %% KmePsGroupList_SEQOF %%================================ 'enc_KmePsGroupList_SEQOF'(Val, TagIn) -> - + {_,Cindex1, Cindex2, Cindex3, Cindex4, Cindex5, Cindex6, Cindex7} = Val, + %%------------------------------------------------- -%% attribute number 1 with type INTEGER +%% attribute groupNo(1) with type INTEGER %%------------------------------------------------- - {EncBytes1,EncLen1} = ?RT_BER:encode_integer([], ?RT_BER:cindex(2,Val,groupNo), []), + {EncBytes1,EncLen1} = encode_integer(Cindex1, [<<2>>]), %%------------------------------------------------- -%% attribute number 2 External CSTA-device-identifiers:DeviceID +%% attribute device(2) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {EncBytes2,EncLen2} = 'CSTA-device-identifiers':'enc_DeviceID'(?RT_BER:cindex(3,Val,device), []), + {EncBytes2,EncLen2} = 'CSTA-device-identifiers':'enc_DeviceID'(Cindex2, [<<48>>]), %%------------------------------------------------- -%% attribute number 3 with type CHOICE OPTIONAL +%% attribute name(3) with type CHOICE OPTIONAL %%------------------------------------------------- - {EncBytes3,EncLen3} = case ?RT_BER:cindex(4,Val,name) of + {EncBytes3,EncLen3} = case Cindex3 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_KmePsGroupList_SEQOF_name'(?RT_BER:cindex(4,Val,name), []) + 'enc_KmePsGroupList_SEQOF_name'(Cindex3, []) end, %%------------------------------------------------- -%% attribute number 4 with type BIT STRING OPTIONAL +%% attribute memberList(4) with type BIT STRING OPTIONAL %%------------------------------------------------- - {EncBytes4,EncLen4} = case ?RT_BER:cindex(5,Val,memberList) of + {EncBytes4,EncLen4} = case Cindex4 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_bit_string([], ?RT_BER:cindex(5,Val,memberList), [{one,0},{two,1},{three,2},{four,3},{five,4},{six,5},{seven,6},{eight,7},{nine,8},{ten,9},{eleven,10},{twelve,11},{thirteen,12},{fourteen,13},{fifteen,14},{sixteen,15},{seventeen,16},{eighteen,17},{nineteen,18},{twenty,19},{twentyOne,20},{twentyTwo,21},{twentyThree,22},{twentyFour,23},{twentyFive,24},{twentySix,25},{twentySeven,26},{twentyEight,27},{twentyNine,28},{thirty,29},{thirtyOne,30},{thirtyTwo,31},{thirtyThree,32},{thirtyFour,33},{thirtyFive,34},{thirtySix,35},{thirtySeven,36},{thirtyEight,37},{thirtyNine,38},{fourty,39},{fourtyOne,40},{fourtyTwo,41},{fourtyThree,42},{fourtyFour,43},{fourtyFive,44},{fourtySix,45},{fourtySeven,46},{fourtyEight,47},{fourtyNine,48},{fifty,49},{fiftyOne,50},{fiftyTwo,51},{fiftyThree,52},{fiftyFour,53},{fiftyFive,54},{fiftySix,55},{fiftySeven,56},{fiftyEight,57},{fiftyNine,58},{sixty,59},{sixtyOne,60},{sixtyTwo,61},{sixtyThree,62},{sixtyFour,63},{sixtyFive,64},{sixtySix,65},{sixtySeven,66},{sixtyEight,67},{sixtyNine,68},{seventy,69},{seventyOne,70},{seventyTwo,71},{seventyThree,72},{seventyFour,73},{seventyFive,74},{seventySix,75},{seventySeven,76},{seventyEight,77},{seventyNine,78},{eighty,79},{eightyOne,80},{eightyTwo,81},{eightyThree,82},{eightyFour,83},{eightyFive,84},{eightySix,85},{eightySeven,86},{eightyEight,87},{eightyNine,88},{ninety,89},{ninetyOne,90},{ninetyTwo,91},{ninetyThree,92},{ninetyFour,93},{ninetyFive,94},{ninetySix,95},{ninetySeven,96},{ninetyEight,97},{ninetyNine,98},{oneHundred,99},{oneHundredOne,100},{oneHundredTwo,101},{oneHundredThree,102},{oneHundredFour,103},{oneHundredFive,104},{oneHundredSix,105},{oneHundredSeven,106},{oneHundredEitht,107},{oneHundredNine,108},{oneHundredTen,109},{oneHundredEleven,110},{oneHundredTwelve,111},{oneHundredThirteen,112},{oneHundredFourteen,113},{oneHundredFifteen,114},{oneHundredSixteen,115},{oneHundredSeventeen,116},{oneHundredEithteen,117},{oneHundredNineteen,118},{oneHundredTwenty,119},{oneHundredTwentyOne,120},{oneHundredTwentyTwo,121},{oneHundredTwentyThree,122},{oneHundredTwentyFour,123},{oneHundredTwentyFive,124},{oneHundredTwentySix,125},{oneHundredTwentySeven,126},{oneHundredTwentyEight,127}], [{tag,128,2,'EXPLICIT',32}]) + encode_named_bit_string(Cindex4, [{one,0},{two,1},{three,2},{four,3},{five,4},{six,5},{seven,6},{eight,7},{nine,8},{ten,9},{eleven,10},{twelve,11},{thirteen,12},{fourteen,13},{fifteen,14},{sixteen,15},{seventeen,16},{eighteen,17},{nineteen,18},{twenty,19},{twentyOne,20},{twentyTwo,21},{twentyThree,22},{twentyFour,23},{twentyFive,24},{twentySix,25},{twentySeven,26},{twentyEight,27},{twentyNine,28},{thirty,29},{thirtyOne,30},{thirtyTwo,31},{thirtyThree,32},{thirtyFour,33},{thirtyFive,34},{thirtySix,35},{thirtySeven,36},{thirtyEight,37},{thirtyNine,38},{fourty,39},{fourtyOne,40},{fourtyTwo,41},{fourtyThree,42},{fourtyFour,43},{fourtyFive,44},{fourtySix,45},{fourtySeven,46},{fourtyEight,47},{fourtyNine,48},{fifty,49},{fiftyOne,50},{fiftyTwo,51},{fiftyThree,52},{fiftyFour,53},{fiftyFive,54},{fiftySix,55},{fiftySeven,56},{fiftyEight,57},{fiftyNine,58},{sixty,59},{sixtyOne,60},{sixtyTwo,61},{sixtyThree,62},{sixtyFour,63},{sixtyFive,64},{sixtySix,65},{sixtySeven,66},{sixtyEight,67},{sixtyNine,68},{seventy,69},{seventyOne,70},{seventyTwo,71},{seventyThree,72},{seventyFour,73},{seventyFive,74},{seventySix,75},{seventySeven,76},{seventyEight,77},{seventyNine,78},{eighty,79},{eightyOne,80},{eightyTwo,81},{eightyThree,82},{eightyFour,83},{eightyFive,84},{eightySix,85},{eightySeven,86},{eightyEight,87},{eightyNine,88},{ninety,89},{ninetyOne,90},{ninetyTwo,91},{ninetyThree,92},{ninetyFour,93},{ninetyFive,94},{ninetySix,95},{ninetySeven,96},{ninetyEight,97},{ninetyNine,98},{oneHundred,99},{oneHundredOne,100},{oneHundredTwo,101},{oneHundredThree,102},{oneHundredFour,103},{oneHundredFive,104},{oneHundredSix,105},{oneHundredSeven,106},{oneHundredEitht,107},{oneHundredNine,108},{oneHundredTen,109},{oneHundredEleven,110},{oneHundredTwelve,111},{oneHundredThirteen,112},{oneHundredFourteen,113},{oneHundredFifteen,114},{oneHundredSixteen,115},{oneHundredSeventeen,116},{oneHundredEithteen,117},{oneHundredNineteen,118},{oneHundredTwenty,119},{oneHundredTwentyOne,120},{oneHundredTwentyTwo,121},{oneHundredTwentyThree,122},{oneHundredTwentyFour,123},{oneHundredTwentyFive,124},{oneHundredTwentySix,125},{oneHundredTwentySeven,126},{oneHundredTwentyEight,127}], [<<3>>,<<162>>]) end, %%------------------------------------------------- -%% attribute number 5 with type BIT STRING OPTIONAL +%% attribute memberList2(5) with type BIT STRING OPTIONAL %%------------------------------------------------- - {EncBytes5,EncLen5} = case ?RT_BER:cindex(6,Val,memberList2) of + {EncBytes5,EncLen5} = case Cindex5 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_bit_string([], ?RT_BER:cindex(6,Val,memberList2), [{one,0},{two,1},{three,2},{four,3},{five,4},{six,5},{seven,6},{eight,7},{nine,8},{ten,9},{eleven,10},{twelve,11},{thirteen,12},{fourteen,13},{fifteen,14},{sixteen,15},{seventeen,16},{eighteen,17},{nineteen,18},{twenty,19},{twentyOne,20},{twentyTwo,21},{twentyThree,22},{twentyFour,23},{twentyFive,24},{twentySix,25},{twentySeven,26},{twentyEight,27},{twentyNine,28},{thirty,29},{thirtyOne,30},{thirtyTwo,31},{thirtyThree,32},{thirtyFour,33},{thirtyFive,34},{thirtySix,35},{thirtySeven,36},{thirtyEight,37},{thirtyNine,38},{fourty,39},{fourtyOne,40},{fourtyTwo,41},{fourtyThree,42},{fourtyFour,43},{fourtyFive,44},{fourtySix,45},{fourtySeven,46},{fourtyEight,47},{fourtyNine,48},{fifty,49},{fiftyOne,50},{fiftyTwo,51},{fiftyThree,52},{fiftyFour,53},{fiftyFive,54},{fiftySix,55},{fiftySeven,56},{fiftyEight,57},{fiftyNine,58},{sixty,59},{sixtyOne,60},{sixtyTwo,61},{sixtyThree,62},{sixtyFour,63},{sixtyFive,64},{sixtySix,65},{sixtySeven,66},{sixtyEight,67},{sixtyNine,68},{seventy,69},{seventyOne,70},{seventyTwo,71},{seventyThree,72},{seventyFour,73},{seventyFive,74},{seventySix,75},{seventySeven,76},{seventyEight,77},{seventyNine,78},{eighty,79},{eightyOne,80},{eightyTwo,81},{eightyThree,82},{eightyFour,83},{eightyFive,84},{eightySix,85},{eightySeven,86},{eightyEight,87},{eightyNine,88},{ninety,89},{ninetyOne,90},{ninetyTwo,91},{ninetyThree,92},{ninetyFour,93},{ninetyFive,94},{ninetySix,95},{ninetySeven,96},{ninetyEight,97},{ninetyNine,98},{oneHundred,99},{oneHundredOne,100},{oneHundredTwo,101},{oneHundredThree,102},{oneHundredFour,103},{oneHundredFive,104},{oneHundredSix,105},{oneHundredSeven,106},{oneHundredEitht,107},{oneHundredNine,108},{oneHundredTen,109},{oneHundredEleven,110},{oneHundredTwelve,111},{oneHundredThirteen,112},{oneHundredFourteen,113},{oneHundredFifteen,114},{oneHundredSixteen,115},{oneHundredSeventeen,116},{oneHundredEithteen,117},{oneHundredNineteen,118},{oneHundredTwenty,119},{oneHundredTwentyOne,120},{oneHundredTwentyTwo,121},{oneHundredTwentyThree,122},{oneHundredTwentyFour,123},{oneHundredTwentyFive,124},{oneHundredTwentySix,125},{oneHundredTwentySeven,126},{oneHundredTwentyEight,127}], [{tag,128,3,'EXPLICIT',32}]) + encode_named_bit_string(Cindex5, [{one,0},{two,1},{three,2},{four,3},{five,4},{six,5},{seven,6},{eight,7},{nine,8},{ten,9},{eleven,10},{twelve,11},{thirteen,12},{fourteen,13},{fifteen,14},{sixteen,15},{seventeen,16},{eighteen,17},{nineteen,18},{twenty,19},{twentyOne,20},{twentyTwo,21},{twentyThree,22},{twentyFour,23},{twentyFive,24},{twentySix,25},{twentySeven,26},{twentyEight,27},{twentyNine,28},{thirty,29},{thirtyOne,30},{thirtyTwo,31},{thirtyThree,32},{thirtyFour,33},{thirtyFive,34},{thirtySix,35},{thirtySeven,36},{thirtyEight,37},{thirtyNine,38},{fourty,39},{fourtyOne,40},{fourtyTwo,41},{fourtyThree,42},{fourtyFour,43},{fourtyFive,44},{fourtySix,45},{fourtySeven,46},{fourtyEight,47},{fourtyNine,48},{fifty,49},{fiftyOne,50},{fiftyTwo,51},{fiftyThree,52},{fiftyFour,53},{fiftyFive,54},{fiftySix,55},{fiftySeven,56},{fiftyEight,57},{fiftyNine,58},{sixty,59},{sixtyOne,60},{sixtyTwo,61},{sixtyThree,62},{sixtyFour,63},{sixtyFive,64},{sixtySix,65},{sixtySeven,66},{sixtyEight,67},{sixtyNine,68},{seventy,69},{seventyOne,70},{seventyTwo,71},{seventyThree,72},{seventyFour,73},{seventyFive,74},{seventySix,75},{seventySeven,76},{seventyEight,77},{seventyNine,78},{eighty,79},{eightyOne,80},{eightyTwo,81},{eightyThree,82},{eightyFour,83},{eightyFive,84},{eightySix,85},{eightySeven,86},{eightyEight,87},{eightyNine,88},{ninety,89},{ninetyOne,90},{ninetyTwo,91},{ninetyThree,92},{ninetyFour,93},{ninetyFive,94},{ninetySix,95},{ninetySeven,96},{ninetyEight,97},{ninetyNine,98},{oneHundred,99},{oneHundredOne,100},{oneHundredTwo,101},{oneHundredThree,102},{oneHundredFour,103},{oneHundredFive,104},{oneHundredSix,105},{oneHundredSeven,106},{oneHundredEitht,107},{oneHundredNine,108},{oneHundredTen,109},{oneHundredEleven,110},{oneHundredTwelve,111},{oneHundredThirteen,112},{oneHundredFourteen,113},{oneHundredFifteen,114},{oneHundredSixteen,115},{oneHundredSeventeen,116},{oneHundredEithteen,117},{oneHundredNineteen,118},{oneHundredTwenty,119},{oneHundredTwentyOne,120},{oneHundredTwentyTwo,121},{oneHundredTwentyThree,122},{oneHundredTwentyFour,123},{oneHundredTwentyFive,124},{oneHundredTwentySix,125},{oneHundredTwentySeven,126},{oneHundredTwentyEight,127}], [<<3>>,<<163>>]) end, %%------------------------------------------------- -%% attribute number 6 with type BIT STRING OPTIONAL +%% attribute memberList3(6) with type BIT STRING OPTIONAL %%------------------------------------------------- - {EncBytes6,EncLen6} = case ?RT_BER:cindex(7,Val,memberList3) of + {EncBytes6,EncLen6} = case Cindex6 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_bit_string([], ?RT_BER:cindex(7,Val,memberList3), [{one,0},{two,1},{three,2},{four,3},{five,4},{six,5},{seven,6},{eight,7},{nine,8},{ten,9},{eleven,10},{twelve,11},{thirteen,12},{fourteen,13},{fifteen,14},{sixteen,15},{seventeen,16},{eighteen,17},{nineteen,18},{twenty,19},{twentyOne,20},{twentyTwo,21},{twentyThree,22},{twentyFour,23},{twentyFive,24},{twentySix,25},{twentySeven,26},{twentyEight,27},{twentyNine,28},{thirty,29},{thirtyOne,30},{thirtyTwo,31},{thirtyThree,32},{thirtyFour,33},{thirtyFive,34},{thirtySix,35},{thirtySeven,36},{thirtyEight,37},{thirtyNine,38},{fourty,39},{fourtyOne,40},{fourtyTwo,41},{fourtyThree,42},{fourtyFour,43},{fourtyFive,44},{fourtySix,45},{fourtySeven,46},{fourtyEight,47},{fourtyNine,48},{fifty,49},{fiftyOne,50},{fiftyTwo,51},{fiftyThree,52},{fiftyFour,53},{fiftyFive,54},{fiftySix,55},{fiftySeven,56},{fiftyEight,57},{fiftyNine,58},{sixty,59},{sixtyOne,60},{sixtyTwo,61},{sixtyThree,62},{sixtyFour,63},{sixtyFive,64},{sixtySix,65},{sixtySeven,66},{sixtyEight,67},{sixtyNine,68},{seventy,69},{seventyOne,70},{seventyTwo,71},{seventyThree,72},{seventyFour,73},{seventyFive,74},{seventySix,75},{seventySeven,76},{seventyEight,77},{seventyNine,78},{eighty,79},{eightyOne,80},{eightyTwo,81},{eightyThree,82},{eightyFour,83},{eightyFive,84},{eightySix,85},{eightySeven,86},{eightyEight,87},{eightyNine,88},{ninety,89},{ninetyOne,90},{ninetyTwo,91},{ninetyThree,92},{ninetyFour,93},{ninetyFive,94},{ninetySix,95},{ninetySeven,96},{ninetyEight,97},{ninetyNine,98},{oneHundred,99},{oneHundredOne,100},{oneHundredTwo,101},{oneHundredThree,102},{oneHundredFour,103},{oneHundredFive,104},{oneHundredSix,105},{oneHundredSeven,106},{oneHundredEitht,107},{oneHundredNine,108},{oneHundredTen,109},{oneHundredEleven,110},{oneHundredTwelve,111},{oneHundredThirteen,112},{oneHundredFourteen,113},{oneHundredFifteen,114},{oneHundredSixteen,115},{oneHundredSeventeen,116},{oneHundredEithteen,117},{oneHundredNineteen,118},{oneHundredTwenty,119},{oneHundredTwentyOne,120},{oneHundredTwentyTwo,121},{oneHundredTwentyThree,122},{oneHundredTwentyFour,123},{oneHundredTwentyFive,124},{oneHundredTwentySix,125},{oneHundredTwentySeven,126},{oneHundredTwentyEight,127}], [{tag,128,4,'EXPLICIT',32}]) + encode_named_bit_string(Cindex6, [{one,0},{two,1},{three,2},{four,3},{five,4},{six,5},{seven,6},{eight,7},{nine,8},{ten,9},{eleven,10},{twelve,11},{thirteen,12},{fourteen,13},{fifteen,14},{sixteen,15},{seventeen,16},{eighteen,17},{nineteen,18},{twenty,19},{twentyOne,20},{twentyTwo,21},{twentyThree,22},{twentyFour,23},{twentyFive,24},{twentySix,25},{twentySeven,26},{twentyEight,27},{twentyNine,28},{thirty,29},{thirtyOne,30},{thirtyTwo,31},{thirtyThree,32},{thirtyFour,33},{thirtyFive,34},{thirtySix,35},{thirtySeven,36},{thirtyEight,37},{thirtyNine,38},{fourty,39},{fourtyOne,40},{fourtyTwo,41},{fourtyThree,42},{fourtyFour,43},{fourtyFive,44},{fourtySix,45},{fourtySeven,46},{fourtyEight,47},{fourtyNine,48},{fifty,49},{fiftyOne,50},{fiftyTwo,51},{fiftyThree,52},{fiftyFour,53},{fiftyFive,54},{fiftySix,55},{fiftySeven,56},{fiftyEight,57},{fiftyNine,58},{sixty,59},{sixtyOne,60},{sixtyTwo,61},{sixtyThree,62},{sixtyFour,63},{sixtyFive,64},{sixtySix,65},{sixtySeven,66},{sixtyEight,67},{sixtyNine,68},{seventy,69},{seventyOne,70},{seventyTwo,71},{seventyThree,72},{seventyFour,73},{seventyFive,74},{seventySix,75},{seventySeven,76},{seventyEight,77},{seventyNine,78},{eighty,79},{eightyOne,80},{eightyTwo,81},{eightyThree,82},{eightyFour,83},{eightyFive,84},{eightySix,85},{eightySeven,86},{eightyEight,87},{eightyNine,88},{ninety,89},{ninetyOne,90},{ninetyTwo,91},{ninetyThree,92},{ninetyFour,93},{ninetyFive,94},{ninetySix,95},{ninetySeven,96},{ninetyEight,97},{ninetyNine,98},{oneHundred,99},{oneHundredOne,100},{oneHundredTwo,101},{oneHundredThree,102},{oneHundredFour,103},{oneHundredFive,104},{oneHundredSix,105},{oneHundredSeven,106},{oneHundredEitht,107},{oneHundredNine,108},{oneHundredTen,109},{oneHundredEleven,110},{oneHundredTwelve,111},{oneHundredThirteen,112},{oneHundredFourteen,113},{oneHundredFifteen,114},{oneHundredSixteen,115},{oneHundredSeventeen,116},{oneHundredEithteen,117},{oneHundredNineteen,118},{oneHundredTwenty,119},{oneHundredTwentyOne,120},{oneHundredTwentyTwo,121},{oneHundredTwentyThree,122},{oneHundredTwentyFour,123},{oneHundredTwentyFive,124},{oneHundredTwentySix,125},{oneHundredTwentySeven,126},{oneHundredTwentyEight,127}], [<<3>>,<<164>>]) end, %%------------------------------------------------- -%% attribute number 7 with type BIT STRING OPTIONAL +%% attribute memberList4(7) with type BIT STRING OPTIONAL %%------------------------------------------------- - {EncBytes7,EncLen7} = case ?RT_BER:cindex(8,Val,memberList4) of + {EncBytes7,EncLen7} = case Cindex7 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_bit_string([], ?RT_BER:cindex(8,Val,memberList4), [{one,0},{two,1},{three,2},{four,3},{five,4},{six,5},{seven,6},{eight,7},{nine,8},{ten,9},{eleven,10},{twelve,11},{thirteen,12},{fourteen,13},{fifteen,14},{sixteen,15},{seventeen,16},{eighteen,17},{nineteen,18},{twenty,19},{twentyOne,20},{twentyTwo,21},{twentyThree,22},{twentyFour,23},{twentyFive,24},{twentySix,25},{twentySeven,26},{twentyEight,27},{twentyNine,28},{thirty,29},{thirtyOne,30},{thirtyTwo,31},{thirtyThree,32},{thirtyFour,33},{thirtyFive,34},{thirtySix,35},{thirtySeven,36},{thirtyEight,37},{thirtyNine,38},{fourty,39},{fourtyOne,40},{fourtyTwo,41},{fourtyThree,42},{fourtyFour,43},{fourtyFive,44},{fourtySix,45},{fourtySeven,46},{fourtyEight,47},{fourtyNine,48},{fifty,49},{fiftyOne,50},{fiftyTwo,51},{fiftyThree,52},{fiftyFour,53},{fiftyFive,54},{fiftySix,55},{fiftySeven,56},{fiftyEight,57},{fiftyNine,58},{sixty,59},{sixtyOne,60},{sixtyTwo,61},{sixtyThree,62},{sixtyFour,63},{sixtyFive,64},{sixtySix,65},{sixtySeven,66},{sixtyEight,67},{sixtyNine,68},{seventy,69},{seventyOne,70},{seventyTwo,71},{seventyThree,72},{seventyFour,73},{seventyFive,74},{seventySix,75},{seventySeven,76},{seventyEight,77},{seventyNine,78},{eighty,79},{eightyOne,80},{eightyTwo,81},{eightyThree,82},{eightyFour,83},{eightyFive,84},{eightySix,85},{eightySeven,86},{eightyEight,87},{eightyNine,88},{ninety,89},{ninetyOne,90},{ninetyTwo,91},{ninetyThree,92},{ninetyFour,93},{ninetyFive,94},{ninetySix,95},{ninetySeven,96},{ninetyEight,97},{ninetyNine,98},{oneHundred,99},{oneHundredOne,100},{oneHundredTwo,101},{oneHundredThree,102},{oneHundredFour,103},{oneHundredFive,104},{oneHundredSix,105},{oneHundredSeven,106},{oneHundredEitht,107},{oneHundredNine,108},{oneHundredTen,109},{oneHundredEleven,110},{oneHundredTwelve,111},{oneHundredThirteen,112},{oneHundredFourteen,113},{oneHundredFifteen,114},{oneHundredSixteen,115},{oneHundredSeventeen,116},{oneHundredEithteen,117},{oneHundredNineteen,118},{oneHundredTwenty,119},{oneHundredTwentyOne,120},{oneHundredTwentyTwo,121},{oneHundredTwentyThree,122},{oneHundredTwentyFour,123},{oneHundredTwentyFive,124},{oneHundredTwentySix,125},{oneHundredTwentySeven,126},{oneHundredTwentyEight,127}], [{tag,128,5,'EXPLICIT',32}]) + encode_named_bit_string(Cindex7, [{one,0},{two,1},{three,2},{four,3},{five,4},{six,5},{seven,6},{eight,7},{nine,8},{ten,9},{eleven,10},{twelve,11},{thirteen,12},{fourteen,13},{fifteen,14},{sixteen,15},{seventeen,16},{eighteen,17},{nineteen,18},{twenty,19},{twentyOne,20},{twentyTwo,21},{twentyThree,22},{twentyFour,23},{twentyFive,24},{twentySix,25},{twentySeven,26},{twentyEight,27},{twentyNine,28},{thirty,29},{thirtyOne,30},{thirtyTwo,31},{thirtyThree,32},{thirtyFour,33},{thirtyFive,34},{thirtySix,35},{thirtySeven,36},{thirtyEight,37},{thirtyNine,38},{fourty,39},{fourtyOne,40},{fourtyTwo,41},{fourtyThree,42},{fourtyFour,43},{fourtyFive,44},{fourtySix,45},{fourtySeven,46},{fourtyEight,47},{fourtyNine,48},{fifty,49},{fiftyOne,50},{fiftyTwo,51},{fiftyThree,52},{fiftyFour,53},{fiftyFive,54},{fiftySix,55},{fiftySeven,56},{fiftyEight,57},{fiftyNine,58},{sixty,59},{sixtyOne,60},{sixtyTwo,61},{sixtyThree,62},{sixtyFour,63},{sixtyFive,64},{sixtySix,65},{sixtySeven,66},{sixtyEight,67},{sixtyNine,68},{seventy,69},{seventyOne,70},{seventyTwo,71},{seventyThree,72},{seventyFour,73},{seventyFive,74},{seventySix,75},{seventySeven,76},{seventyEight,77},{seventyNine,78},{eighty,79},{eightyOne,80},{eightyTwo,81},{eightyThree,82},{eightyFour,83},{eightyFive,84},{eightySix,85},{eightySeven,86},{eightyEight,87},{eightyNine,88},{ninety,89},{ninetyOne,90},{ninetyTwo,91},{ninetyThree,92},{ninetyFour,93},{ninetyFive,94},{ninetySix,95},{ninetySeven,96},{ninetyEight,97},{ninetyNine,98},{oneHundred,99},{oneHundredOne,100},{oneHundredTwo,101},{oneHundredThree,102},{oneHundredFour,103},{oneHundredFive,104},{oneHundredSix,105},{oneHundredSeven,106},{oneHundredEitht,107},{oneHundredNine,108},{oneHundredTen,109},{oneHundredEleven,110},{oneHundredTwelve,111},{oneHundredThirteen,112},{oneHundredFourteen,113},{oneHundredFifteen,114},{oneHundredSixteen,115},{oneHundredSeventeen,116},{oneHundredEithteen,117},{oneHundredNineteen,118},{oneHundredTwenty,119},{oneHundredTwentyOne,120},{oneHundredTwentyTwo,121},{oneHundredTwentyThree,122},{oneHundredTwentyFour,123},{oneHundredTwentyFive,124},{oneHundredTwentySix,125},{oneHundredTwentySeven,126},{oneHundredTwentyEight,127}], [<<3>>,<<165>>]) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4, EncBytes5, EncBytes6, EncBytes7], - LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5 + EncLen6 + EncLen7, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5 + EncLen6 + EncLen7, +encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% KmePsGroupList_SEQOF_name %%================================ - -'enc_KmePsGroupList_SEQOF_name'({'KmePsGroupList_SEQOF_name',Val}, TagIn) -> - 'enc_KmePsGroupList_SEQOF_name'(Val, TagIn); - 'enc_KmePsGroupList_SEQOF_name'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of single -> - ?RT_BER:encode_octet_string([], element(2,Val), [{tag,128,0,'EXPLICIT',32}]); + encode_restricted_string(element(2,Val), [<<4>>,<<160>>]); wide -> - ?RT_BER:encode_octet_string([], element(2,Val), [{tag,128,1,'EXPLICIT',32}]); + encode_restricted_string(element(2,Val), [<<4>>,<<161>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). +encode_tags(TagIn, EncBytes, EncLen). -'dec_KmePsGroupList_SEQOF_name'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of -%% 'single' - <<2:2,_:1,0:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_octet_string(Bytes1,{1,20},[{tag,128,0,'EXPLICIT',32}], no_length, mandatory), - {{single, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; +'dec_KmePsGroupList'(Tlv) -> + 'dec_KmePsGroupList'(Tlv, [16]). -%% 'wide' - <<2:2,_:1,1:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_octet_string(Bytes1,{1,40},[{tag,128,1,'EXPLICIT',32}], no_length, mandatory), - {{wide, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; +'dec_KmePsGroupList'(Tlv, TagIn) -> + %%------------------------------------------------- + %% decode tag and length + %%------------------------------------------------- +Tlv1 = match_tags(Tlv, TagIn), +['dec_KmePsGroupList_SEQOF'(V1, [16]) || V1 <- Tlv1]. - Else -> - case OptOrMand of - mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}}); - _ ->exit({error,{asn1,{no_optional_tag,Else}}}) - end - end. -'dec_KmePsGroupList_SEQOF'(Bytes, OptOrMand, TagIn) -> + +'dec_KmePsGroupList_SEQOF'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 with type INTEGER +%% attribute groupNo(1) with type INTEGER %%------------------------------------------------- - {Term1,Bytes3,Rb2} = ?RT_BER:decode_integer(Bytes2,[],[], mandatory), +[V1|Tlv2] = Tlv1, +Term1 = decode_integer(V1, [2]), %%------------------------------------------------- -%% attribute number 2 External CSTA-device-identifiers:DeviceID +%% attribute device(2) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {Term2,Bytes4,Rb3} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes3, mandatory, []), +[V2|Tlv3] = Tlv2, +Term2 = 'CSTA-device-identifiers':'dec_DeviceID'(V2, [16]), %%------------------------------------------------- -%% attribute number 3 with type CHOICE OPTIONAL +%% attribute name(3) with type CHOICE OPTIONAL %%------------------------------------------------- - {Term3,Bytes5,Rb4} = case (catch 'dec_KmePsGroupList_SEQOF_name'(Bytes4, opt_or_default, [])) of -{'EXIT',{error,{asn1,{no_optional_tag,_}}}} -> { asn1_NOVALUE, Bytes4, 0 }; -Casetmp1-> Casetmp1 +{Term3,Tlv4} = case Tlv3 of +[V3 = {131072,_}|TempTlv4] -> + {'dec_KmePsGroupList_SEQOF_name'(V3, []), TempTlv4}; +[V3 = {131073,_}|TempTlv4] -> + {'dec_KmePsGroupList_SEQOF_name'(V3, []), TempTlv4}; + _ -> + { asn1_NOVALUE, Tlv3} end, %%------------------------------------------------- -%% attribute number 4 with type BIT STRING OPTIONAL +%% attribute memberList(4) with type BIT STRING OPTIONAL %%------------------------------------------------- - {Term4,Bytes6,Rb5} = case Bytes5 of -<<2:2,_:1,2:5,_/binary>> -> -?RT_BER:decode_bit_string(Bytes5,[],[{one,0},{two,1},{three,2},{four,3},{five,4},{six,5},{seven,6},{eight,7},{nine,8},{ten,9},{eleven,10},{twelve,11},{thirteen,12},{fourteen,13},{fifteen,14},{sixteen,15},{seventeen,16},{eighteen,17},{nineteen,18},{twenty,19},{twentyOne,20},{twentyTwo,21},{twentyThree,22},{twentyFour,23},{twentyFive,24},{twentySix,25},{twentySeven,26},{twentyEight,27},{twentyNine,28},{thirty,29},{thirtyOne,30},{thirtyTwo,31},{thirtyThree,32},{thirtyFour,33},{thirtyFive,34},{thirtySix,35},{thirtySeven,36},{thirtyEight,37},{thirtyNine,38},{fourty,39},{fourtyOne,40},{fourtyTwo,41},{fourtyThree,42},{fourtyFour,43},{fourtyFive,44},{fourtySix,45},{fourtySeven,46},{fourtyEight,47},{fourtyNine,48},{fifty,49},{fiftyOne,50},{fiftyTwo,51},{fiftyThree,52},{fiftyFour,53},{fiftyFive,54},{fiftySix,55},{fiftySeven,56},{fiftyEight,57},{fiftyNine,58},{sixty,59},{sixtyOne,60},{sixtyTwo,61},{sixtyThree,62},{sixtyFour,63},{sixtyFive,64},{sixtySix,65},{sixtySeven,66},{sixtyEight,67},{sixtyNine,68},{seventy,69},{seventyOne,70},{seventyTwo,71},{seventyThree,72},{seventyFour,73},{seventyFive,74},{seventySix,75},{seventySeven,76},{seventyEight,77},{seventyNine,78},{eighty,79},{eightyOne,80},{eightyTwo,81},{eightyThree,82},{eightyFour,83},{eightyFive,84},{eightySix,85},{eightySeven,86},{eightyEight,87},{eightyNine,88},{ninety,89},{ninetyOne,90},{ninetyTwo,91},{ninetyThree,92},{ninetyFour,93},{ninetyFive,94},{ninetySix,95},{ninetySeven,96},{ninetyEight,97},{ninetyNine,98},{oneHundred,99},{oneHundredOne,100},{oneHundredTwo,101},{oneHundredThree,102},{oneHundredFour,103},{oneHundredFive,104},{oneHundredSix,105},{oneHundredSeven,106},{oneHundredEitht,107},{oneHundredNine,108},{oneHundredTen,109},{oneHundredEleven,110},{oneHundredTwelve,111},{oneHundredThirteen,112},{oneHundredFourteen,113},{oneHundredFifteen,114},{oneHundredSixteen,115},{oneHundredSeventeen,116},{oneHundredEithteen,117},{oneHundredNineteen,118},{oneHundredTwenty,119},{oneHundredTwentyOne,120},{oneHundredTwentyTwo,121},{oneHundredTwentyThree,122},{oneHundredTwentyFour,123},{oneHundredTwentyFive,124},{oneHundredTwentySix,125},{oneHundredTwentySeven,126},{oneHundredTwentyEight,127}],[{tag,128,2,'EXPLICIT',32}], no_length, mandatory); -_ -> -{ asn1_NOVALUE, Bytes5, 0 } +{Term4,Tlv5} = case Tlv4 of +[{131074,V4}|TempTlv5] -> + {decode_named_bit_string(V4, [{one,0},{two,1},{three,2},{four,3},{five,4},{six,5},{seven,6},{eight,7},{nine,8},{ten,9},{eleven,10},{twelve,11},{thirteen,12},{fourteen,13},{fifteen,14},{sixteen,15},{seventeen,16},{eighteen,17},{nineteen,18},{twenty,19},{twentyOne,20},{twentyTwo,21},{twentyThree,22},{twentyFour,23},{twentyFive,24},{twentySix,25},{twentySeven,26},{twentyEight,27},{twentyNine,28},{thirty,29},{thirtyOne,30},{thirtyTwo,31},{thirtyThree,32},{thirtyFour,33},{thirtyFive,34},{thirtySix,35},{thirtySeven,36},{thirtyEight,37},{thirtyNine,38},{fourty,39},{fourtyOne,40},{fourtyTwo,41},{fourtyThree,42},{fourtyFour,43},{fourtyFive,44},{fourtySix,45},{fourtySeven,46},{fourtyEight,47},{fourtyNine,48},{fifty,49},{fiftyOne,50},{fiftyTwo,51},{fiftyThree,52},{fiftyFour,53},{fiftyFive,54},{fiftySix,55},{fiftySeven,56},{fiftyEight,57},{fiftyNine,58},{sixty,59},{sixtyOne,60},{sixtyTwo,61},{sixtyThree,62},{sixtyFour,63},{sixtyFive,64},{sixtySix,65},{sixtySeven,66},{sixtyEight,67},{sixtyNine,68},{seventy,69},{seventyOne,70},{seventyTwo,71},{seventyThree,72},{seventyFour,73},{seventyFive,74},{seventySix,75},{seventySeven,76},{seventyEight,77},{seventyNine,78},{eighty,79},{eightyOne,80},{eightyTwo,81},{eightyThree,82},{eightyFour,83},{eightyFive,84},{eightySix,85},{eightySeven,86},{eightyEight,87},{eightyNine,88},{ninety,89},{ninetyOne,90},{ninetyTwo,91},{ninetyThree,92},{ninetyFour,93},{ninetyFive,94},{ninetySix,95},{ninetySeven,96},{ninetyEight,97},{ninetyNine,98},{oneHundred,99},{oneHundredOne,100},{oneHundredTwo,101},{oneHundredThree,102},{oneHundredFour,103},{oneHundredFive,104},{oneHundredSix,105},{oneHundredSeven,106},{oneHundredEitht,107},{oneHundredNine,108},{oneHundredTen,109},{oneHundredEleven,110},{oneHundredTwelve,111},{oneHundredThirteen,112},{oneHundredFourteen,113},{oneHundredFifteen,114},{oneHundredSixteen,115},{oneHundredSeventeen,116},{oneHundredEithteen,117},{oneHundredNineteen,118},{oneHundredTwenty,119},{oneHundredTwentyOne,120},{oneHundredTwentyTwo,121},{oneHundredTwentyThree,122},{oneHundredTwentyFour,123},{oneHundredTwentyFive,124},{oneHundredTwentySix,125},{oneHundredTwentySeven,126},{oneHundredTwentyEight,127}], [3]), TempTlv5}; + _ -> + { asn1_NOVALUE, Tlv4} end, %%------------------------------------------------- -%% attribute number 5 with type BIT STRING OPTIONAL +%% attribute memberList2(5) with type BIT STRING OPTIONAL %%------------------------------------------------- - {Term5,Bytes7,Rb6} = case Bytes6 of -<<2:2,_:1,3:5,_/binary>> -> -?RT_BER:decode_bit_string(Bytes6,[],[{one,0},{two,1},{three,2},{four,3},{five,4},{six,5},{seven,6},{eight,7},{nine,8},{ten,9},{eleven,10},{twelve,11},{thirteen,12},{fourteen,13},{fifteen,14},{sixteen,15},{seventeen,16},{eighteen,17},{nineteen,18},{twenty,19},{twentyOne,20},{twentyTwo,21},{twentyThree,22},{twentyFour,23},{twentyFive,24},{twentySix,25},{twentySeven,26},{twentyEight,27},{twentyNine,28},{thirty,29},{thirtyOne,30},{thirtyTwo,31},{thirtyThree,32},{thirtyFour,33},{thirtyFive,34},{thirtySix,35},{thirtySeven,36},{thirtyEight,37},{thirtyNine,38},{fourty,39},{fourtyOne,40},{fourtyTwo,41},{fourtyThree,42},{fourtyFour,43},{fourtyFive,44},{fourtySix,45},{fourtySeven,46},{fourtyEight,47},{fourtyNine,48},{fifty,49},{fiftyOne,50},{fiftyTwo,51},{fiftyThree,52},{fiftyFour,53},{fiftyFive,54},{fiftySix,55},{fiftySeven,56},{fiftyEight,57},{fiftyNine,58},{sixty,59},{sixtyOne,60},{sixtyTwo,61},{sixtyThree,62},{sixtyFour,63},{sixtyFive,64},{sixtySix,65},{sixtySeven,66},{sixtyEight,67},{sixtyNine,68},{seventy,69},{seventyOne,70},{seventyTwo,71},{seventyThree,72},{seventyFour,73},{seventyFive,74},{seventySix,75},{seventySeven,76},{seventyEight,77},{seventyNine,78},{eighty,79},{eightyOne,80},{eightyTwo,81},{eightyThree,82},{eightyFour,83},{eightyFive,84},{eightySix,85},{eightySeven,86},{eightyEight,87},{eightyNine,88},{ninety,89},{ninetyOne,90},{ninetyTwo,91},{ninetyThree,92},{ninetyFour,93},{ninetyFive,94},{ninetySix,95},{ninetySeven,96},{ninetyEight,97},{ninetyNine,98},{oneHundred,99},{oneHundredOne,100},{oneHundredTwo,101},{oneHundredThree,102},{oneHundredFour,103},{oneHundredFive,104},{oneHundredSix,105},{oneHundredSeven,106},{oneHundredEitht,107},{oneHundredNine,108},{oneHundredTen,109},{oneHundredEleven,110},{oneHundredTwelve,111},{oneHundredThirteen,112},{oneHundredFourteen,113},{oneHundredFifteen,114},{oneHundredSixteen,115},{oneHundredSeventeen,116},{oneHundredEithteen,117},{oneHundredNineteen,118},{oneHundredTwenty,119},{oneHundredTwentyOne,120},{oneHundredTwentyTwo,121},{oneHundredTwentyThree,122},{oneHundredTwentyFour,123},{oneHundredTwentyFive,124},{oneHundredTwentySix,125},{oneHundredTwentySeven,126},{oneHundredTwentyEight,127}],[{tag,128,3,'EXPLICIT',32}], no_length, mandatory); -_ -> -{ asn1_NOVALUE, Bytes6, 0 } +{Term5,Tlv6} = case Tlv5 of +[{131075,V5}|TempTlv6] -> + {decode_named_bit_string(V5, [{one,0},{two,1},{three,2},{four,3},{five,4},{six,5},{seven,6},{eight,7},{nine,8},{ten,9},{eleven,10},{twelve,11},{thirteen,12},{fourteen,13},{fifteen,14},{sixteen,15},{seventeen,16},{eighteen,17},{nineteen,18},{twenty,19},{twentyOne,20},{twentyTwo,21},{twentyThree,22},{twentyFour,23},{twentyFive,24},{twentySix,25},{twentySeven,26},{twentyEight,27},{twentyNine,28},{thirty,29},{thirtyOne,30},{thirtyTwo,31},{thirtyThree,32},{thirtyFour,33},{thirtyFive,34},{thirtySix,35},{thirtySeven,36},{thirtyEight,37},{thirtyNine,38},{fourty,39},{fourtyOne,40},{fourtyTwo,41},{fourtyThree,42},{fourtyFour,43},{fourtyFive,44},{fourtySix,45},{fourtySeven,46},{fourtyEight,47},{fourtyNine,48},{fifty,49},{fiftyOne,50},{fiftyTwo,51},{fiftyThree,52},{fiftyFour,53},{fiftyFive,54},{fiftySix,55},{fiftySeven,56},{fiftyEight,57},{fiftyNine,58},{sixty,59},{sixtyOne,60},{sixtyTwo,61},{sixtyThree,62},{sixtyFour,63},{sixtyFive,64},{sixtySix,65},{sixtySeven,66},{sixtyEight,67},{sixtyNine,68},{seventy,69},{seventyOne,70},{seventyTwo,71},{seventyThree,72},{seventyFour,73},{seventyFive,74},{seventySix,75},{seventySeven,76},{seventyEight,77},{seventyNine,78},{eighty,79},{eightyOne,80},{eightyTwo,81},{eightyThree,82},{eightyFour,83},{eightyFive,84},{eightySix,85},{eightySeven,86},{eightyEight,87},{eightyNine,88},{ninety,89},{ninetyOne,90},{ninetyTwo,91},{ninetyThree,92},{ninetyFour,93},{ninetyFive,94},{ninetySix,95},{ninetySeven,96},{ninetyEight,97},{ninetyNine,98},{oneHundred,99},{oneHundredOne,100},{oneHundredTwo,101},{oneHundredThree,102},{oneHundredFour,103},{oneHundredFive,104},{oneHundredSix,105},{oneHundredSeven,106},{oneHundredEitht,107},{oneHundredNine,108},{oneHundredTen,109},{oneHundredEleven,110},{oneHundredTwelve,111},{oneHundredThirteen,112},{oneHundredFourteen,113},{oneHundredFifteen,114},{oneHundredSixteen,115},{oneHundredSeventeen,116},{oneHundredEithteen,117},{oneHundredNineteen,118},{oneHundredTwenty,119},{oneHundredTwentyOne,120},{oneHundredTwentyTwo,121},{oneHundredTwentyThree,122},{oneHundredTwentyFour,123},{oneHundredTwentyFive,124},{oneHundredTwentySix,125},{oneHundredTwentySeven,126},{oneHundredTwentyEight,127}], [3]), TempTlv6}; + _ -> + { asn1_NOVALUE, Tlv5} end, %%------------------------------------------------- -%% attribute number 6 with type BIT STRING OPTIONAL +%% attribute memberList3(6) with type BIT STRING OPTIONAL %%------------------------------------------------- - {Term6,Bytes8,Rb7} = case Bytes7 of -<<2:2,_:1,4:5,_/binary>> -> -?RT_BER:decode_bit_string(Bytes7,[],[{one,0},{two,1},{three,2},{four,3},{five,4},{six,5},{seven,6},{eight,7},{nine,8},{ten,9},{eleven,10},{twelve,11},{thirteen,12},{fourteen,13},{fifteen,14},{sixteen,15},{seventeen,16},{eighteen,17},{nineteen,18},{twenty,19},{twentyOne,20},{twentyTwo,21},{twentyThree,22},{twentyFour,23},{twentyFive,24},{twentySix,25},{twentySeven,26},{twentyEight,27},{twentyNine,28},{thirty,29},{thirtyOne,30},{thirtyTwo,31},{thirtyThree,32},{thirtyFour,33},{thirtyFive,34},{thirtySix,35},{thirtySeven,36},{thirtyEight,37},{thirtyNine,38},{fourty,39},{fourtyOne,40},{fourtyTwo,41},{fourtyThree,42},{fourtyFour,43},{fourtyFive,44},{fourtySix,45},{fourtySeven,46},{fourtyEight,47},{fourtyNine,48},{fifty,49},{fiftyOne,50},{fiftyTwo,51},{fiftyThree,52},{fiftyFour,53},{fiftyFive,54},{fiftySix,55},{fiftySeven,56},{fiftyEight,57},{fiftyNine,58},{sixty,59},{sixtyOne,60},{sixtyTwo,61},{sixtyThree,62},{sixtyFour,63},{sixtyFive,64},{sixtySix,65},{sixtySeven,66},{sixtyEight,67},{sixtyNine,68},{seventy,69},{seventyOne,70},{seventyTwo,71},{seventyThree,72},{seventyFour,73},{seventyFive,74},{seventySix,75},{seventySeven,76},{seventyEight,77},{seventyNine,78},{eighty,79},{eightyOne,80},{eightyTwo,81},{eightyThree,82},{eightyFour,83},{eightyFive,84},{eightySix,85},{eightySeven,86},{eightyEight,87},{eightyNine,88},{ninety,89},{ninetyOne,90},{ninetyTwo,91},{ninetyThree,92},{ninetyFour,93},{ninetyFive,94},{ninetySix,95},{ninetySeven,96},{ninetyEight,97},{ninetyNine,98},{oneHundred,99},{oneHundredOne,100},{oneHundredTwo,101},{oneHundredThree,102},{oneHundredFour,103},{oneHundredFive,104},{oneHundredSix,105},{oneHundredSeven,106},{oneHundredEitht,107},{oneHundredNine,108},{oneHundredTen,109},{oneHundredEleven,110},{oneHundredTwelve,111},{oneHundredThirteen,112},{oneHundredFourteen,113},{oneHundredFifteen,114},{oneHundredSixteen,115},{oneHundredSeventeen,116},{oneHundredEithteen,117},{oneHundredNineteen,118},{oneHundredTwenty,119},{oneHundredTwentyOne,120},{oneHundredTwentyTwo,121},{oneHundredTwentyThree,122},{oneHundredTwentyFour,123},{oneHundredTwentyFive,124},{oneHundredTwentySix,125},{oneHundredTwentySeven,126},{oneHundredTwentyEight,127}],[{tag,128,4,'EXPLICIT',32}], no_length, mandatory); -_ -> -{ asn1_NOVALUE, Bytes7, 0 } +{Term6,Tlv7} = case Tlv6 of +[{131076,V6}|TempTlv7] -> + {decode_named_bit_string(V6, [{one,0},{two,1},{three,2},{four,3},{five,4},{six,5},{seven,6},{eight,7},{nine,8},{ten,9},{eleven,10},{twelve,11},{thirteen,12},{fourteen,13},{fifteen,14},{sixteen,15},{seventeen,16},{eighteen,17},{nineteen,18},{twenty,19},{twentyOne,20},{twentyTwo,21},{twentyThree,22},{twentyFour,23},{twentyFive,24},{twentySix,25},{twentySeven,26},{twentyEight,27},{twentyNine,28},{thirty,29},{thirtyOne,30},{thirtyTwo,31},{thirtyThree,32},{thirtyFour,33},{thirtyFive,34},{thirtySix,35},{thirtySeven,36},{thirtyEight,37},{thirtyNine,38},{fourty,39},{fourtyOne,40},{fourtyTwo,41},{fourtyThree,42},{fourtyFour,43},{fourtyFive,44},{fourtySix,45},{fourtySeven,46},{fourtyEight,47},{fourtyNine,48},{fifty,49},{fiftyOne,50},{fiftyTwo,51},{fiftyThree,52},{fiftyFour,53},{fiftyFive,54},{fiftySix,55},{fiftySeven,56},{fiftyEight,57},{fiftyNine,58},{sixty,59},{sixtyOne,60},{sixtyTwo,61},{sixtyThree,62},{sixtyFour,63},{sixtyFive,64},{sixtySix,65},{sixtySeven,66},{sixtyEight,67},{sixtyNine,68},{seventy,69},{seventyOne,70},{seventyTwo,71},{seventyThree,72},{seventyFour,73},{seventyFive,74},{seventySix,75},{seventySeven,76},{seventyEight,77},{seventyNine,78},{eighty,79},{eightyOne,80},{eightyTwo,81},{eightyThree,82},{eightyFour,83},{eightyFive,84},{eightySix,85},{eightySeven,86},{eightyEight,87},{eightyNine,88},{ninety,89},{ninetyOne,90},{ninetyTwo,91},{ninetyThree,92},{ninetyFour,93},{ninetyFive,94},{ninetySix,95},{ninetySeven,96},{ninetyEight,97},{ninetyNine,98},{oneHundred,99},{oneHundredOne,100},{oneHundredTwo,101},{oneHundredThree,102},{oneHundredFour,103},{oneHundredFive,104},{oneHundredSix,105},{oneHundredSeven,106},{oneHundredEitht,107},{oneHundredNine,108},{oneHundredTen,109},{oneHundredEleven,110},{oneHundredTwelve,111},{oneHundredThirteen,112},{oneHundredFourteen,113},{oneHundredFifteen,114},{oneHundredSixteen,115},{oneHundredSeventeen,116},{oneHundredEithteen,117},{oneHundredNineteen,118},{oneHundredTwenty,119},{oneHundredTwentyOne,120},{oneHundredTwentyTwo,121},{oneHundredTwentyThree,122},{oneHundredTwentyFour,123},{oneHundredTwentyFive,124},{oneHundredTwentySix,125},{oneHundredTwentySeven,126},{oneHundredTwentyEight,127}], [3]), TempTlv7}; + _ -> + { asn1_NOVALUE, Tlv6} end, %%------------------------------------------------- -%% attribute number 7 with type BIT STRING OPTIONAL +%% attribute memberList4(7) with type BIT STRING OPTIONAL %%------------------------------------------------- - {Term7,Bytes9,Rb8} = case Bytes8 of -<<2:2,_:1,5:5,_/binary>> -> -?RT_BER:decode_bit_string(Bytes8,[],[{one,0},{two,1},{three,2},{four,3},{five,4},{six,5},{seven,6},{eight,7},{nine,8},{ten,9},{eleven,10},{twelve,11},{thirteen,12},{fourteen,13},{fifteen,14},{sixteen,15},{seventeen,16},{eighteen,17},{nineteen,18},{twenty,19},{twentyOne,20},{twentyTwo,21},{twentyThree,22},{twentyFour,23},{twentyFive,24},{twentySix,25},{twentySeven,26},{twentyEight,27},{twentyNine,28},{thirty,29},{thirtyOne,30},{thirtyTwo,31},{thirtyThree,32},{thirtyFour,33},{thirtyFive,34},{thirtySix,35},{thirtySeven,36},{thirtyEight,37},{thirtyNine,38},{fourty,39},{fourtyOne,40},{fourtyTwo,41},{fourtyThree,42},{fourtyFour,43},{fourtyFive,44},{fourtySix,45},{fourtySeven,46},{fourtyEight,47},{fourtyNine,48},{fifty,49},{fiftyOne,50},{fiftyTwo,51},{fiftyThree,52},{fiftyFour,53},{fiftyFive,54},{fiftySix,55},{fiftySeven,56},{fiftyEight,57},{fiftyNine,58},{sixty,59},{sixtyOne,60},{sixtyTwo,61},{sixtyThree,62},{sixtyFour,63},{sixtyFive,64},{sixtySix,65},{sixtySeven,66},{sixtyEight,67},{sixtyNine,68},{seventy,69},{seventyOne,70},{seventyTwo,71},{seventyThree,72},{seventyFour,73},{seventyFive,74},{seventySix,75},{seventySeven,76},{seventyEight,77},{seventyNine,78},{eighty,79},{eightyOne,80},{eightyTwo,81},{eightyThree,82},{eightyFour,83},{eightyFive,84},{eightySix,85},{eightySeven,86},{eightyEight,87},{eightyNine,88},{ninety,89},{ninetyOne,90},{ninetyTwo,91},{ninetyThree,92},{ninetyFour,93},{ninetyFive,94},{ninetySix,95},{ninetySeven,96},{ninetyEight,97},{ninetyNine,98},{oneHundred,99},{oneHundredOne,100},{oneHundredTwo,101},{oneHundredThree,102},{oneHundredFour,103},{oneHundredFive,104},{oneHundredSix,105},{oneHundredSeven,106},{oneHundredEitht,107},{oneHundredNine,108},{oneHundredTen,109},{oneHundredEleven,110},{oneHundredTwelve,111},{oneHundredThirteen,112},{oneHundredFourteen,113},{oneHundredFifteen,114},{oneHundredSixteen,115},{oneHundredSeventeen,116},{oneHundredEithteen,117},{oneHundredNineteen,118},{oneHundredTwenty,119},{oneHundredTwentyOne,120},{oneHundredTwentyTwo,121},{oneHundredTwentyThree,122},{oneHundredTwentyFour,123},{oneHundredTwentyFive,124},{oneHundredTwentySix,125},{oneHundredTwentySeven,126},{oneHundredTwentyEight,127}],[{tag,128,5,'EXPLICIT',32}], no_length, mandatory); -_ -> -{ asn1_NOVALUE, Bytes8, 0 } +{Term7,Tlv8} = case Tlv7 of +[{131077,V7}|TempTlv8] -> + {decode_named_bit_string(V7, [{one,0},{two,1},{three,2},{four,3},{five,4},{six,5},{seven,6},{eight,7},{nine,8},{ten,9},{eleven,10},{twelve,11},{thirteen,12},{fourteen,13},{fifteen,14},{sixteen,15},{seventeen,16},{eighteen,17},{nineteen,18},{twenty,19},{twentyOne,20},{twentyTwo,21},{twentyThree,22},{twentyFour,23},{twentyFive,24},{twentySix,25},{twentySeven,26},{twentyEight,27},{twentyNine,28},{thirty,29},{thirtyOne,30},{thirtyTwo,31},{thirtyThree,32},{thirtyFour,33},{thirtyFive,34},{thirtySix,35},{thirtySeven,36},{thirtyEight,37},{thirtyNine,38},{fourty,39},{fourtyOne,40},{fourtyTwo,41},{fourtyThree,42},{fourtyFour,43},{fourtyFive,44},{fourtySix,45},{fourtySeven,46},{fourtyEight,47},{fourtyNine,48},{fifty,49},{fiftyOne,50},{fiftyTwo,51},{fiftyThree,52},{fiftyFour,53},{fiftyFive,54},{fiftySix,55},{fiftySeven,56},{fiftyEight,57},{fiftyNine,58},{sixty,59},{sixtyOne,60},{sixtyTwo,61},{sixtyThree,62},{sixtyFour,63},{sixtyFive,64},{sixtySix,65},{sixtySeven,66},{sixtyEight,67},{sixtyNine,68},{seventy,69},{seventyOne,70},{seventyTwo,71},{seventyThree,72},{seventyFour,73},{seventyFive,74},{seventySix,75},{seventySeven,76},{seventyEight,77},{seventyNine,78},{eighty,79},{eightyOne,80},{eightyTwo,81},{eightyThree,82},{eightyFour,83},{eightyFive,84},{eightySix,85},{eightySeven,86},{eightyEight,87},{eightyNine,88},{ninety,89},{ninetyOne,90},{ninetyTwo,91},{ninetyThree,92},{ninetyFour,93},{ninetyFive,94},{ninetySix,95},{ninetySeven,96},{ninetyEight,97},{ninetyNine,98},{oneHundred,99},{oneHundredOne,100},{oneHundredTwo,101},{oneHundredThree,102},{oneHundredFour,103},{oneHundredFive,104},{oneHundredSix,105},{oneHundredSeven,106},{oneHundredEitht,107},{oneHundredNine,108},{oneHundredTen,109},{oneHundredEleven,110},{oneHundredTwelve,111},{oneHundredThirteen,112},{oneHundredFourteen,113},{oneHundredFifteen,114},{oneHundredSixteen,115},{oneHundredSeventeen,116},{oneHundredEithteen,117},{oneHundredNineteen,118},{oneHundredTwenty,119},{oneHundredTwentyOne,120},{oneHundredTwentyTwo,121},{oneHundredTwentyThree,122},{oneHundredTwentyFour,123},{oneHundredTwentyFive,124},{oneHundredTwentySix,125},{oneHundredTwentySeven,126},{oneHundredTwentyEight,127}], [3]), TempTlv8}; + _ -> + { asn1_NOVALUE, Tlv7} end, - {Bytes10,Rb9} = ?RT_BER:restbytes2(RemBytes, Bytes9,noext), - {{'KmePsGroupList_SEQOF', Term1, Term2, Term3, Term4, Term5, Term6, Term7}, Bytes10, Rb1+Rb2+Rb3+Rb4+Rb5+Rb6+Rb7+Rb8+Rb9}. +case Tlv8 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv8}}}) % extra fields not allowed +end, + {'KmePsGroupList_SEQOF', Term1, Term2, Term3, Term4, Term5, Term6, Term7}. +'dec_KmePsGroupList_SEQOF_name'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of -'dec_KmePsGroupList'(Bytes, OptOrMand) -> - 'dec_KmePsGroupList'(Bytes, OptOrMand, []). +%% 'single' + {131072, V1} -> + {single, begin +Val1 = decode_octet_string(V1, [4]), +C1 = byte_size(Val1), +if 1 =< C1, C1 =< 20 -> +Val1; +true -> +exit({error,{asn1,bad_range}}) +end +end}; -'dec_KmePsGroupList'(Bytes, OptOrMand, TagIn) -> - %%------------------------------------------------- - %% decode tag and length - %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), - ?RT_BER:decode_components(Rb1, Len, Bytes1, fun 'dec_KmePsGroupList_SEQOF'/3, [], []). +%% 'wide' + {131073, V1} -> + {wide, begin +Val2 = decode_octet_string(V1, [4]), +C2 = byte_size(Val2), +if 1 =< C2, C2 =< 40 -> +Val2; +true -> +exit({error,{asn1,bad_range}}) +end +end}; + Else -> + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. %%================================ %% KmeChangeExtNo %%================================ +'enc_KmeChangeExtNo'(Val) -> + 'enc_KmeChangeExtNo'(Val, [<<48>>]). + 'enc_KmeChangeExtNo'(Val, TagIn) -> +{_,Cindex1, Cindex2} = Val, %%------------------------------------------------- -%% attribute number 1 External CSTA-device-identifiers:DeviceID +%% attribute requestingDevice(1) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {EncBytes1,EncLen1} = 'CSTA-device-identifiers':'enc_DeviceID'(?RT_BER:cindex(2,Val,requestingDevice), []), + {EncBytes1,EncLen1} = 'CSTA-device-identifiers':'enc_DeviceID'(Cindex1, [<<48>>]), %%------------------------------------------------- -%% attribute number 2 with type IA5String +%% attribute newExtNo(2) with type IA5String %%------------------------------------------------- - {EncBytes2,EncLen2} = ?RT_BER:encode_restricted_string([], ?RT_BER:cindex(3,Val,newExtNo), 22, []), + {EncBytes2,EncLen2} = encode_restricted_string(Cindex2, [<<22>>]), BytesSoFar = [EncBytes1, EncBytes2], - LenSoFar = EncLen1 + EncLen2, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2, +encode_tags(TagIn, BytesSoFar, LenSoFar). -'dec_KmeChangeExtNo'(Bytes, OptOrMand) -> - 'dec_KmeChangeExtNo'(Bytes, OptOrMand, []). +'dec_KmeChangeExtNo'(Tlv) -> + 'dec_KmeChangeExtNo'(Tlv, [16]). -'dec_KmeChangeExtNo'(Bytes, OptOrMand, TagIn) -> +'dec_KmeChangeExtNo'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 External CSTA-device-identifiers:DeviceID +%% attribute requestingDevice(1) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {Term1,Bytes3,Rb2} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes2, mandatory, []), +[V1|Tlv2] = Tlv1, +Term1 = 'CSTA-device-identifiers':'dec_DeviceID'(V1, [16]), %%------------------------------------------------- -%% attribute number 2 with type IA5String +%% attribute newExtNo(2) with type IA5String %%------------------------------------------------- - {Term2,Bytes4,Rb3} = ?RT_BER:decode_restricted_string(Bytes3,{1,5},22,[], no_length, mandatory), +[V2|Tlv3] = Tlv2, +Term2 = begin +Val1 = decode_restricted_string(V2, [22]), +C1 = byte_size(Val1), +if 1 =< C1, C1 =< 5 -> +binary_to_list(Val1); +true -> +exit({error,{asn1,bad_range}}) +end +end, + +case Tlv3 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed +end, + {'KmeChangeExtNo', Term1, Term2}. - {Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext), - {{'KmeChangeExtNo', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}. %%================================ %% KmeChangeName %%================================ +'enc_KmeChangeName'(Val) -> + 'enc_KmeChangeName'(Val, [<<48>>]). + 'enc_KmeChangeName'(Val, TagIn) -> +{_,Cindex1, Cindex2} = Val, %%------------------------------------------------- -%% attribute number 1 External CSTA-device-identifiers:DeviceID +%% attribute requestingDevice(1) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {EncBytes1,EncLen1} = 'CSTA-device-identifiers':'enc_DeviceID'(?RT_BER:cindex(2,Val,requestingDevice), []), + {EncBytes1,EncLen1} = 'CSTA-device-identifiers':'enc_DeviceID'(Cindex1, [<<48>>]), %%------------------------------------------------- -%% attribute number 2 with type CHOICE OPTIONAL +%% attribute newName(2) with type CHOICE OPTIONAL %%------------------------------------------------- - {EncBytes2,EncLen2} = case ?RT_BER:cindex(3,Val,newName) of + {EncBytes2,EncLen2} = case Cindex2 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_KmeChangeName_newName'(?RT_BER:cindex(3,Val,newName), []) + 'enc_KmeChangeName_newName'(Cindex2, []) end, BytesSoFar = [EncBytes1, EncBytes2], - LenSoFar = EncLen1 + EncLen2, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2, +encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% KmeChangeName_newName %%================================ - -'enc_KmeChangeName_newName'({'KmeChangeName_newName',Val}, TagIn) -> - 'enc_KmeChangeName_newName'(Val, TagIn); - 'enc_KmeChangeName_newName'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of single -> - ?RT_BER:encode_octet_string([], element(2,Val), [{tag,128,0,'EXPLICIT',32}]); + encode_restricted_string(element(2,Val), [<<4>>,<<160>>]); wide -> - ?RT_BER:encode_octet_string([], element(2,Val), [{tag,128,1,'EXPLICIT',32}]); + encode_restricted_string(element(2,Val), [<<4>>,<<161>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). - +encode_tags(TagIn, EncBytes, EncLen). -'dec_KmeChangeName_newName'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of -%% 'single' - <<2:2,_:1,0:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_octet_string(Bytes1,{1,20},[{tag,128,0,'EXPLICIT',32}], no_length, mandatory), - {{single, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; - - -%% 'wide' - <<2:2,_:1,1:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_octet_string(Bytes1,{1,40},[{tag,128,1,'EXPLICIT',32}], no_length, mandatory), - {{wide, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; - Else -> - case OptOrMand of - mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}}); - _ ->exit({error,{asn1,{no_optional_tag,Else}}}) - end - end. +'dec_KmeChangeName'(Tlv) -> + 'dec_KmeChangeName'(Tlv, [16]). -'dec_KmeChangeName'(Bytes, OptOrMand) -> - 'dec_KmeChangeName'(Bytes, OptOrMand, []). - -'dec_KmeChangeName'(Bytes, OptOrMand, TagIn) -> +'dec_KmeChangeName'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 External CSTA-device-identifiers:DeviceID +%% attribute requestingDevice(1) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {Term1,Bytes3,Rb2} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes2, mandatory, []), +[V1|Tlv2] = Tlv1, +Term1 = 'CSTA-device-identifiers':'dec_DeviceID'(V1, [16]), %%------------------------------------------------- -%% attribute number 2 with type CHOICE OPTIONAL +%% attribute newName(2) with type CHOICE OPTIONAL %%------------------------------------------------- - {Term2,Bytes4,Rb3} = case (catch 'dec_KmeChangeName_newName'(Bytes3, opt_or_default, [])) of -{'EXIT',{error,{asn1,{no_optional_tag,_}}}} -> { asn1_NOVALUE, Bytes3, 0 }; -Casetmp1-> Casetmp1 +{Term2,Tlv3} = case Tlv2 of +[V2 = {131072,_}|TempTlv3] -> + {'dec_KmeChangeName_newName'(V2, []), TempTlv3}; +[V2 = {131073,_}|TempTlv3] -> + {'dec_KmeChangeName_newName'(V2, []), TempTlv3}; + _ -> + { asn1_NOVALUE, Tlv2} +end, + +case Tlv3 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed end, + {'KmeChangeName', Term1, Term2}. + +'dec_KmeChangeName_newName'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of + +%% 'single' + {131072, V1} -> + {single, begin +Val1 = decode_octet_string(V1, [4]), +C1 = byte_size(Val1), +if 1 =< C1, C1 =< 20 -> +Val1; +true -> +exit({error,{asn1,bad_range}}) +end +end}; + + +%% 'wide' + {131073, V1} -> + {wide, begin +Val2 = decode_octet_string(V1, [4]), +C2 = byte_size(Val2), +if 1 =< C2, C2 =< 40 -> +Val2; +true -> +exit({error,{asn1,bad_range}}) +end +end}; - {Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext), - {{'KmeChangeName', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}. + Else -> + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. %%================================ %% KmeDeviceCategory %%================================ - -'enc_KmeDeviceCategory'({'KmeDeviceCategory',Val}, TagIn) -> - 'enc_KmeDeviceCategory'(Val, TagIn); +'enc_KmeDeviceCategory'(Val) -> + 'enc_KmeDeviceCategory'(Val, []). 'enc_KmeDeviceCategory'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of standardDevice -> - case (case element(2,Val) of {_,Enumval1}->Enumval1;_->element(2,Val) end) of -acd -> ?RT_BER:encode_enumerated(0,[{tag,128,0,'EXPLICIT',32}]); -group -> ?RT_BER:encode_enumerated(1,[{tag,128,0,'EXPLICIT',32}]); -networkInterface -> ?RT_BER:encode_enumerated(2,[{tag,128,0,'EXPLICIT',32}]); -park -> ?RT_BER:encode_enumerated(3,[{tag,128,0,'EXPLICIT',32}]); -routeingDevice -> ?RT_BER:encode_enumerated(4,[{tag,128,0,'EXPLICIT',32}]); -station -> ?RT_BER:encode_enumerated(5,[{tag,128,0,'EXPLICIT',32}]); -voiceUnit -> ?RT_BER:encode_enumerated(6,[{tag,128,0,'EXPLICIT',32}]); -other -> ?RT_BER:encode_enumerated(7,[{tag,128,0,'EXPLICIT',32}]); -genericInteractiveVoice -> ?RT_BER:encode_enumerated(8,[{tag,128,0,'EXPLICIT',32}]); -listenerInteractiveVoice -> ?RT_BER:encode_enumerated(9,[{tag,128,0,'EXPLICIT',32}]); -dtmfInteractiveVoice -> ?RT_BER:encode_enumerated(10,[{tag,128,0,'EXPLICIT',32}]); -promptInteractiveVoice -> ?RT_BER:encode_enumerated(11,[{tag,128,0,'EXPLICIT',32}]); -promptQueueInteractiveVoice -> ?RT_BER:encode_enumerated(12,[{tag,128,0,'EXPLICIT',32}]); -messageInteractiveVoice -> ?RT_BER:encode_enumerated(13,[{tag,128,0,'EXPLICIT',32}]); -conference -> ?RT_BER:encode_enumerated(14,[{tag,128,0,'EXPLICIT',32}]); -Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) + case element(2,Val) of +acd -> encode_tags([<<10>>,<<160>>], [0], 1); +group -> encode_tags([<<10>>,<<160>>], [1], 1); +networkInterface -> encode_tags([<<10>>,<<160>>], [2], 1); +park -> encode_tags([<<10>>,<<160>>], [3], 1); +routeingDevice -> encode_tags([<<10>>,<<160>>], [4], 1); +station -> encode_tags([<<10>>,<<160>>], [5], 1); +voiceUnit -> encode_tags([<<10>>,<<160>>], [6], 1); +other -> encode_tags([<<10>>,<<160>>], [7], 1); +genericInteractiveVoice -> encode_tags([<<10>>,<<160>>], [8], 1); +listenerInteractiveVoice -> encode_tags([<<10>>,<<160>>], [9], 1); +dtmfInteractiveVoice -> encode_tags([<<10>>,<<160>>], [10], 1); +promptInteractiveVoice -> encode_tags([<<10>>,<<160>>], [11], 1); +promptQueueInteractiveVoice -> encode_tags([<<10>>,<<160>>], [12], 1); +messageInteractiveVoice -> encode_tags([<<10>>,<<160>>], [13], 1); +conference -> encode_tags([<<10>>,<<160>>], [14], 1); +Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}}) end; kmeDevice -> - case (case element(2,Val) of {_,Enumval3}->Enumval3;_->element(2,Val) end) of -vm -> ?RT_BER:encode_enumerated(0,[{tag,128,1,'EXPLICIT',32}]); -doorPhone -> ?RT_BER:encode_enumerated(1,[{tag,128,1,'EXPLICIT',32}]); -disa -> ?RT_BER:encode_enumerated(2,[{tag,128,1,'EXPLICIT',32}]); -pagingGroup -> ?RT_BER:encode_enumerated(3,[{tag,128,1,'EXPLICIT',32}]); -psGruop -> ?RT_BER:encode_enumerated(4,[{tag,128,1,'EXPLICIT',32}]); -externalRinger -> ?RT_BER:encode_enumerated(5,[{tag,128,1,'EXPLICIT',32}]); -externalSensor -> ?RT_BER:encode_enumerated(6,[{tag,128,1,'EXPLICIT',32}]); -externalPager -> ?RT_BER:encode_enumerated(7,[{tag,128,1,'EXPLICIT',32}]); -modem -> ?RT_BER:encode_enumerated(8,[{tag,128,1,'EXPLICIT',32}]); -hdlc -> ?RT_BER:encode_enumerated(9,[{tag,128,1,'EXPLICIT',32}]); -pbxSystem -> ?RT_BER:encode_enumerated(10,[{tag,128,1,'EXPLICIT',32}]); -svm -> ?RT_BER:encode_enumerated(11,[{tag,128,1,'EXPLICIT',32}]); -Enumval4 -> exit({error,{asn1, {enumerated_not_in_range,Enumval4}}}) + case element(2,Val) of +vm -> encode_tags([<<10>>,<<161>>], [0], 1); +doorPhone -> encode_tags([<<10>>,<<161>>], [1], 1); +disa -> encode_tags([<<10>>,<<161>>], [2], 1); +pagingGroup -> encode_tags([<<10>>,<<161>>], [3], 1); +psGruop -> encode_tags([<<10>>,<<161>>], [4], 1); +externalRinger -> encode_tags([<<10>>,<<161>>], [5], 1); +externalSensor -> encode_tags([<<10>>,<<161>>], [6], 1); +externalPager -> encode_tags([<<10>>,<<161>>], [7], 1); +modem -> encode_tags([<<10>>,<<161>>], [8], 1); +hdlc -> encode_tags([<<10>>,<<161>>], [9], 1); +pbxSystem -> encode_tags([<<10>>,<<161>>], [10], 1); +svm -> encode_tags([<<10>>,<<161>>], [11], 1); +Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) end; Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). +encode_tags(TagIn, EncBytes, EncLen). -'dec_KmeDeviceCategory'(Bytes, OptOrMand) -> - 'dec_KmeDeviceCategory'(Bytes, OptOrMand, []). +'dec_KmeDeviceCategory'(Tlv) -> + 'dec_KmeDeviceCategory'(Tlv, []). -'dec_KmeDeviceCategory'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of +'dec_KmeDeviceCategory'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of %% 'standardDevice' - <<2:2,_:1,0:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_enumerated(Bytes1,[],[{acd,0},{group,1},{networkInterface,2},{park,3},{routeingDevice,4},{station,5},{voiceUnit,6},{other,7},{genericInteractiveVoice,8},{listenerInteractiveVoice,9},{dtmfInteractiveVoice,10},{promptInteractiveVoice,11},{promptQueueInteractiveVoice,12},{messageInteractiveVoice,13},{conference,14}],[{tag,128,0,'EXPLICIT',32}], mandatory), - {{standardDevice, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131072, V1} -> + {standardDevice, case decode_integer(V1, [10]) of +0 -> acd; +1 -> group; +2 -> networkInterface; +3 -> park; +4 -> routeingDevice; +5 -> station; +6 -> voiceUnit; +7 -> other; +8 -> genericInteractiveVoice; +9 -> listenerInteractiveVoice; +10 -> dtmfInteractiveVoice; +11 -> promptInteractiveVoice; +12 -> promptQueueInteractiveVoice; +13 -> messageInteractiveVoice; +14 -> conference; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end}; %% 'kmeDevice' - <<2:2,_:1,1:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_enumerated(Bytes1,[],[{vm,0},{doorPhone,1},{disa,2},{pagingGroup,3},{psGruop,4},{externalRinger,5},{externalSensor,6},{externalPager,7},{modem,8},{hdlc,9},{pbxSystem,10},{svm,11}],[{tag,128,1,'EXPLICIT',32}], mandatory), - {{kmeDevice, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131073, V1} -> + {kmeDevice, case decode_integer(V1, [10]) of +0 -> vm; +1 -> doorPhone; +2 -> disa; +3 -> pagingGroup; +4 -> psGruop; +5 -> externalRinger; +6 -> externalSensor; +7 -> externalPager; +8 -> modem; +9 -> hdlc; +10 -> pbxSystem; +11 -> svm; +Default2 -> exit({error,{asn1,{illegal_enumerated,Default2}}}) +end}; Else -> - case OptOrMand of - mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}}); - _ ->exit({error,{asn1,{no_optional_tag,Else}}}) - end - end. + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. %%================================ %% KmeRequestedDevice %%================================ - -'enc_KmeRequestedDevice'({'KmeRequestedDevice',Val}, TagIn) -> - 'enc_KmeRequestedDevice'(Val, TagIn); +'enc_KmeRequestedDevice'(Val) -> + 'enc_KmeRequestedDevice'(Val, []). 'enc_KmeRequestedDevice'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of device -> - 'CSTA-device-identifiers':'enc_DeviceID'(element(2,Val), [{tag,128,0,'EXPLICIT',32}]); + 'CSTA-device-identifiers':'enc_DeviceID'(element(2,Val), [<<48>>,<<160>>]); category -> - 'enc_KmeDeviceCategory'(element(2,Val), [{tag,128,1,'EXPLICIT',32}]); + 'enc_KmeDeviceCategory'(element(2,Val), [<<161>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). +encode_tags(TagIn, EncBytes, EncLen). -'dec_KmeRequestedDevice'(Bytes, OptOrMand) -> - 'dec_KmeRequestedDevice'(Bytes, OptOrMand, []). +'dec_KmeRequestedDevice'(Tlv) -> + 'dec_KmeRequestedDevice'(Tlv, []). -'dec_KmeRequestedDevice'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of +'dec_KmeRequestedDevice'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of %% 'device' - <<2:2,_:1,0:5,_/binary>> -> - {Dec, Rest, RbCho} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes1, mandatory, [{tag,128,0,'EXPLICIT',32}]), - {{device, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131072, V1} -> + {device, 'CSTA-device-identifiers':'dec_DeviceID'(V1, [16])}; %% 'category' - <<2:2,_:1,1:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeDeviceCategory'(Bytes1, mandatory, [{tag,128,1,'EXPLICIT',32}]), - {{category, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131073, V1} -> + {category, 'dec_KmeDeviceCategory'(V1, [])}; Else -> - case OptOrMand of - mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}}); - _ ->exit({error,{asn1,{no_optional_tag,Else}}}) - end - end. + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. %%================================ %% KmeChangedDeviceCategory %%================================ - -'enc_KmeChangedDeviceCategory'({'KmeChangedDeviceCategory',Val}, TagIn) -> - 'enc_KmeChangedDeviceCategory'(Val, TagIn); +'enc_KmeChangedDeviceCategory'(Val) -> + 'enc_KmeChangedDeviceCategory'(Val, []). 'enc_KmeChangedDeviceCategory'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of standardDevice -> - case (case element(2,Val) of {_,Enumval1}->Enumval1;_->element(2,Val) end) of -acd -> ?RT_BER:encode_enumerated(0,[{tag,128,0,'EXPLICIT',32}]); -groupACD -> ?RT_BER:encode_enumerated(1,[{tag,128,0,'EXPLICIT',32}]); -groupHunt -> ?RT_BER:encode_enumerated(2,[{tag,128,0,'EXPLICIT',32}]); -groupPick -> ?RT_BER:encode_enumerated(3,[{tag,128,0,'EXPLICIT',32}]); -groupOther -> ?RT_BER:encode_enumerated(4,[{tag,128,0,'EXPLICIT',32}]); -networkInterface -> ?RT_BER:encode_enumerated(5,[{tag,128,0,'EXPLICIT',32}]); -park -> ?RT_BER:encode_enumerated(6,[{tag,128,0,'EXPLICIT',32}]); -routeingDevice -> ?RT_BER:encode_enumerated(7,[{tag,128,0,'EXPLICIT',32}]); -station -> ?RT_BER:encode_enumerated(8,[{tag,128,0,'EXPLICIT',32}]); -voiceUnit -> ?RT_BER:encode_enumerated(9,[{tag,128,0,'EXPLICIT',32}]); -other -> ?RT_BER:encode_enumerated(10,[{tag,128,0,'EXPLICIT',32}]); -conference -> ?RT_BER:encode_enumerated(11,[{tag,128,0,'EXPLICIT',32}]); -dtmfIV -> ?RT_BER:encode_enumerated(12,[{tag,128,0,'EXPLICIT',32}]); -genericIV -> ?RT_BER:encode_enumerated(13,[{tag,128,0,'EXPLICIT',32}]); -groupUser -> ?RT_BER:encode_enumerated(14,[{tag,128,0,'EXPLICIT',32}]); -listenerIV -> ?RT_BER:encode_enumerated(15,[{tag,128,0,'EXPLICIT',32}]); -messageIV -> ?RT_BER:encode_enumerated(16,[{tag,128,0,'EXPLICIT',32}]); -promptIV -> ?RT_BER:encode_enumerated(17,[{tag,128,0,'EXPLICIT',32}]); -promptQueue -> ?RT_BER:encode_enumerated(18,[{tag,128,0,'EXPLICIT',32}]); -Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) + case element(2,Val) of +acd -> encode_tags([<<10>>,<<160>>], [0], 1); +groupACD -> encode_tags([<<10>>,<<160>>], [1], 1); +groupHunt -> encode_tags([<<10>>,<<160>>], [2], 1); +groupPick -> encode_tags([<<10>>,<<160>>], [3], 1); +groupOther -> encode_tags([<<10>>,<<160>>], [4], 1); +networkInterface -> encode_tags([<<10>>,<<160>>], [5], 1); +park -> encode_tags([<<10>>,<<160>>], [6], 1); +routeingDevice -> encode_tags([<<10>>,<<160>>], [7], 1); +station -> encode_tags([<<10>>,<<160>>], [8], 1); +voiceUnit -> encode_tags([<<10>>,<<160>>], [9], 1); +other -> encode_tags([<<10>>,<<160>>], [10], 1); +conference -> encode_tags([<<10>>,<<160>>], [11], 1); +dtmfIV -> encode_tags([<<10>>,<<160>>], [12], 1); +genericIV -> encode_tags([<<10>>,<<160>>], [13], 1); +groupUser -> encode_tags([<<10>>,<<160>>], [14], 1); +listenerIV -> encode_tags([<<10>>,<<160>>], [15], 1); +messageIV -> encode_tags([<<10>>,<<160>>], [16], 1); +promptIV -> encode_tags([<<10>>,<<160>>], [17], 1); +promptQueue -> encode_tags([<<10>>,<<160>>], [18], 1); +Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}}) end; kmeDevice -> - case (case element(2,Val) of {_,Enumval3}->Enumval3;_->element(2,Val) end) of -vm -> ?RT_BER:encode_enumerated(0,[{tag,128,1,'EXPLICIT',32}]); -doorPhone -> ?RT_BER:encode_enumerated(1,[{tag,128,1,'EXPLICIT',32}]); -disa -> ?RT_BER:encode_enumerated(2,[{tag,128,1,'EXPLICIT',32}]); -pagingGroup -> ?RT_BER:encode_enumerated(3,[{tag,128,1,'EXPLICIT',32}]); -psGruop -> ?RT_BER:encode_enumerated(4,[{tag,128,1,'EXPLICIT',32}]); -externalRinger -> ?RT_BER:encode_enumerated(5,[{tag,128,1,'EXPLICIT',32}]); -externalSensor -> ?RT_BER:encode_enumerated(6,[{tag,128,1,'EXPLICIT',32}]); -externalPager -> ?RT_BER:encode_enumerated(7,[{tag,128,1,'EXPLICIT',32}]); -modem -> ?RT_BER:encode_enumerated(8,[{tag,128,1,'EXPLICIT',32}]); -hdlc -> ?RT_BER:encode_enumerated(9,[{tag,128,1,'EXPLICIT',32}]); -pbxSystem -> ?RT_BER:encode_enumerated(10,[{tag,128,1,'EXPLICIT',32}]); -svm -> ?RT_BER:encode_enumerated(11,[{tag,128,1,'EXPLICIT',32}]); -Enumval4 -> exit({error,{asn1, {enumerated_not_in_range,Enumval4}}}) + case element(2,Val) of +vm -> encode_tags([<<10>>,<<161>>], [0], 1); +doorPhone -> encode_tags([<<10>>,<<161>>], [1], 1); +disa -> encode_tags([<<10>>,<<161>>], [2], 1); +pagingGroup -> encode_tags([<<10>>,<<161>>], [3], 1); +psGruop -> encode_tags([<<10>>,<<161>>], [4], 1); +externalRinger -> encode_tags([<<10>>,<<161>>], [5], 1); +externalSensor -> encode_tags([<<10>>,<<161>>], [6], 1); +externalPager -> encode_tags([<<10>>,<<161>>], [7], 1); +modem -> encode_tags([<<10>>,<<161>>], [8], 1); +hdlc -> encode_tags([<<10>>,<<161>>], [9], 1); +pbxSystem -> encode_tags([<<10>>,<<161>>], [10], 1); +svm -> encode_tags([<<10>>,<<161>>], [11], 1); +Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) end; Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). +encode_tags(TagIn, EncBytes, EncLen). -'dec_KmeChangedDeviceCategory'(Bytes, OptOrMand) -> - 'dec_KmeChangedDeviceCategory'(Bytes, OptOrMand, []). +'dec_KmeChangedDeviceCategory'(Tlv) -> + 'dec_KmeChangedDeviceCategory'(Tlv, []). -'dec_KmeChangedDeviceCategory'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of +'dec_KmeChangedDeviceCategory'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of %% 'standardDevice' - <<2:2,_:1,0:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_enumerated(Bytes1,[],[{acd,0},{groupACD,1},{groupHunt,2},{groupPick,3},{groupOther,4},{networkInterface,5},{park,6},{routeingDevice,7},{station,8},{voiceUnit,9},{other,10},{conference,11},{dtmfIV,12},{genericIV,13},{groupUser,14},{listenerIV,15},{messageIV,16},{promptIV,17},{promptQueue,18}],[{tag,128,0,'EXPLICIT',32}], mandatory), - {{standardDevice, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131072, V1} -> + {standardDevice, case decode_integer(V1, [10]) of +0 -> acd; +1 -> groupACD; +2 -> groupHunt; +3 -> groupPick; +4 -> groupOther; +5 -> networkInterface; +6 -> park; +7 -> routeingDevice; +8 -> station; +9 -> voiceUnit; +10 -> other; +11 -> conference; +12 -> dtmfIV; +13 -> genericIV; +14 -> groupUser; +15 -> listenerIV; +16 -> messageIV; +17 -> promptIV; +18 -> promptQueue; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end}; %% 'kmeDevice' - <<2:2,_:1,1:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_enumerated(Bytes1,[],[{vm,0},{doorPhone,1},{disa,2},{pagingGroup,3},{psGruop,4},{externalRinger,5},{externalSensor,6},{externalPager,7},{modem,8},{hdlc,9},{pbxSystem,10},{svm,11}],[{tag,128,1,'EXPLICIT',32}], mandatory), - {{kmeDevice, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131073, V1} -> + {kmeDevice, case decode_integer(V1, [10]) of +0 -> vm; +1 -> doorPhone; +2 -> disa; +3 -> pagingGroup; +4 -> psGruop; +5 -> externalRinger; +6 -> externalSensor; +7 -> externalPager; +8 -> modem; +9 -> hdlc; +10 -> pbxSystem; +11 -> svm; +Default2 -> exit({error,{asn1,{illegal_enumerated,Default2}}}) +end}; Else -> - case OptOrMand of - mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}}); - _ ->exit({error,{asn1,{no_optional_tag,Else}}}) - end - end. + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. %%================================ %% KmeDeviceStateList %%================================ - -'enc_KmeDeviceStateList'({'KmeDeviceStateList',Val}, TagIn) -> - 'enc_KmeDeviceStateList'(Val, TagIn); +'enc_KmeDeviceStateList'(Val) -> + 'enc_KmeDeviceStateList'(Val, [<<48>>]). 'enc_KmeDeviceStateList'(Val, TagIn) -> {EncBytes,EncLen} = 'enc_KmeDeviceStateList_components'(Val,[],0), - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], EncBytes, EncLen). + encode_tags(TagIn, EncBytes, EncLen). 'enc_KmeDeviceStateList_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_KmeDeviceStateList_components'([H|T],AccBytes, AccLen) -> - {EncBytes,EncLen} = 'enc_KmeDeviceStateEntry'(H, []), + {EncBytes,EncLen} = 'enc_KmeDeviceStateEntry'(H, [<<48>>]), 'enc_KmeDeviceStateList_components'(T,[EncBytes|AccBytes], AccLen + EncLen). -'dec_KmeDeviceStateList'(Bytes, OptOrMand) -> - 'dec_KmeDeviceStateList'(Bytes, OptOrMand, []). +'dec_KmeDeviceStateList'(Tlv) -> + 'dec_KmeDeviceStateList'(Tlv, [16]). -'dec_KmeDeviceStateList'(Bytes, OptOrMand, TagIn) -> +'dec_KmeDeviceStateList'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), - ?RT_BER:decode_components(Rb1, Len, Bytes1, fun 'dec_KmeDeviceStateEntry'/3, [], []). +Tlv1 = match_tags(Tlv, TagIn), +['dec_KmeDeviceStateEntry'(V1, [16]) || V1 <- Tlv1]. @@ -3430,381 +3704,467 @@ end; %%================================ %% KmeDeviceStateEntry %%================================ +'enc_KmeDeviceStateEntry'(Val) -> + 'enc_KmeDeviceStateEntry'(Val, [<<48>>]). + 'enc_KmeDeviceStateEntry'(Val, TagIn) -> +{_,Cindex1, Cindex2, Cindex3} = Val, %%------------------------------------------------- -%% attribute number 1 External CSTA-device-identifiers:DeviceID +%% attribute device(1) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {EncBytes1,EncLen1} = 'CSTA-device-identifiers':'enc_DeviceID'(?RT_BER:cindex(2,Val,device), []), + {EncBytes1,EncLen1} = 'CSTA-device-identifiers':'enc_DeviceID'(Cindex1, [<<48>>]), %%------------------------------------------------- -%% attribute number 2 with type IA5String OPTIONAL +%% attribute number(2) with type IA5String OPTIONAL %%------------------------------------------------- - {EncBytes2,EncLen2} = case ?RT_BER:cindex(3,Val,number) of + {EncBytes2,EncLen2} = case Cindex2 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_restricted_string([], ?RT_BER:cindex(3,Val,number), 22, []) + encode_restricted_string(Cindex2, [<<22>>]) end, %%------------------------------------------------- -%% attribute number 3 with type ENUMERATED +%% attribute status(3) with type ENUMERATED %%------------------------------------------------- - {EncBytes3,EncLen3} = case (case ?RT_BER:cindex(4,Val,status) of {_,Enumval2}->Enumval2;_->?RT_BER:cindex(4,Val,status) end) of -ins -> ?RT_BER:encode_enumerated(0,[]); -ous -> ?RT_BER:encode_enumerated(1,[]); -Enumval3 -> exit({error,{asn1, {enumerated_not_in_range,Enumval3}}}) + {EncBytes3,EncLen3} = case Cindex3 of +ins -> encode_tags([<<10>>], [0], 1); +ous -> encode_tags([<<10>>], [1], 1); +Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3], - LenSoFar = EncLen1 + EncLen2 + EncLen3, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2 + EncLen3, +encode_tags(TagIn, BytesSoFar, LenSoFar). -'dec_KmeDeviceStateEntry'(Bytes, OptOrMand) -> - 'dec_KmeDeviceStateEntry'(Bytes, OptOrMand, []). +'dec_KmeDeviceStateEntry'(Tlv) -> + 'dec_KmeDeviceStateEntry'(Tlv, [16]). -'dec_KmeDeviceStateEntry'(Bytes, OptOrMand, TagIn) -> +'dec_KmeDeviceStateEntry'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 External CSTA-device-identifiers:DeviceID +%% attribute device(1) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {Term1,Bytes3,Rb2} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes2, mandatory, []), +[V1|Tlv2] = Tlv1, +Term1 = 'CSTA-device-identifiers':'dec_DeviceID'(V1, [16]), %%------------------------------------------------- -%% attribute number 2 with type IA5String OPTIONAL +%% attribute number(2) with type IA5String OPTIONAL %%------------------------------------------------- - {Term2,Bytes4,Rb3} = case Bytes3 of -<<0:2,_:1,22:5,_/binary>> -> -?RT_BER:decode_restricted_string(Bytes3,{1,5},22,[], no_length, mandatory); -_ -> -{ asn1_NOVALUE, Bytes3, 0 } +{Term2,Tlv3} = case Tlv2 of +[{22,V2}|TempTlv3] -> + {begin +Val1 = decode_restricted_string(V2, []), +C1 = byte_size(Val1), +if 1 =< C1, C1 =< 5 -> +binary_to_list(Val1); +true -> +exit({error,{asn1,bad_range}}) +end +end, TempTlv3}; + _ -> + { asn1_NOVALUE, Tlv2} end, %%------------------------------------------------- -%% attribute number 3 with type ENUMERATED +%% attribute status(3) with type ENUMERATED %%------------------------------------------------- - {Term3,Bytes5,Rb4} = ?RT_BER:decode_enumerated(Bytes4,[],[{ins,0},{ous,1}],[], mandatory), +[V3|Tlv4] = Tlv3, +Term3 = case decode_integer(V3, [10]) of +0 -> ins; +1 -> ous; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end, + +case Tlv4 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowed +end, + {'KmeDeviceStateEntry', Term1, Term2, Term3}. - {Bytes6,Rb5} = ?RT_BER:restbytes2(RemBytes, Bytes5,noext), - {{'KmeDeviceStateEntry', Term1, Term2, Term3}, Bytes6, Rb1+Rb2+Rb3+Rb4+Rb5}. %%================================ %% KmeDeviceState %%================================ - -'enc_KmeDeviceState'({'KmeDeviceState',Val}, TagIn) -> - 'enc_KmeDeviceState'(Val, TagIn); +'enc_KmeDeviceState'(Val) -> + 'enc_KmeDeviceState'(Val, [<<10>>]). 'enc_KmeDeviceState'(Val, TagIn) -> -case (case Val of {_,Enumval1}->Enumval1;_->Val end) of -ins -> ?RT_BER:encode_enumerated(0,TagIn ++ []); -ous -> ?RT_BER:encode_enumerated(1,TagIn ++ []); -Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) +case Val of +ins -> encode_tags(TagIn, [0], 1); +ous -> encode_tags(TagIn, [1], 1); +Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}}) end. -'dec_KmeDeviceState'(Bytes, OptOrMand) -> - 'dec_KmeDeviceState'(Bytes, OptOrMand, []). +'dec_KmeDeviceState'(Tlv) -> + 'dec_KmeDeviceState'(Tlv, [10]). -'dec_KmeDeviceState'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_enumerated(Bytes,[],[{ins,0},{ous,1}],TagIn++[], OptOrMand). +'dec_KmeDeviceState'(Tlv, TagIn) -> +case decode_integer(Tlv, TagIn) of +0 -> ins; +1 -> ous; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end. %%================================ %% KmeGroupType %%================================ - -'enc_KmeGroupType'({'KmeGroupType',Val}, TagIn) -> - 'enc_KmeGroupType'(Val, TagIn); +'enc_KmeGroupType'(Val) -> + 'enc_KmeGroupType'(Val, [<<10>>]). 'enc_KmeGroupType'(Val, TagIn) -> -case (case Val of {_,Enumval1}->Enumval1;_->Val end) of -ucd -> ?RT_BER:encode_enumerated(0,TagIn ++ []); -ring -> ?RT_BER:encode_enumerated(1,TagIn ++ []); -hunt -> ?RT_BER:encode_enumerated(2,TagIn ++ []); -Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) +case Val of +ucd -> encode_tags(TagIn, [0], 1); +ring -> encode_tags(TagIn, [1], 1); +hunt -> encode_tags(TagIn, [2], 1); +Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}}) end. -'dec_KmeGroupType'(Bytes, OptOrMand) -> - 'dec_KmeGroupType'(Bytes, OptOrMand, []). +'dec_KmeGroupType'(Tlv) -> + 'dec_KmeGroupType'(Tlv, [10]). -'dec_KmeGroupType'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_enumerated(Bytes,[],[{ucd,0},{ring,1},{hunt,2}],TagIn++[], OptOrMand). +'dec_KmeGroupType'(Tlv, TagIn) -> +case decode_integer(Tlv, TagIn) of +0 -> ucd; +1 -> ring; +2 -> hunt; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end. %%================================ %% KmePhoneProperty %%================================ +'enc_KmePhoneProperty'(Val) -> + 'enc_KmePhoneProperty'(Val, [<<48>>]). + 'enc_KmePhoneProperty'(Val, TagIn) -> +{_,Cindex1, Cindex2, Cindex3, Cindex4, Cindex5, Cindex6, Cindex7} = Val, %%------------------------------------------------- -%% attribute number 1 with type INTEGER +%% attribute portType(1) with type INTEGER %%------------------------------------------------- - {EncBytes1,EncLen1} = ?RT_BER:encode_integer([], ?RT_BER:cindex(2,Val,portType), []), + {EncBytes1,EncLen1} = encode_integer(Cindex1, [<<2>>]), %%------------------------------------------------- -%% attribute number 2 with type INTEGER +%% attribute phoneCode(2) with type INTEGER %%------------------------------------------------- - {EncBytes2,EncLen2} = ?RT_BER:encode_integer([], ?RT_BER:cindex(3,Val,phoneCode), []), + {EncBytes2,EncLen2} = encode_integer(Cindex2, [<<2>>]), %%------------------------------------------------- -%% attribute number 3 with type INTEGER +%% attribute lcdRows(3) with type INTEGER %%------------------------------------------------- - {EncBytes3,EncLen3} = ?RT_BER:encode_integer([], ?RT_BER:cindex(4,Val,lcdRows), []), + {EncBytes3,EncLen3} = encode_integer(Cindex3, [<<2>>]), %%------------------------------------------------- -%% attribute number 4 with type INTEGER +%% attribute lcdColumns(4) with type INTEGER %%------------------------------------------------- - {EncBytes4,EncLen4} = ?RT_BER:encode_integer([], ?RT_BER:cindex(5,Val,lcdColumns), []), + {EncBytes4,EncLen4} = encode_integer(Cindex4, [<<2>>]), %%------------------------------------------------- -%% attribute number 5 with type INTEGER +%% attribute numberOfCoKeys(5) with type INTEGER %%------------------------------------------------- - {EncBytes5,EncLen5} = ?RT_BER:encode_integer([], ?RT_BER:cindex(6,Val,numberOfCoKeys), []), + {EncBytes5,EncLen5} = encode_integer(Cindex5, [<<2>>]), %%------------------------------------------------- -%% attribute number 6 with type INTEGER +%% attribute numberOfSoftKeys(6) with type INTEGER %%------------------------------------------------- - {EncBytes6,EncLen6} = ?RT_BER:encode_integer([], ?RT_BER:cindex(7,Val,numberOfSoftKeys), []), + {EncBytes6,EncLen6} = encode_integer(Cindex6, [<<2>>]), %%------------------------------------------------- -%% attribute number 7 with type BOOLEAN +%% attribute spPhone(7) with type BOOLEAN %%------------------------------------------------- - {EncBytes7,EncLen7} = ?RT_BER:encode_boolean(?RT_BER:cindex(8,Val,spPhone), []), + {EncBytes7,EncLen7} = encode_boolean(Cindex7, [<<1>>]), BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4, EncBytes5, EncBytes6, EncBytes7], - LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5 + EncLen6 + EncLen7, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5 + EncLen6 + EncLen7, +encode_tags(TagIn, BytesSoFar, LenSoFar). -'dec_KmePhoneProperty'(Bytes, OptOrMand) -> - 'dec_KmePhoneProperty'(Bytes, OptOrMand, []). +'dec_KmePhoneProperty'(Tlv) -> + 'dec_KmePhoneProperty'(Tlv, [16]). -'dec_KmePhoneProperty'(Bytes, OptOrMand, TagIn) -> +'dec_KmePhoneProperty'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 with type INTEGER +%% attribute portType(1) with type INTEGER %%------------------------------------------------- - {Term1,Bytes3,Rb2} = ?RT_BER:decode_integer(Bytes2,[],[], mandatory), +[V1|Tlv2] = Tlv1, +Term1 = decode_integer(V1, [2]), %%------------------------------------------------- -%% attribute number 2 with type INTEGER +%% attribute phoneCode(2) with type INTEGER %%------------------------------------------------- - {Term2,Bytes4,Rb3} = ?RT_BER:decode_integer(Bytes3,[],[], mandatory), +[V2|Tlv3] = Tlv2, +Term2 = decode_integer(V2, [2]), %%------------------------------------------------- -%% attribute number 3 with type INTEGER +%% attribute lcdRows(3) with type INTEGER %%------------------------------------------------- - {Term3,Bytes5,Rb4} = ?RT_BER:decode_integer(Bytes4,[],[], mandatory), +[V3|Tlv4] = Tlv3, +Term3 = decode_integer(V3, [2]), %%------------------------------------------------- -%% attribute number 4 with type INTEGER +%% attribute lcdColumns(4) with type INTEGER %%------------------------------------------------- - {Term4,Bytes6,Rb5} = ?RT_BER:decode_integer(Bytes5,[],[], mandatory), +[V4|Tlv5] = Tlv4, +Term4 = decode_integer(V4, [2]), %%------------------------------------------------- -%% attribute number 5 with type INTEGER +%% attribute numberOfCoKeys(5) with type INTEGER %%------------------------------------------------- - {Term5,Bytes7,Rb6} = ?RT_BER:decode_integer(Bytes6,[],[], mandatory), +[V5|Tlv6] = Tlv5, +Term5 = decode_integer(V5, [2]), %%------------------------------------------------- -%% attribute number 6 with type INTEGER +%% attribute numberOfSoftKeys(6) with type INTEGER %%------------------------------------------------- - {Term6,Bytes8,Rb7} = ?RT_BER:decode_integer(Bytes7,[],[], mandatory), +[V6|Tlv7] = Tlv6, +Term6 = decode_integer(V6, [2]), %%------------------------------------------------- -%% attribute number 7 with type BOOLEAN +%% attribute spPhone(7) with type BOOLEAN %%------------------------------------------------- - {Term7,Bytes9,Rb8} = ?RT_BER:decode_boolean(Bytes8,[], mandatory), +[V7|Tlv8] = Tlv7, +Term7 = decode_boolean(V7, [1]), + +case Tlv8 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv8}}}) % extra fields not allowed +end, + {'KmePhoneProperty', Term1, Term2, Term3, Term4, Term5, Term6, Term7}. - {Bytes10,Rb9} = ?RT_BER:restbytes2(RemBytes, Bytes9,noext), - {{'KmePhoneProperty', Term1, Term2, Term3, Term4, Term5, Term6, Term7}, Bytes10, Rb1+Rb2+Rb3+Rb4+Rb5+Rb6+Rb7+Rb8+Rb9}. %%================================ %% KmeDeviceExtNo %%================================ +'enc_KmeDeviceExtNo'(Val) -> + 'enc_KmeDeviceExtNo'(Val, [<<48>>]). + 'enc_KmeDeviceExtNo'(Val, TagIn) -> +{_,Cindex1, Cindex2} = Val, %%------------------------------------------------- -%% attribute number 1 External CSTA-device-identifiers:DeviceID +%% attribute devNumber(1) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {EncBytes1,EncLen1} = 'CSTA-device-identifiers':'enc_DeviceID'(?RT_BER:cindex(2,Val,devNumber), []), + {EncBytes1,EncLen1} = 'CSTA-device-identifiers':'enc_DeviceID'(Cindex1, [<<48>>]), %%------------------------------------------------- -%% attribute number 2 with type IA5String OPTIONAL +%% attribute extNo(2) with type IA5String OPTIONAL %%------------------------------------------------- - {EncBytes2,EncLen2} = case ?RT_BER:cindex(3,Val,extNo) of + {EncBytes2,EncLen2} = case Cindex2 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_restricted_string([], ?RT_BER:cindex(3,Val,extNo), 22, []) + encode_restricted_string(Cindex2, [<<22>>]) end, BytesSoFar = [EncBytes1, EncBytes2], - LenSoFar = EncLen1 + EncLen2, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2, +encode_tags(TagIn, BytesSoFar, LenSoFar). -'dec_KmeDeviceExtNo'(Bytes, OptOrMand) -> - 'dec_KmeDeviceExtNo'(Bytes, OptOrMand, []). +'dec_KmeDeviceExtNo'(Tlv) -> + 'dec_KmeDeviceExtNo'(Tlv, [16]). -'dec_KmeDeviceExtNo'(Bytes, OptOrMand, TagIn) -> +'dec_KmeDeviceExtNo'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 External CSTA-device-identifiers:DeviceID +%% attribute devNumber(1) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {Term1,Bytes3,Rb2} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes2, mandatory, []), +[V1|Tlv2] = Tlv1, +Term1 = 'CSTA-device-identifiers':'dec_DeviceID'(V1, [16]), %%------------------------------------------------- -%% attribute number 2 with type IA5String OPTIONAL +%% attribute extNo(2) with type IA5String OPTIONAL %%------------------------------------------------- - {Term2,Bytes4,Rb3} = case Bytes3 of -<<0:2,_:1,22:5,_/binary>> -> -?RT_BER:decode_restricted_string(Bytes3,{1,5},22,[], no_length, mandatory); -_ -> -{ asn1_NOVALUE, Bytes3, 0 } +{Term2,Tlv3} = case Tlv2 of +[{22,V2}|TempTlv3] -> + {begin +Val1 = decode_restricted_string(V2, []), +C1 = byte_size(Val1), +if 1 =< C1, C1 =< 5 -> +binary_to_list(Val1); +true -> +exit({error,{asn1,bad_range}}) +end +end, TempTlv3}; + _ -> + { asn1_NOVALUE, Tlv2} +end, + +case Tlv3 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed end, + {'KmeDeviceExtNo', Term1, Term2}. - {Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext), - {{'KmeDeviceExtNo', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}. %%================================ %% KmeDeviceName %%================================ +'enc_KmeDeviceName'(Val) -> + 'enc_KmeDeviceName'(Val, [<<48>>]). + 'enc_KmeDeviceName'(Val, TagIn) -> +{_,Cindex1, Cindex2} = Val, %%------------------------------------------------- -%% attribute number 1 with type IA5String +%% attribute extNo(1) with type IA5String %%------------------------------------------------- - {EncBytes1,EncLen1} = ?RT_BER:encode_restricted_string([], ?RT_BER:cindex(2,Val,extNo), 22, []), + {EncBytes1,EncLen1} = encode_restricted_string(Cindex1, [<<22>>]), %%------------------------------------------------- -%% attribute number 2 External KME-specific-types:KmeExtName +%% attribute name(2) External KME-specific-types:KmeExtName %%------------------------------------------------- - {EncBytes2,EncLen2} = 'enc_KmeExtName'(?RT_BER:cindex(3,Val,name), []), + {EncBytes2,EncLen2} = 'enc_KmeExtName'(Cindex2, []), BytesSoFar = [EncBytes1, EncBytes2], - LenSoFar = EncLen1 + EncLen2, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2, +encode_tags(TagIn, BytesSoFar, LenSoFar). -'dec_KmeDeviceName'(Bytes, OptOrMand) -> - 'dec_KmeDeviceName'(Bytes, OptOrMand, []). +'dec_KmeDeviceName'(Tlv) -> + 'dec_KmeDeviceName'(Tlv, [16]). -'dec_KmeDeviceName'(Bytes, OptOrMand, TagIn) -> +'dec_KmeDeviceName'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 with type IA5String +%% attribute extNo(1) with type IA5String %%------------------------------------------------- - {Term1,Bytes3,Rb2} = ?RT_BER:decode_restricted_string(Bytes2,{1,5},22,[], no_length, mandatory), +[V1|Tlv2] = Tlv1, +Term1 = begin +Val1 = decode_restricted_string(V1, [22]), +C1 = byte_size(Val1), +if 1 =< C1, C1 =< 5 -> +binary_to_list(Val1); +true -> +exit({error,{asn1,bad_range}}) +end +end, %%------------------------------------------------- -%% attribute number 2 External KME-specific-types:KmeExtName +%% attribute name(2) External KME-specific-types:KmeExtName %%------------------------------------------------- - {Term2,Bytes4,Rb3} = 'dec_KmeExtName'(Bytes3, mandatory, []), +[V2|Tlv3] = Tlv2, +Term2 = 'dec_KmeExtName'(V2, []), + +case Tlv3 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed +end, + {'KmeDeviceName', Term1, Term2}. - {Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext), - {{'KmeDeviceName', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}. %%================================ %% KmeFcoKeyInfo %%================================ +'enc_KmeFcoKeyInfo'(Val) -> + 'enc_KmeFcoKeyInfo'(Val, [<<48>>]). + 'enc_KmeFcoKeyInfo'(Val, TagIn) -> +{_,Cindex1, Cindex2} = Val, %%------------------------------------------------- -%% attribute number 1 with type OCTET STRING +%% attribute button(1) with type OCTET STRING %%------------------------------------------------- - {EncBytes1,EncLen1} = ?RT_BER:encode_octet_string([], ?RT_BER:cindex(2,Val,button), []), + {EncBytes1,EncLen1} = encode_restricted_string(Cindex1, [<<4>>]), %%------------------------------------------------- -%% attribute number 2 with type OCTET STRING +%% attribute function(2) with type OCTET STRING %%------------------------------------------------- - {EncBytes2,EncLen2} = ?RT_BER:encode_octet_string([], ?RT_BER:cindex(3,Val,function), []), + {EncBytes2,EncLen2} = encode_restricted_string(Cindex2, [<<4>>]), BytesSoFar = [EncBytes1, EncBytes2], - LenSoFar = EncLen1 + EncLen2, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2, +encode_tags(TagIn, BytesSoFar, LenSoFar). -'dec_KmeFcoKeyInfo'(Bytes, OptOrMand) -> - 'dec_KmeFcoKeyInfo'(Bytes, OptOrMand, []). +'dec_KmeFcoKeyInfo'(Tlv) -> + 'dec_KmeFcoKeyInfo'(Tlv, [16]). -'dec_KmeFcoKeyInfo'(Bytes, OptOrMand, TagIn) -> +'dec_KmeFcoKeyInfo'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 with type OCTET STRING +%% attribute button(1) with type OCTET STRING %%------------------------------------------------- - {Term1,Bytes3,Rb2} = ?RT_BER:decode_octet_string(Bytes2,[],[], no_length, mandatory), +[V1|Tlv2] = Tlv1, +Term1 = decode_octet_string(V1, [4]), %%------------------------------------------------- -%% attribute number 2 with type OCTET STRING +%% attribute function(2) with type OCTET STRING %%------------------------------------------------- - {Term2,Bytes4,Rb3} = ?RT_BER:decode_octet_string(Bytes3,1,[], no_length, mandatory), +[V2|Tlv3] = Tlv2, +Term2 = begin +Val1 = decode_octet_string(V2, [4]), +C1 = byte_size(Val1), +if C1 =:= 1 -> +Val1; +true -> +exit({error,{asn1,bad_range}}) +end +end, + +case Tlv3 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed +end, + {'KmeFcoKeyInfo', Term1, Term2}. - {Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext), - {{'KmeFcoKeyInfo', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}. %%================================ %% KmeFcoKeyList %%================================ - -'enc_KmeFcoKeyList'({'KmeFcoKeyList',Val}, TagIn) -> - 'enc_KmeFcoKeyList'(Val, TagIn); +'enc_KmeFcoKeyList'(Val) -> + 'enc_KmeFcoKeyList'(Val, [<<48>>]). 'enc_KmeFcoKeyList'(Val, TagIn) -> {EncBytes,EncLen} = 'enc_KmeFcoKeyList_components'(Val,[],0), - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], EncBytes, EncLen). + encode_tags(TagIn, EncBytes, EncLen). 'enc_KmeFcoKeyList_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_KmeFcoKeyList_components'([H|T],AccBytes, AccLen) -> - {EncBytes,EncLen} = 'enc_KmeFcoKeyInfo'(H, []), + {EncBytes,EncLen} = 'enc_KmeFcoKeyInfo'(H, [<<48>>]), 'enc_KmeFcoKeyList_components'(T,[EncBytes|AccBytes], AccLen + EncLen). -'dec_KmeFcoKeyList'(Bytes, OptOrMand) -> - 'dec_KmeFcoKeyList'(Bytes, OptOrMand, []). +'dec_KmeFcoKeyList'(Tlv) -> + 'dec_KmeFcoKeyList'(Tlv, [16]). -'dec_KmeFcoKeyList'(Bytes, OptOrMand, TagIn) -> +'dec_KmeFcoKeyList'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), - ?RT_BER:decode_components(Rb1, Len, Bytes1, fun 'dec_KmeFcoKeyInfo'/3, [], []). +Tlv1 = match_tags(Tlv, TagIn), +['dec_KmeFcoKeyInfo'(V1, [16]) || V1 <- Tlv1]. @@ -3812,19 +4172,18 @@ end, %%================================ %% KmeExternalSensorList %%================================ - -'enc_KmeExternalSensorList'({'KmeExternalSensorList',Val}, TagIn) -> - 'enc_KmeExternalSensorList'(Val, TagIn); +'enc_KmeExternalSensorList'(Val) -> + 'enc_KmeExternalSensorList'(Val, [<<48>>]). 'enc_KmeExternalSensorList'(Val, TagIn) -> {EncBytes,EncLen} = 'enc_KmeExternalSensorList_components'(Val,[],0), - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], EncBytes, EncLen). + encode_tags(TagIn, EncBytes, EncLen). 'enc_KmeExternalSensorList_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_KmeExternalSensorList_components'([H|T],AccBytes, AccLen) -> - {EncBytes,EncLen} = 'enc_KmeExternalSensorList_SEQOF'(H, []), + {EncBytes,EncLen} = 'enc_KmeExternalSensorList_SEQOF'(H, [<<48>>]), 'enc_KmeExternalSensorList_components'(T,[EncBytes|AccBytes], AccLen + EncLen). @@ -3834,385 +4193,432 @@ end, %% KmeExternalSensorList_SEQOF %%================================ 'enc_KmeExternalSensorList_SEQOF'(Val, TagIn) -> - + {_,Cindex1, Cindex2, Cindex3} = Val, + %%------------------------------------------------- -%% attribute number 1 with type IA5String +%% attribute sensorNo(1) with type IA5String %%------------------------------------------------- - {EncBytes1,EncLen1} = ?RT_BER:encode_restricted_string([], ?RT_BER:cindex(2,Val,sensorNo), 22, [{tag,128,0,'EXPLICIT',32}]), + {EncBytes1,EncLen1} = encode_restricted_string(Cindex1, [<<22>>,<<160>>]), %%------------------------------------------------- -%% attribute number 2 External CSTA-device-identifiers:DeviceID +%% attribute device(2) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {EncBytes2,EncLen2} = 'CSTA-device-identifiers':'enc_DeviceID'(?RT_BER:cindex(3,Val,device), [{tag,128,1,'EXPLICIT',32}]), + {EncBytes2,EncLen2} = 'CSTA-device-identifiers':'enc_DeviceID'(Cindex2, [<<48>>,<<161>>]), %%------------------------------------------------- -%% attribute number 3 with type CHOICE OPTIONAL +%% attribute name(3) with type CHOICE OPTIONAL %%------------------------------------------------- - {EncBytes3,EncLen3} = case ?RT_BER:cindex(4,Val,name) of + {EncBytes3,EncLen3} = case Cindex3 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_KmeExternalSensorList_SEQOF_name'(?RT_BER:cindex(4,Val,name), [{tag,128,2,'EXPLICIT',32}]) + 'enc_KmeExternalSensorList_SEQOF_name'(Cindex3, [<<162>>]) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3], - LenSoFar = EncLen1 + EncLen2 + EncLen3, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2 + EncLen3, +encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% KmeExternalSensorList_SEQOF_name %%================================ - -'enc_KmeExternalSensorList_SEQOF_name'({'KmeExternalSensorList_SEQOF_name',Val}, TagIn) -> - 'enc_KmeExternalSensorList_SEQOF_name'(Val, TagIn); - 'enc_KmeExternalSensorList_SEQOF_name'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of single -> - ?RT_BER:encode_octet_string([], element(2,Val), [{tag,128,0,'EXPLICIT',32}]); + encode_restricted_string(element(2,Val), [<<4>>,<<160>>]); wide -> - ?RT_BER:encode_octet_string([], element(2,Val), [{tag,128,1,'EXPLICIT',32}]); + encode_restricted_string(element(2,Val), [<<4>>,<<161>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). +encode_tags(TagIn, EncBytes, EncLen). -'dec_KmeExternalSensorList_SEQOF_name'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of -%% 'single' - <<2:2,_:1,0:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_octet_string(Bytes1,{1,20},[{tag,128,0,'EXPLICIT',32}], no_length, mandatory), - {{single, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; +'dec_KmeExternalSensorList'(Tlv) -> + 'dec_KmeExternalSensorList'(Tlv, [16]). -%% 'wide' - <<2:2,_:1,1:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_octet_string(Bytes1,{1,40},[{tag,128,1,'EXPLICIT',32}], no_length, mandatory), - {{wide, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; +'dec_KmeExternalSensorList'(Tlv, TagIn) -> + %%------------------------------------------------- + %% decode tag and length + %%------------------------------------------------- +Tlv1 = match_tags(Tlv, TagIn), +['dec_KmeExternalSensorList_SEQOF'(V1, [16]) || V1 <- Tlv1]. - Else -> - case OptOrMand of - mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}}); - _ ->exit({error,{asn1,{no_optional_tag,Else}}}) - end - end. -'dec_KmeExternalSensorList_SEQOF'(Bytes, OptOrMand, TagIn) -> + +'dec_KmeExternalSensorList_SEQOF'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 with type IA5String +%% attribute sensorNo(1) with type IA5String %%------------------------------------------------- - {Term1,Bytes3,Rb2} = ?RT_BER:decode_restricted_string(Bytes2,{1,3},22,[{tag,128,0,'EXPLICIT',32}], no_length, mandatory), +[V1|Tlv2] = Tlv1, +Term1 = begin +Val1 = decode_restricted_string(V1, [131072,22]), +C1 = byte_size(Val1), +if 1 =< C1, C1 =< 3 -> +binary_to_list(Val1); +true -> +exit({error,{asn1,bad_range}}) +end +end, %%------------------------------------------------- -%% attribute number 2 External CSTA-device-identifiers:DeviceID +%% attribute device(2) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {Term2,Bytes4,Rb3} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes3, mandatory, [{tag,128,1,'EXPLICIT',32}]), +[V2|Tlv3] = Tlv2, +Term2 = 'CSTA-device-identifiers':'dec_DeviceID'(V2, [131073,16]), %%------------------------------------------------- -%% attribute number 3 with type CHOICE OPTIONAL +%% attribute name(3) with type CHOICE OPTIONAL %%------------------------------------------------- - {Term3,Bytes5,Rb4} = case Bytes4 of -<<2:2,_:1,2:5,_/binary>> -> -'dec_KmeExternalSensorList_SEQOF_name'(Bytes4, opt_or_default, [{tag,128,2,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes4, 0 } +{Term3,Tlv4} = case Tlv3 of +[{131074,V3}|TempTlv4] -> + {'dec_KmeExternalSensorList_SEQOF_name'(V3, []), TempTlv4}; + _ -> + { asn1_NOVALUE, Tlv3} end, - {Bytes6,Rb5} = ?RT_BER:restbytes2(RemBytes, Bytes5,noext), - {{'KmeExternalSensorList_SEQOF', Term1, Term2, Term3}, Bytes6, Rb1+Rb2+Rb3+Rb4+Rb5}. +case Tlv4 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowed +end, + {'KmeExternalSensorList_SEQOF', Term1, Term2, Term3}. +'dec_KmeExternalSensorList_SEQOF_name'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of -'dec_KmeExternalSensorList'(Bytes, OptOrMand) -> - 'dec_KmeExternalSensorList'(Bytes, OptOrMand, []). +%% 'single' + {131072, V1} -> + {single, begin +Val1 = decode_octet_string(V1, [4]), +C1 = byte_size(Val1), +if 1 =< C1, C1 =< 20 -> +Val1; +true -> +exit({error,{asn1,bad_range}}) +end +end}; -'dec_KmeExternalSensorList'(Bytes, OptOrMand, TagIn) -> - %%------------------------------------------------- - %% decode tag and length - %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), - ?RT_BER:decode_components(Rb1, Len, Bytes1, fun 'dec_KmeExternalSensorList_SEQOF'/3, [], []). +%% 'wide' + {131073, V1} -> + {wide, begin +Val2 = decode_octet_string(V1, [4]), +C2 = byte_size(Val2), +if 1 =< C2, C2 =< 40 -> +Val2; +true -> +exit({error,{asn1,bad_range}}) +end +end}; + Else -> + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. %%================================ %% KmeTenantSpeedDial %%================================ +'enc_KmeTenantSpeedDial'(Val) -> + 'enc_KmeTenantSpeedDial'(Val, [<<48>>]). + 'enc_KmeTenantSpeedDial'(Val, TagIn) -> +{_,Cindex1, Cindex2} = Val, %%------------------------------------------------- -%% attribute number 1 with type INTEGER +%% attribute tenantNo(1) with type INTEGER %%------------------------------------------------- - {EncBytes1,EncLen1} = ?RT_BER:encode_integer([], ?RT_BER:cindex(2,Val,tenantNo), [{tag,128,0,'EXPLICIT',32}]), + {EncBytes1,EncLen1} = encode_integer(Cindex1, [<<2>>,<<160>>]), %%------------------------------------------------- -%% attribute number 2 External KME-specific-types:KmeSpeedDial +%% attribute kmeSpeedDial(2) External KME-specific-types:KmeSpeedDial %%------------------------------------------------- - {EncBytes2,EncLen2} = 'enc_KmeSpeedDial'(?RT_BER:cindex(3,Val,kmeSpeedDial), [{tag,128,1,'EXPLICIT',32}]), + {EncBytes2,EncLen2} = 'enc_KmeSpeedDial'(Cindex2, [<<48>>,<<161>>]), BytesSoFar = [EncBytes1, EncBytes2], - LenSoFar = EncLen1 + EncLen2, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2, +encode_tags(TagIn, BytesSoFar, LenSoFar). -'dec_KmeTenantSpeedDial'(Bytes, OptOrMand) -> - 'dec_KmeTenantSpeedDial'(Bytes, OptOrMand, []). +'dec_KmeTenantSpeedDial'(Tlv) -> + 'dec_KmeTenantSpeedDial'(Tlv, [16]). -'dec_KmeTenantSpeedDial'(Bytes, OptOrMand, TagIn) -> +'dec_KmeTenantSpeedDial'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 with type INTEGER +%% attribute tenantNo(1) with type INTEGER %%------------------------------------------------- - {Term1,Bytes3,Rb2} = ?RT_BER:decode_integer(Bytes2,[],[{tag,128,0,'EXPLICIT',32}], mandatory), +[V1|Tlv2] = Tlv1, +Term1 = decode_integer(V1, [131072,2]), %%------------------------------------------------- -%% attribute number 2 External KME-specific-types:KmeSpeedDial +%% attribute kmeSpeedDial(2) External KME-specific-types:KmeSpeedDial %%------------------------------------------------- - {Term2,Bytes4,Rb3} = 'dec_KmeSpeedDial'(Bytes3, mandatory, [{tag,128,1,'EXPLICIT',32}]), +[V2|Tlv3] = Tlv2, +Term2 = 'dec_KmeSpeedDial'(V2, [131073,16]), + +case Tlv3 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed +end, + {'KmeTenantSpeedDial', Term1, Term2}. - {Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext), - {{'KmeTenantSpeedDial', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}. %%================================ %% KmeDistributionMethod %%================================ +'enc_KmeDistributionMethod'(Val) -> + 'enc_KmeDistributionMethod'(Val, [<<48>>]). + 'enc_KmeDistributionMethod'(Val, TagIn) -> +{_,Cindex1, Cindex2} = Val, %%------------------------------------------------- -%% attribute number 1 External CSTA-device-identifiers:DeviceID +%% attribute group(1) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {EncBytes1,EncLen1} = 'CSTA-device-identifiers':'enc_DeviceID'(?RT_BER:cindex(2,Val,group), []), + {EncBytes1,EncLen1} = 'CSTA-device-identifiers':'enc_DeviceID'(Cindex1, [<<48>>]), %%------------------------------------------------- -%% attribute number 2 with type ENUMERATED +%% attribute type(2) with type ENUMERATED %%------------------------------------------------- - {EncBytes2,EncLen2} = case (case ?RT_BER:cindex(3,Val,type) of {_,Enumval1}->Enumval1;_->?RT_BER:cindex(3,Val,type) end) of -ucd -> ?RT_BER:encode_enumerated(0,[]); -ring -> ?RT_BER:encode_enumerated(1,[]); -hunt -> ?RT_BER:encode_enumerated(2,[]); -Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) + {EncBytes2,EncLen2} = case Cindex2 of +ucd -> encode_tags([<<10>>], [0], 1); +ring -> encode_tags([<<10>>], [1], 1); +hunt -> encode_tags([<<10>>], [2], 1); +Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}}) end, BytesSoFar = [EncBytes1, EncBytes2], - LenSoFar = EncLen1 + EncLen2, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2, +encode_tags(TagIn, BytesSoFar, LenSoFar). -'dec_KmeDistributionMethod'(Bytes, OptOrMand) -> - 'dec_KmeDistributionMethod'(Bytes, OptOrMand, []). +'dec_KmeDistributionMethod'(Tlv) -> + 'dec_KmeDistributionMethod'(Tlv, [16]). -'dec_KmeDistributionMethod'(Bytes, OptOrMand, TagIn) -> +'dec_KmeDistributionMethod'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 External CSTA-device-identifiers:DeviceID +%% attribute group(1) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {Term1,Bytes3,Rb2} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes2, mandatory, []), +[V1|Tlv2] = Tlv1, +Term1 = 'CSTA-device-identifiers':'dec_DeviceID'(V1, [16]), %%------------------------------------------------- -%% attribute number 2 with type ENUMERATED +%% attribute type(2) with type ENUMERATED %%------------------------------------------------- - {Term2,Bytes4,Rb3} = ?RT_BER:decode_enumerated(Bytes3,[],[{ucd,0},{ring,1},{hunt,2}],[], mandatory), +[V2|Tlv3] = Tlv2, +Term2 = case decode_integer(V2, [10]) of +0 -> ucd; +1 -> ring; +2 -> hunt; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end, + +case Tlv3 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed +end, + {'KmeDistributionMethod', Term1, Term2}. - {Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext), - {{'KmeDistributionMethod', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}. %%================================ %% KmePDFStart %%================================ +'enc_KmePDFStart'(Val) -> + 'enc_KmePDFStart'(Val, [<<48>>]). + 'enc_KmePDFStart'(Val, TagIn) -> +{_,Cindex1} = Val, %%------------------------------------------------- -%% attribute number 1 External CSTA-device-identifiers:DeviceID +%% attribute device(1) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {EncBytes1,EncLen1} = 'CSTA-device-identifiers':'enc_DeviceID'(?RT_BER:cindex(2,Val,device), []), + {EncBytes1,EncLen1} = 'CSTA-device-identifiers':'enc_DeviceID'(Cindex1, [<<48>>]), BytesSoFar = [EncBytes1], - LenSoFar = EncLen1, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1, +encode_tags(TagIn, BytesSoFar, LenSoFar). -'dec_KmePDFStart'(Bytes, OptOrMand) -> - 'dec_KmePDFStart'(Bytes, OptOrMand, []). +'dec_KmePDFStart'(Tlv) -> + 'dec_KmePDFStart'(Tlv, [16]). -'dec_KmePDFStart'(Bytes, OptOrMand, TagIn) -> +'dec_KmePDFStart'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 External CSTA-device-identifiers:DeviceID +%% attribute device(1) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {Term1,Bytes3,Rb2} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes2, mandatory, []), +[V1|Tlv2] = Tlv1, +Term1 = 'CSTA-device-identifiers':'dec_DeviceID'(V1, [16]), + +case Tlv2 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv2}}}) % extra fields not allowed +end, + {'KmePDFStart', Term1}. - {Bytes4,Rb3} = ?RT_BER:restbytes2(RemBytes, Bytes3,noext), - {{'KmePDFStart', Term1}, Bytes4, Rb1+Rb2+Rb3}. %%================================ %% KmePDFStop %%================================ - -'enc_KmePDFStop'({'KmePDFStop',Val}, TagIn) -> - 'enc_KmePDFStop'(Val, TagIn); +'enc_KmePDFStop'(Val) -> + 'enc_KmePDFStop'(Val, [<<48>>]). 'enc_KmePDFStop'(Val, TagIn) -> - 'CSTA-device-identifiers':'enc_DeviceID'(Val, TagIn ++ []). + 'CSTA-device-identifiers':'enc_DeviceID'(Val, TagIn). -'dec_KmePDFStop'(Bytes, OptOrMand) -> - 'dec_KmePDFStop'(Bytes, OptOrMand, []). +'dec_KmePDFStop'(Tlv) -> + 'dec_KmePDFStop'(Tlv, [16]). -'dec_KmePDFStop'(Bytes, OptOrMand, TagIn) -> -'CSTA-device-identifiers':'dec_DeviceID'(Bytes, OptOrMand, TagIn++[]). +'dec_KmePDFStop'(Tlv, TagIn) -> +'CSTA-device-identifiers':'dec_DeviceID'(Tlv, TagIn). %%================================ %% KmePDFStatus %%================================ +'enc_KmePDFStatus'(Val) -> + 'enc_KmePDFStatus'(Val, [<<48>>]). + 'enc_KmePDFStatus'(Val, TagIn) -> +{_,Cindex1, Cindex2, Cindex3} = Val, %%------------------------------------------------- -%% attribute number 1 External CSTA-device-identifiers:DeviceID +%% attribute targetDevice(1) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {EncBytes1,EncLen1} = 'CSTA-device-identifiers':'enc_DeviceID'(?RT_BER:cindex(2,Val,targetDevice), []), + {EncBytes1,EncLen1} = 'CSTA-device-identifiers':'enc_DeviceID'(Cindex1, [<<48>>]), %%------------------------------------------------- -%% attribute number 2 External CSTA-device-identifiers:DeviceID +%% attribute originatingDevice(2) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {EncBytes2,EncLen2} = 'CSTA-device-identifiers':'enc_DeviceID'(?RT_BER:cindex(3,Val,originatingDevice), []), + {EncBytes2,EncLen2} = 'CSTA-device-identifiers':'enc_DeviceID'(Cindex2, [<<48>>]), %%------------------------------------------------- -%% attribute number 3 with type BOOLEAN +%% attribute status(3) with type BOOLEAN %%------------------------------------------------- - {EncBytes3,EncLen3} = ?RT_BER:encode_boolean(?RT_BER:cindex(4,Val,status), []), + {EncBytes3,EncLen3} = encode_boolean(Cindex3, [<<1>>]), BytesSoFar = [EncBytes1, EncBytes2, EncBytes3], - LenSoFar = EncLen1 + EncLen2 + EncLen3, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2 + EncLen3, +encode_tags(TagIn, BytesSoFar, LenSoFar). -'dec_KmePDFStatus'(Bytes, OptOrMand) -> - 'dec_KmePDFStatus'(Bytes, OptOrMand, []). +'dec_KmePDFStatus'(Tlv) -> + 'dec_KmePDFStatus'(Tlv, [16]). -'dec_KmePDFStatus'(Bytes, OptOrMand, TagIn) -> +'dec_KmePDFStatus'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 External CSTA-device-identifiers:DeviceID +%% attribute targetDevice(1) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {Term1,Bytes3,Rb2} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes2, mandatory, []), +[V1|Tlv2] = Tlv1, +Term1 = 'CSTA-device-identifiers':'dec_DeviceID'(V1, [16]), %%------------------------------------------------- -%% attribute number 2 External CSTA-device-identifiers:DeviceID +%% attribute originatingDevice(2) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {Term2,Bytes4,Rb3} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes3, mandatory, []), +[V2|Tlv3] = Tlv2, +Term2 = 'CSTA-device-identifiers':'dec_DeviceID'(V2, [16]), %%------------------------------------------------- -%% attribute number 3 with type BOOLEAN +%% attribute status(3) with type BOOLEAN %%------------------------------------------------- - {Term3,Bytes5,Rb4} = ?RT_BER:decode_boolean(Bytes4,[], mandatory), +[V3|Tlv4] = Tlv3, +Term3 = decode_boolean(V3, [1]), + +case Tlv4 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowed +end, + {'KmePDFStatus', Term1, Term2, Term3}. - {Bytes6,Rb5} = ?RT_BER:restbytes2(RemBytes, Bytes5,noext), - {{'KmePDFStatus', Term1, Term2, Term3}, Bytes6, Rb1+Rb2+Rb3+Rb4+Rb5}. %%================================ %% KmePDFSrvEvt %%================================ - -'enc_KmePDFSrvEvt'({'KmePDFSrvEvt',Val}, TagIn) -> - 'enc_KmePDFSrvEvt'(Val, TagIn); +'enc_KmePDFSrvEvt'(Val) -> + 'enc_KmePDFSrvEvt'(Val, []). 'enc_KmePDFSrvEvt'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of pDFStart -> - 'enc_KmePDFStart'(element(2,Val), [{tag,128,0,'EXPLICIT',32}]); + 'enc_KmePDFStart'(element(2,Val), [<<48>>,<<160>>]); pDFStop -> - 'enc_KmePDFStop'(element(2,Val), [{tag,128,1,'EXPLICIT',32}]); + 'enc_KmePDFStop'(element(2,Val), [<<48>>,<<161>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). +encode_tags(TagIn, EncBytes, EncLen). -'dec_KmePDFSrvEvt'(Bytes, OptOrMand) -> - 'dec_KmePDFSrvEvt'(Bytes, OptOrMand, []). +'dec_KmePDFSrvEvt'(Tlv) -> + 'dec_KmePDFSrvEvt'(Tlv, []). -'dec_KmePDFSrvEvt'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of +'dec_KmePDFSrvEvt'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of %% 'pDFStart' - <<2:2,_:1,0:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmePDFStart'(Bytes1, mandatory, [{tag,128,0,'EXPLICIT',32}]), - {{pDFStart, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131072, V1} -> + {pDFStart, 'dec_KmePDFStart'(V1, [16])}; %% 'pDFStop' - <<2:2,_:1,1:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmePDFStop'(Bytes1, mandatory, [{tag,128,1,'EXPLICIT',32}]), - {{pDFStop, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131073, V1} -> + {pDFStop, 'dec_KmePDFStop'(V1, [16])}; Else -> - case OptOrMand of - mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}}); - _ ->exit({error,{asn1,{no_optional_tag,Else}}}) - end - end. + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. %%================================ %% KmeSvmList %%================================ - -'enc_KmeSvmList'({'KmeSvmList',Val}, TagIn) -> - 'enc_KmeSvmList'(Val, TagIn); +'enc_KmeSvmList'(Val) -> + 'enc_KmeSvmList'(Val, [<<48>>]). 'enc_KmeSvmList'(Val, TagIn) -> {EncBytes,EncLen} = 'enc_KmeSvmList_components'(Val,[],0), - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], EncBytes, EncLen). + encode_tags(TagIn, EncBytes, EncLen). 'enc_KmeSvmList_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_KmeSvmList_components'([H|T],AccBytes, AccLen) -> - {EncBytes,EncLen} = 'enc_KmeSvmList_SEQOF'(H, []), + {EncBytes,EncLen} = 'enc_KmeSvmList_SEQOF'(H, [<<48>>]), 'enc_KmeSvmList_components'(T,[EncBytes|AccBytes], AccLen + EncLen). @@ -4222,633 +4628,724 @@ end, %% KmeSvmList_SEQOF %%================================ 'enc_KmeSvmList_SEQOF'(Val, TagIn) -> - + {_,Cindex1, Cindex2} = Val, + %%------------------------------------------------- -%% attribute number 1 External CSTA-device-identifiers:DeviceID +%% attribute device(1) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {EncBytes1,EncLen1} = 'CSTA-device-identifiers':'enc_DeviceID'(?RT_BER:cindex(2,Val,device), []), + {EncBytes1,EncLen1} = 'CSTA-device-identifiers':'enc_DeviceID'(Cindex1, [<<48>>]), %%------------------------------------------------- -%% attribute number 2 External KME-specific-types:KmeExtName OPTIONAL +%% attribute name(2) External KME-specific-types:KmeExtName OPTIONAL %%------------------------------------------------- - {EncBytes2,EncLen2} = case ?RT_BER:cindex(3,Val,name) of + {EncBytes2,EncLen2} = case Cindex2 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_KmeExtName'(?RT_BER:cindex(3,Val,name), []) + 'enc_KmeExtName'(Cindex2, []) end, BytesSoFar = [EncBytes1, EncBytes2], - LenSoFar = EncLen1 + EncLen2, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). -'dec_KmeSvmList_SEQOF'(Bytes, OptOrMand, TagIn) -> +LenSoFar = EncLen1 + EncLen2, +encode_tags(TagIn, BytesSoFar, LenSoFar). + + +'dec_KmeSvmList'(Tlv) -> + 'dec_KmeSvmList'(Tlv, [16]). + +'dec_KmeSvmList'(Tlv, TagIn) -> + %%------------------------------------------------- + %% decode tag and length + %%------------------------------------------------- +Tlv1 = match_tags(Tlv, TagIn), +['dec_KmeSvmList_SEQOF'(V1, [16]) || V1 <- Tlv1]. + + +'dec_KmeSvmList_SEQOF'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 External CSTA-device-identifiers:DeviceID +%% attribute device(1) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {Term1,Bytes3,Rb2} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes2, mandatory, []), +[V1|Tlv2] = Tlv1, +Term1 = 'CSTA-device-identifiers':'dec_DeviceID'(V1, [16]), %%------------------------------------------------- -%% attribute number 2 External KME-specific-types:KmeExtName OPTIONAL +%% attribute name(2) External KME-specific-types:KmeExtName OPTIONAL %%------------------------------------------------- - {Term2,Bytes4,Rb3} = case (catch 'dec_KmeExtName'(Bytes3, opt_or_default, [])) of -{'EXIT',{error,{asn1,{no_optional_tag,_}}}} -> { asn1_NOVALUE, Bytes3, 0 }; -Casetmp1-> Casetmp1 +{Term2,Tlv3} = case Tlv2 of +[V2 = {131072,_}|TempTlv3] -> + {'dec_KmeExtName'(V2, []), TempTlv3}; +[V2 = {131073,_}|TempTlv3] -> + {'dec_KmeExtName'(V2, []), TempTlv3}; + _ -> + { asn1_NOVALUE, Tlv2} end, - {Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext), - {{'KmeSvmList_SEQOF', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}. - - -'dec_KmeSvmList'(Bytes, OptOrMand) -> - 'dec_KmeSvmList'(Bytes, OptOrMand, []). - -'dec_KmeSvmList'(Bytes, OptOrMand, TagIn) -> - %%------------------------------------------------- - %% decode tag and length - %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), - ?RT_BER:decode_components(Rb1, Len, Bytes1, fun 'dec_KmeSvmList_SEQOF'/3, [], []). - +case Tlv3 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed +end, + {'KmeSvmList_SEQOF', Term1, Term2}. %%================================ %% KmeExtName %%================================ - -'enc_KmeExtName'({'KmeExtName',Val}, TagIn) -> - 'enc_KmeExtName'(Val, TagIn); +'enc_KmeExtName'(Val) -> + 'enc_KmeExtName'(Val, []). 'enc_KmeExtName'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of single -> - ?RT_BER:encode_octet_string([], element(2,Val), [{tag,128,0,'EXPLICIT',32}]); + encode_restricted_string(element(2,Val), [<<4>>,<<160>>]); wide -> - ?RT_BER:encode_octet_string([], element(2,Val), [{tag,128,1,'EXPLICIT',32}]); + encode_restricted_string(element(2,Val), [<<4>>,<<161>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). +encode_tags(TagIn, EncBytes, EncLen). -'dec_KmeExtName'(Bytes, OptOrMand) -> - 'dec_KmeExtName'(Bytes, OptOrMand, []). +'dec_KmeExtName'(Tlv) -> + 'dec_KmeExtName'(Tlv, []). -'dec_KmeExtName'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of +'dec_KmeExtName'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of %% 'single' - <<2:2,_:1,0:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_octet_string(Bytes1,{0,20},[{tag,128,0,'EXPLICIT',32}], no_length, mandatory), - {{single, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131072, V1} -> + {single, begin +Val1 = decode_octet_string(V1, [4]), +C1 = byte_size(Val1), +if 0 =< C1, C1 =< 20 -> +Val1; +true -> +exit({error,{asn1,bad_range}}) +end +end}; %% 'wide' - <<2:2,_:1,1:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_octet_string(Bytes1,{0,40},[{tag,128,1,'EXPLICIT',32}], no_length, mandatory), - {{wide, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131073, V1} -> + {wide, begin +Val2 = decode_octet_string(V1, [4]), +C2 = byte_size(Val2), +if 0 =< C2, C2 =< 40 -> +Val2; +true -> +exit({error,{asn1,bad_range}}) +end +end}; Else -> - case OptOrMand of - mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}}); - _ ->exit({error,{asn1,{no_optional_tag,Else}}}) - end - end. + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. %%================================ %% NumberOfMsgPort %%================================ +'enc_NumberOfMsgPort'(Val) -> + 'enc_NumberOfMsgPort'(Val, [<<48>>]). + 'enc_NumberOfMsgPort'(Val, TagIn) -> +{_,Cindex1, Cindex2} = Val, %%------------------------------------------------- -%% attribute number 1 with type INTEGER +%% attribute numberOfMsgPort(1) with type INTEGER %%------------------------------------------------- - {EncBytes1,EncLen1} = ?RT_BER:encode_integer([], ?RT_BER:cindex(2,Val,numberOfMsgPort), []), + {EncBytes1,EncLen1} = encode_integer(Cindex1, [<<2>>]), %%------------------------------------------------- -%% attribute number 2 with type INTEGER +%% attribute numberOfFreePort(2) with type INTEGER %%------------------------------------------------- - {EncBytes2,EncLen2} = ?RT_BER:encode_integer([], ?RT_BER:cindex(3,Val,numberOfFreePort), []), + {EncBytes2,EncLen2} = encode_integer(Cindex2, [<<2>>]), BytesSoFar = [EncBytes1, EncBytes2], - LenSoFar = EncLen1 + EncLen2, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2, +encode_tags(TagIn, BytesSoFar, LenSoFar). -'dec_NumberOfMsgPort'(Bytes, OptOrMand) -> - 'dec_NumberOfMsgPort'(Bytes, OptOrMand, []). +'dec_NumberOfMsgPort'(Tlv) -> + 'dec_NumberOfMsgPort'(Tlv, [16]). -'dec_NumberOfMsgPort'(Bytes, OptOrMand, TagIn) -> +'dec_NumberOfMsgPort'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 with type INTEGER +%% attribute numberOfMsgPort(1) with type INTEGER %%------------------------------------------------- - {Term1,Bytes3,Rb2} = ?RT_BER:decode_integer(Bytes2,[],[], mandatory), +[V1|Tlv2] = Tlv1, +Term1 = decode_integer(V1, [2]), %%------------------------------------------------- -%% attribute number 2 with type INTEGER +%% attribute numberOfFreePort(2) with type INTEGER %%------------------------------------------------- - {Term2,Bytes4,Rb3} = ?RT_BER:decode_integer(Bytes3,[],[], mandatory), +[V2|Tlv3] = Tlv2, +Term2 = decode_integer(V2, [2]), + +case Tlv3 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed +end, + {'NumberOfMsgPort', Term1, Term2}. - {Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext), - {{'NumberOfMsgPort', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}. %%================================ %% KmeDndOverride %%================================ - -'enc_KmeDndOverride'({'KmeDndOverride',Val}, TagIn) -> - 'enc_KmeDndOverride'(Val, TagIn); +'enc_KmeDndOverride'(Val) -> + 'enc_KmeDndOverride'(Val, [<<107>>]). 'enc_KmeDndOverride'(Val, TagIn) -> - 'CSTA-call-connection-identifiers':'enc_ConnectionID'(Val, TagIn ++ []). + 'CSTA-call-connection-identifiers':'enc_ConnectionID'(Val, TagIn). -'dec_KmeDndOverride'(Bytes, OptOrMand) -> - 'dec_KmeDndOverride'(Bytes, OptOrMand, []). +'dec_KmeDndOverride'(Tlv) -> + 'dec_KmeDndOverride'(Tlv, [65547]). -'dec_KmeDndOverride'(Bytes, OptOrMand, TagIn) -> -'CSTA-call-connection-identifiers':'dec_ConnectionID'(Bytes, OptOrMand, TagIn++[]). +'dec_KmeDndOverride'(Tlv, TagIn) -> +'CSTA-call-connection-identifiers':'dec_ConnectionID'(Tlv, TagIn). %%================================ %% KmeInteruptCall %%================================ - -'enc_KmeInteruptCall'({'KmeInteruptCall',Val}, TagIn) -> - 'enc_KmeInteruptCall'(Val, TagIn); +'enc_KmeInteruptCall'(Val) -> + 'enc_KmeInteruptCall'(Val, [<<107>>]). 'enc_KmeInteruptCall'(Val, TagIn) -> - 'CSTA-call-connection-identifiers':'enc_ConnectionID'(Val, TagIn ++ []). + 'CSTA-call-connection-identifiers':'enc_ConnectionID'(Val, TagIn). -'dec_KmeInteruptCall'(Bytes, OptOrMand) -> - 'dec_KmeInteruptCall'(Bytes, OptOrMand, []). +'dec_KmeInteruptCall'(Tlv) -> + 'dec_KmeInteruptCall'(Tlv, [65547]). -'dec_KmeInteruptCall'(Bytes, OptOrMand, TagIn) -> -'CSTA-call-connection-identifiers':'dec_ConnectionID'(Bytes, OptOrMand, TagIn++[]). +'dec_KmeInteruptCall'(Tlv, TagIn) -> +'CSTA-call-connection-identifiers':'dec_ConnectionID'(Tlv, TagIn). %%================================ %% KmeExternalFeatureAccess %%================================ - -'enc_KmeExternalFeatureAccess'({'KmeExternalFeatureAccess',Val}, TagIn) -> - 'enc_KmeExternalFeatureAccess'(Val, TagIn); +'enc_KmeExternalFeatureAccess'(Val) -> + 'enc_KmeExternalFeatureAccess'(Val, [<<107>>]). 'enc_KmeExternalFeatureAccess'(Val, TagIn) -> - 'CSTA-call-connection-identifiers':'enc_ConnectionID'(Val, TagIn ++ []). + 'CSTA-call-connection-identifiers':'enc_ConnectionID'(Val, TagIn). -'dec_KmeExternalFeatureAccess'(Bytes, OptOrMand) -> - 'dec_KmeExternalFeatureAccess'(Bytes, OptOrMand, []). +'dec_KmeExternalFeatureAccess'(Tlv) -> + 'dec_KmeExternalFeatureAccess'(Tlv, [65547]). -'dec_KmeExternalFeatureAccess'(Bytes, OptOrMand, TagIn) -> -'CSTA-call-connection-identifiers':'dec_ConnectionID'(Bytes, OptOrMand, TagIn++[]). +'dec_KmeExternalFeatureAccess'(Tlv, TagIn) -> +'CSTA-call-connection-identifiers':'dec_ConnectionID'(Tlv, TagIn). %%================================ %% KmeTempTollChange %%================================ +'enc_KmeTempTollChange'(Val) -> + 'enc_KmeTempTollChange'(Val, [<<48>>]). + 'enc_KmeTempTollChange'(Val, TagIn) -> +{_,Cindex1, Cindex2} = Val, %%------------------------------------------------- -%% attribute number 1 External CSTA-call-connection-identifiers:ConnectionID +%% attribute connection(1) External CSTA-call-connection-identifiers:ConnectionID %%------------------------------------------------- - {EncBytes1,EncLen1} = 'CSTA-call-connection-identifiers':'enc_ConnectionID'(?RT_BER:cindex(2,Val,connection), []), + {EncBytes1,EncLen1} = 'CSTA-call-connection-identifiers':'enc_ConnectionID'(Cindex1, [<<107>>]), %%------------------------------------------------- -%% attribute number 2 with type INTEGER +%% attribute tollLevel(2) with type INTEGER %%------------------------------------------------- - {EncBytes2,EncLen2} = ?RT_BER:encode_integer([], ?RT_BER:cindex(3,Val,tollLevel), []), + {EncBytes2,EncLen2} = encode_integer(Cindex2, [<<2>>]), BytesSoFar = [EncBytes1, EncBytes2], - LenSoFar = EncLen1 + EncLen2, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2, +encode_tags(TagIn, BytesSoFar, LenSoFar). -'dec_KmeTempTollChange'(Bytes, OptOrMand) -> - 'dec_KmeTempTollChange'(Bytes, OptOrMand, []). +'dec_KmeTempTollChange'(Tlv) -> + 'dec_KmeTempTollChange'(Tlv, [16]). -'dec_KmeTempTollChange'(Bytes, OptOrMand, TagIn) -> +'dec_KmeTempTollChange'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 External CSTA-call-connection-identifiers:ConnectionID +%% attribute connection(1) External CSTA-call-connection-identifiers:ConnectionID %%------------------------------------------------- - {Term1,Bytes3,Rb2} = 'CSTA-call-connection-identifiers':'dec_ConnectionID'(Bytes2, mandatory, []), +[V1|Tlv2] = Tlv1, +Term1 = 'CSTA-call-connection-identifiers':'dec_ConnectionID'(V1, [65547]), %%------------------------------------------------- -%% attribute number 2 with type INTEGER +%% attribute tollLevel(2) with type INTEGER %%------------------------------------------------- - {Term2,Bytes4,Rb3} = ?RT_BER:decode_integer(Bytes3,[],[], mandatory), +[V2|Tlv3] = Tlv2, +Term2 = decode_integer(V2, [2]), + +case Tlv3 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed +end, + {'KmeTempTollChange', Term1, Term2}. - {Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext), - {{'KmeTempTollChange', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}. %%================================ %% KmeDoorOpen %%================================ - -'enc_KmeDoorOpen'({'KmeDoorOpen',Val}, TagIn) -> - 'enc_KmeDoorOpen'(Val, TagIn); +'enc_KmeDoorOpen'(Val) -> + 'enc_KmeDoorOpen'(Val, [<<107>>]). 'enc_KmeDoorOpen'(Val, TagIn) -> - 'CSTA-call-connection-identifiers':'enc_ConnectionID'(Val, TagIn ++ []). + 'CSTA-call-connection-identifiers':'enc_ConnectionID'(Val, TagIn). -'dec_KmeDoorOpen'(Bytes, OptOrMand) -> - 'dec_KmeDoorOpen'(Bytes, OptOrMand, []). +'dec_KmeDoorOpen'(Tlv) -> + 'dec_KmeDoorOpen'(Tlv, [65547]). -'dec_KmeDoorOpen'(Bytes, OptOrMand, TagIn) -> -'CSTA-call-connection-identifiers':'dec_ConnectionID'(Bytes, OptOrMand, TagIn++[]). +'dec_KmeDoorOpen'(Tlv, TagIn) -> +'CSTA-call-connection-identifiers':'dec_ConnectionID'(Tlv, TagIn). %%================================ %% KmeTwoWayRec %%================================ +'enc_KmeTwoWayRec'(Val) -> + 'enc_KmeTwoWayRec'(Val, [<<48>>]). + 'enc_KmeTwoWayRec'(Val, TagIn) -> +{_,Cindex1, Cindex2} = Val, %%------------------------------------------------- -%% attribute number 1 External CSTA-call-connection-identifiers:ConnectionID +%% attribute connection(1) External CSTA-call-connection-identifiers:ConnectionID %%------------------------------------------------- - {EncBytes1,EncLen1} = 'CSTA-call-connection-identifiers':'enc_ConnectionID'(?RT_BER:cindex(2,Val,connection), []), + {EncBytes1,EncLen1} = 'CSTA-call-connection-identifiers':'enc_ConnectionID'(Cindex1, [<<107>>]), %%------------------------------------------------- -%% attribute number 2 with type IA5String +%% attribute vmGroupExtNo(2) with type IA5String %%------------------------------------------------- - {EncBytes2,EncLen2} = ?RT_BER:encode_restricted_string([], ?RT_BER:cindex(3,Val,vmGroupExtNo), 22, []), + {EncBytes2,EncLen2} = encode_restricted_string(Cindex2, [<<22>>]), BytesSoFar = [EncBytes1, EncBytes2], - LenSoFar = EncLen1 + EncLen2, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2, +encode_tags(TagIn, BytesSoFar, LenSoFar). -'dec_KmeTwoWayRec'(Bytes, OptOrMand) -> - 'dec_KmeTwoWayRec'(Bytes, OptOrMand, []). +'dec_KmeTwoWayRec'(Tlv) -> + 'dec_KmeTwoWayRec'(Tlv, [16]). -'dec_KmeTwoWayRec'(Bytes, OptOrMand, TagIn) -> +'dec_KmeTwoWayRec'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 External CSTA-call-connection-identifiers:ConnectionID +%% attribute connection(1) External CSTA-call-connection-identifiers:ConnectionID %%------------------------------------------------- - {Term1,Bytes3,Rb2} = 'CSTA-call-connection-identifiers':'dec_ConnectionID'(Bytes2, mandatory, []), +[V1|Tlv2] = Tlv1, +Term1 = 'CSTA-call-connection-identifiers':'dec_ConnectionID'(V1, [65547]), %%------------------------------------------------- -%% attribute number 2 with type IA5String +%% attribute vmGroupExtNo(2) with type IA5String %%------------------------------------------------- - {Term2,Bytes4,Rb3} = ?RT_BER:decode_restricted_string(Bytes3,{1,5},22,[], no_length, mandatory), +[V2|Tlv3] = Tlv2, +Term2 = begin +Val1 = decode_restricted_string(V2, [22]), +C1 = byte_size(Val1), +if 1 =< C1, C1 =< 5 -> +binary_to_list(Val1); +true -> +exit({error,{asn1,bad_range}}) +end +end, + +case Tlv3 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed +end, + {'KmeTwoWayRec', Term1, Term2}. - {Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext), - {{'KmeTwoWayRec', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}. %%================================ %% KmeCallBackInvokeReq %%================================ +'enc_KmeCallBackInvokeReq'(Val) -> + 'enc_KmeCallBackInvokeReq'(Val, [<<48>>]). + 'enc_KmeCallBackInvokeReq'(Val, TagIn) -> +{_,Cindex1, Cindex2, Cindex3} = Val, %%------------------------------------------------- -%% attribute number 1 with type OCTET STRING +%% attribute callBackID(1) with type OCTET STRING %%------------------------------------------------- - {EncBytes1,EncLen1} = ?RT_BER:encode_octet_string([], ?RT_BER:cindex(2,Val,callBackID), []), + {EncBytes1,EncLen1} = encode_restricted_string(Cindex1, [<<4>>]), %%------------------------------------------------- -%% attribute number 2 External CSTA-device-identifiers:DeviceID +%% attribute requestingDevice(2) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {EncBytes2,EncLen2} = 'CSTA-device-identifiers':'enc_DeviceID'(?RT_BER:cindex(3,Val,requestingDevice), []), + {EncBytes2,EncLen2} = 'CSTA-device-identifiers':'enc_DeviceID'(Cindex2, [<<48>>]), %%------------------------------------------------- -%% attribute number 3 External CSTA-device-identifiers:DeviceID OPTIONAL +%% attribute targetDevice(3) External CSTA-device-identifiers:DeviceID OPTIONAL %%------------------------------------------------- - {EncBytes3,EncLen3} = case ?RT_BER:cindex(4,Val,targetDevice) of + {EncBytes3,EncLen3} = case Cindex3 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'CSTA-device-identifiers':'enc_DeviceID'(?RT_BER:cindex(4,Val,targetDevice), []) + 'CSTA-device-identifiers':'enc_DeviceID'(Cindex3, [<<48>>]) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3], - LenSoFar = EncLen1 + EncLen2 + EncLen3, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2 + EncLen3, +encode_tags(TagIn, BytesSoFar, LenSoFar). -'dec_KmeCallBackInvokeReq'(Bytes, OptOrMand) -> - 'dec_KmeCallBackInvokeReq'(Bytes, OptOrMand, []). +'dec_KmeCallBackInvokeReq'(Tlv) -> + 'dec_KmeCallBackInvokeReq'(Tlv, [16]). -'dec_KmeCallBackInvokeReq'(Bytes, OptOrMand, TagIn) -> +'dec_KmeCallBackInvokeReq'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 with type OCTET STRING +%% attribute callBackID(1) with type OCTET STRING %%------------------------------------------------- - {Term1,Bytes3,Rb2} = ?RT_BER:decode_octet_string(Bytes2,{0,4},[], no_length, mandatory), +[V1|Tlv2] = Tlv1, +Term1 = begin +Val1 = decode_octet_string(V1, [4]), +C1 = byte_size(Val1), +if 0 =< C1, C1 =< 4 -> +Val1; +true -> +exit({error,{asn1,bad_range}}) +end +end, %%------------------------------------------------- -%% attribute number 2 External CSTA-device-identifiers:DeviceID +%% attribute requestingDevice(2) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {Term2,Bytes4,Rb3} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes3, mandatory, []), +[V2|Tlv3] = Tlv2, +Term2 = 'CSTA-device-identifiers':'dec_DeviceID'(V2, [16]), %%------------------------------------------------- -%% attribute number 3 External CSTA-device-identifiers:DeviceID OPTIONAL +%% attribute targetDevice(3) External CSTA-device-identifiers:DeviceID OPTIONAL %%------------------------------------------------- - {Term3,Bytes5,Rb4} = case Bytes4 of -<<0:2,_:1,16:5,_/binary>> -> -'CSTA-device-identifiers':'dec_DeviceID'(Bytes4, opt_or_default, []); -_ -> -{ asn1_NOVALUE, Bytes4, 0 } +{Term3,Tlv4} = case Tlv3 of +[{16,V3}|TempTlv4] -> + {'CSTA-device-identifiers':'dec_DeviceID'(V3, []), TempTlv4}; + _ -> + { asn1_NOVALUE, Tlv3} end, - {Bytes6,Rb5} = ?RT_BER:restbytes2(RemBytes, Bytes5,noext), - {{'KmeCallBackInvokeReq', Term1, Term2, Term3}, Bytes6, Rb1+Rb2+Rb3+Rb4+Rb5}. +case Tlv4 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowed +end, + {'KmeCallBackInvokeReq', Term1, Term2, Term3}. + %%================================ %% KmeCallBackInvokeRsp %%================================ - -'enc_KmeCallBackInvokeRsp'({'KmeCallBackInvokeRsp',Val}, TagIn) -> - 'enc_KmeCallBackInvokeRsp'(Val, TagIn); +'enc_KmeCallBackInvokeRsp'(Val) -> + 'enc_KmeCallBackInvokeRsp'(Val, [<<107>>]). 'enc_KmeCallBackInvokeRsp'(Val, TagIn) -> - 'CSTA-call-connection-identifiers':'enc_ConnectionID'(Val, TagIn ++ []). + 'CSTA-call-connection-identifiers':'enc_ConnectionID'(Val, TagIn). -'dec_KmeCallBackInvokeRsp'(Bytes, OptOrMand) -> - 'dec_KmeCallBackInvokeRsp'(Bytes, OptOrMand, []). +'dec_KmeCallBackInvokeRsp'(Tlv) -> + 'dec_KmeCallBackInvokeRsp'(Tlv, [65547]). -'dec_KmeCallBackInvokeRsp'(Bytes, OptOrMand, TagIn) -> -'CSTA-call-connection-identifiers':'dec_ConnectionID'(Bytes, OptOrMand, TagIn++[]). +'dec_KmeCallBackInvokeRsp'(Tlv, TagIn) -> +'CSTA-call-connection-identifiers':'dec_ConnectionID'(Tlv, TagIn). %%================================ %% CallBackNotification %%================================ +'enc_CallBackNotification'(Val) -> + 'enc_CallBackNotification'(Val, [<<48>>]). + 'enc_CallBackNotification'(Val, TagIn) -> +{_,Cindex1, Cindex2, Cindex3, Cindex4} = Val, %%------------------------------------------------- -%% attribute number 1 with type OCTET STRING +%% attribute callBackID(1) with type OCTET STRING %%------------------------------------------------- - {EncBytes1,EncLen1} = ?RT_BER:encode_octet_string([], ?RT_BER:cindex(2,Val,callBackID), []), + {EncBytes1,EncLen1} = encode_restricted_string(Cindex1, [<<4>>]), %%------------------------------------------------- -%% attribute number 2 with type BOOLEAN +%% attribute prompted(2) with type BOOLEAN %%------------------------------------------------- - {EncBytes2,EncLen2} = ?RT_BER:encode_boolean(?RT_BER:cindex(3,Val,prompted), []), + {EncBytes2,EncLen2} = encode_boolean(Cindex2, [<<1>>]), %%------------------------------------------------- -%% attribute number 3 External CSTA-device-identifiers:DeviceID +%% attribute requestingDevice(3) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {EncBytes3,EncLen3} = 'CSTA-device-identifiers':'enc_DeviceID'(?RT_BER:cindex(4,Val,requestingDevice), []), + {EncBytes3,EncLen3} = 'CSTA-device-identifiers':'enc_DeviceID'(Cindex3, [<<48>>]), %%------------------------------------------------- -%% attribute number 4 External CSTA-device-identifiers:SubjectDeviceID +%% attribute targetDevice(4) External CSTA-device-identifiers:SubjectDeviceID %%------------------------------------------------- - {EncBytes4,EncLen4} = 'CSTA-device-identifiers':'enc_SubjectDeviceID'(?RT_BER:cindex(5,Val,targetDevice), []), + {EncBytes4,EncLen4} = 'CSTA-device-identifiers':'enc_SubjectDeviceID'(Cindex4, [<<99>>]), BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4], - LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4, +encode_tags(TagIn, BytesSoFar, LenSoFar). -'dec_CallBackNotification'(Bytes, OptOrMand) -> - 'dec_CallBackNotification'(Bytes, OptOrMand, []). +'dec_CallBackNotification'(Tlv) -> + 'dec_CallBackNotification'(Tlv, [16]). -'dec_CallBackNotification'(Bytes, OptOrMand, TagIn) -> +'dec_CallBackNotification'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 with type OCTET STRING +%% attribute callBackID(1) with type OCTET STRING %%------------------------------------------------- - {Term1,Bytes3,Rb2} = ?RT_BER:decode_octet_string(Bytes2,{0,4},[], no_length, mandatory), +[V1|Tlv2] = Tlv1, +Term1 = begin +Val1 = decode_octet_string(V1, [4]), +C1 = byte_size(Val1), +if 0 =< C1, C1 =< 4 -> +Val1; +true -> +exit({error,{asn1,bad_range}}) +end +end, %%------------------------------------------------- -%% attribute number 2 with type BOOLEAN +%% attribute prompted(2) with type BOOLEAN %%------------------------------------------------- - {Term2,Bytes4,Rb3} = ?RT_BER:decode_boolean(Bytes3,[], mandatory), +[V2|Tlv3] = Tlv2, +Term2 = decode_boolean(V2, [1]), %%------------------------------------------------- -%% attribute number 3 External CSTA-device-identifiers:DeviceID +%% attribute requestingDevice(3) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {Term3,Bytes5,Rb4} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes4, mandatory, []), +[V3|Tlv4] = Tlv3, +Term3 = 'CSTA-device-identifiers':'dec_DeviceID'(V3, [16]), %%------------------------------------------------- -%% attribute number 4 External CSTA-device-identifiers:SubjectDeviceID +%% attribute targetDevice(4) External CSTA-device-identifiers:SubjectDeviceID %%------------------------------------------------- - {Term4,Bytes6,Rb5} = 'CSTA-device-identifiers':'dec_SubjectDeviceID'(Bytes5, mandatory, []), +[V4|Tlv5] = Tlv4, +Term4 = 'CSTA-device-identifiers':'dec_SubjectDeviceID'(V4, [65539]), + +case Tlv5 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv5}}}) % extra fields not allowed +end, + {'CallBackNotification', Term1, Term2, Term3, Term4}. - {Bytes7,Rb6} = ?RT_BER:restbytes2(RemBytes, Bytes6,noext), - {{'CallBackNotification', Term1, Term2, Term3, Term4}, Bytes7, Rb1+Rb2+Rb3+Rb4+Rb5+Rb6}. %%================================ %% KmeCallBackInvoke %%================================ - -'enc_KmeCallBackInvoke'({'KmeCallBackInvoke',Val}, TagIn) -> - 'enc_KmeCallBackInvoke'(Val, TagIn); +'enc_KmeCallBackInvoke'(Val) -> + 'enc_KmeCallBackInvoke'(Val, []). 'enc_KmeCallBackInvoke'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of request -> - 'enc_KmeCallBackInvokeReq'(element(2,Val), []); + 'enc_KmeCallBackInvokeReq'(element(2,Val), [<<48>>]); result -> - 'enc_KmeCallBackInvokeRsp'(element(2,Val), []); + 'enc_KmeCallBackInvokeRsp'(element(2,Val), [<<107>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). +encode_tags(TagIn, EncBytes, EncLen). -'dec_KmeCallBackInvoke'(Bytes, OptOrMand) -> - 'dec_KmeCallBackInvoke'(Bytes, OptOrMand, []). +'dec_KmeCallBackInvoke'(Tlv) -> + 'dec_KmeCallBackInvoke'(Tlv, []). -'dec_KmeCallBackInvoke'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of +'dec_KmeCallBackInvoke'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of %% 'request' - <<0:2,_:1,16:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeCallBackInvokeReq'(Bytes1, mandatory, []), - {{request, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {16, V1} -> + {request, 'dec_KmeCallBackInvokeReq'(V1, [])}; %% 'result' - <<1:2,_:1,11:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeCallBackInvokeRsp'(Bytes1, mandatory, []), - {{result, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {65547, V1} -> + {result, 'dec_KmeCallBackInvokeRsp'(V1, [])}; Else -> - case OptOrMand of - mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}}); - _ ->exit({error,{asn1,{no_optional_tag,Else}}}) - end - end. + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. %%================================ %% KmePcRec %%================================ +'enc_KmePcRec'(Val) -> + 'enc_KmePcRec'(Val, [<<48>>]). + 'enc_KmePcRec'(Val, TagIn) -> +{_,Cindex1, Cindex2} = Val, %%------------------------------------------------- -%% attribute number 1 External CSTA-call-connection-identifiers:ConnectionID +%% attribute connection(1) External CSTA-call-connection-identifiers:ConnectionID %%------------------------------------------------- - {EncBytes1,EncLen1} = 'CSTA-call-connection-identifiers':'enc_ConnectionID'(?RT_BER:cindex(2,Val,connection), []), + {EncBytes1,EncLen1} = 'CSTA-call-connection-identifiers':'enc_ConnectionID'(Cindex1, [<<107>>]), %%------------------------------------------------- -%% attribute number 2 with type BOOLEAN +%% attribute pcRecOn(2) with type BOOLEAN %%------------------------------------------------- - {EncBytes2,EncLen2} = ?RT_BER:encode_boolean(?RT_BER:cindex(3,Val,pcRecOn), []), + {EncBytes2,EncLen2} = encode_boolean(Cindex2, [<<1>>]), BytesSoFar = [EncBytes1, EncBytes2], - LenSoFar = EncLen1 + EncLen2, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2, +encode_tags(TagIn, BytesSoFar, LenSoFar). -'dec_KmePcRec'(Bytes, OptOrMand) -> - 'dec_KmePcRec'(Bytes, OptOrMand, []). +'dec_KmePcRec'(Tlv) -> + 'dec_KmePcRec'(Tlv, [16]). -'dec_KmePcRec'(Bytes, OptOrMand, TagIn) -> +'dec_KmePcRec'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 External CSTA-call-connection-identifiers:ConnectionID +%% attribute connection(1) External CSTA-call-connection-identifiers:ConnectionID %%------------------------------------------------- - {Term1,Bytes3,Rb2} = 'CSTA-call-connection-identifiers':'dec_ConnectionID'(Bytes2, mandatory, []), +[V1|Tlv2] = Tlv1, +Term1 = 'CSTA-call-connection-identifiers':'dec_ConnectionID'(V1, [65547]), %%------------------------------------------------- -%% attribute number 2 with type BOOLEAN +%% attribute pcRecOn(2) with type BOOLEAN %%------------------------------------------------- - {Term2,Bytes4,Rb3} = ?RT_BER:decode_boolean(Bytes3,[], mandatory), +[V2|Tlv3] = Tlv2, +Term2 = decode_boolean(V2, [1]), + +case Tlv3 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed +end, + {'KmePcRec', Term1, Term2}. - {Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext), - {{'KmePcRec', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}. %%================================ %% KmeDeviceAgentStatus %%================================ +'enc_KmeDeviceAgentStatus'(Val) -> + 'enc_KmeDeviceAgentStatus'(Val, [<<48>>]). + 'enc_KmeDeviceAgentStatus'(Val, TagIn) -> +{_,Cindex1, Cindex2, Cindex3} = Val, %%------------------------------------------------- -%% attribute number 1 External CSTA-device-identifiers:DeviceID +%% attribute device(1) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {EncBytes1,EncLen1} = 'CSTA-device-identifiers':'enc_DeviceID'(?RT_BER:cindex(2,Val,device), [{tag,128,0,'EXPLICIT',32}]), + {EncBytes1,EncLen1} = 'CSTA-device-identifiers':'enc_DeviceID'(Cindex1, [<<48>>,<<160>>]), %%------------------------------------------------- -%% attribute number 2 with type ENUMERATED +%% attribute status(2) with type ENUMERATED %%------------------------------------------------- - {EncBytes2,EncLen2} = case (case ?RT_BER:cindex(3,Val,status) of {_,Enumval1}->Enumval1;_->?RT_BER:cindex(3,Val,status) end) of -logout -> ?RT_BER:encode_enumerated(0,[{tag,128,1,'EXPLICIT',32}]); -login -> ?RT_BER:encode_enumerated(1,[{tag,128,1,'EXPLICIT',32}]); -Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) + {EncBytes2,EncLen2} = case Cindex2 of +logout -> encode_tags([<<10>>,<<161>>], [0], 1); +login -> encode_tags([<<10>>,<<161>>], [1], 1); +Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}}) end, %%------------------------------------------------- -%% attribute number 3 External CSTA-device-identifiers:DeviceID +%% attribute imcomingGroup(3) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {EncBytes3,EncLen3} = 'CSTA-device-identifiers':'enc_DeviceID'(?RT_BER:cindex(4,Val,imcomingGroup), [{tag,128,2,'EXPLICIT',32}]), + {EncBytes3,EncLen3} = 'CSTA-device-identifiers':'enc_DeviceID'(Cindex3, [<<48>>,<<162>>]), BytesSoFar = [EncBytes1, EncBytes2, EncBytes3], - LenSoFar = EncLen1 + EncLen2 + EncLen3, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2 + EncLen3, +encode_tags(TagIn, BytesSoFar, LenSoFar). -'dec_KmeDeviceAgentStatus'(Bytes, OptOrMand) -> - 'dec_KmeDeviceAgentStatus'(Bytes, OptOrMand, []). +'dec_KmeDeviceAgentStatus'(Tlv) -> + 'dec_KmeDeviceAgentStatus'(Tlv, [16]). -'dec_KmeDeviceAgentStatus'(Bytes, OptOrMand, TagIn) -> +'dec_KmeDeviceAgentStatus'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 External CSTA-device-identifiers:DeviceID +%% attribute device(1) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {Term1,Bytes3,Rb2} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes2, mandatory, [{tag,128,0,'EXPLICIT',32}]), +[V1|Tlv2] = Tlv1, +Term1 = 'CSTA-device-identifiers':'dec_DeviceID'(V1, [131072,16]), %%------------------------------------------------- -%% attribute number 2 with type ENUMERATED +%% attribute status(2) with type ENUMERATED %%------------------------------------------------- - {Term2,Bytes4,Rb3} = ?RT_BER:decode_enumerated(Bytes3,[],[{logout,0},{login,1}],[{tag,128,1,'EXPLICIT',32}], mandatory), +[V2|Tlv3] = Tlv2, +Term2 = case decode_integer(V2, [131073,10]) of +0 -> logout; +1 -> login; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end, %%------------------------------------------------- -%% attribute number 3 External CSTA-device-identifiers:DeviceID +%% attribute imcomingGroup(3) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {Term3,Bytes5,Rb4} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes4, mandatory, [{tag,128,2,'EXPLICIT',32}]), +[V3|Tlv4] = Tlv3, +Term3 = 'CSTA-device-identifiers':'dec_DeviceID'(V3, [131074,16]), + +case Tlv4 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowed +end, + {'KmeDeviceAgentStatus', Term1, Term2, Term3}. - {Bytes6,Rb5} = ?RT_BER:restbytes2(RemBytes, Bytes5,noext), - {{'KmeDeviceAgentStatus', Term1, Term2, Term3}, Bytes6, Rb1+Rb2+Rb3+Rb4+Rb5}. %%================================ %% KmeDeviceCallStatus %%================================ - -'enc_KmeDeviceCallStatus'({'KmeDeviceCallStatus',Val}, TagIn) -> - 'enc_KmeDeviceCallStatus'(Val, TagIn); +'enc_KmeDeviceCallStatus'(Val) -> + 'enc_KmeDeviceCallStatus'(Val, [<<48>>]). 'enc_KmeDeviceCallStatus'(Val, TagIn) -> {EncBytes,EncLen} = 'enc_KmeDeviceCallStatus_components'(Val,[],0), - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], EncBytes, EncLen). + encode_tags(TagIn, EncBytes, EncLen). 'enc_KmeDeviceCallStatus_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_KmeDeviceCallStatus_components'([H|T],AccBytes, AccLen) -> - {EncBytes,EncLen} = 'enc_KmeDeviceCallStatus_SEQOF'(H, []), + {EncBytes,EncLen} = 'enc_KmeDeviceCallStatus_SEQOF'(H, [<<48>>]), 'enc_KmeDeviceCallStatus_components'(T,[EncBytes|AccBytes], AccLen + EncLen). @@ -4858,47 +5355,44 @@ end, %% KmeDeviceCallStatus_SEQOF %%================================ 'enc_KmeDeviceCallStatus_SEQOF'(Val, TagIn) -> - + {_,Cindex1, Cindex2} = Val, + %%------------------------------------------------- -%% attribute number 1 External CSTA-device-identifiers:DeviceID +%% attribute device(1) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {EncBytes1,EncLen1} = 'CSTA-device-identifiers':'enc_DeviceID'(?RT_BER:cindex(2,Val,device), [{tag,128,0,'EXPLICIT',32}]), + {EncBytes1,EncLen1} = 'CSTA-device-identifiers':'enc_DeviceID'(Cindex1, [<<48>>,<<160>>]), %%------------------------------------------------- -%% attribute number 2 with type CHOICE +%% attribute status(2) with type CHOICE %%------------------------------------------------- - {EncBytes2,EncLen2} = 'enc_KmeDeviceCallStatus_SEQOF_status'(?RT_BER:cindex(3,Val,status), [{tag,128,1,'EXPLICIT',32}]), + {EncBytes2,EncLen2} = 'enc_KmeDeviceCallStatus_SEQOF_status'(Cindex2, [<<161>>]), BytesSoFar = [EncBytes1, EncBytes2], - LenSoFar = EncLen1 + EncLen2, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2, +encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% KmeDeviceCallStatus_SEQOF_status %%================================ - -'enc_KmeDeviceCallStatus_SEQOF_status'({'KmeDeviceCallStatus_SEQOF_status',Val}, TagIn) -> - 'enc_KmeDeviceCallStatus_SEQOF_status'(Val, TagIn); - 'enc_KmeDeviceCallStatus_SEQOF_status'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of lineStatus -> - case (case element(2,Val) of {_,Enumval1}->Enumval1;_->element(2,Val) end) of -idle -> ?RT_BER:encode_enumerated(0,[{tag,128,0,'EXPLICIT',32}]); -ring -> ?RT_BER:encode_enumerated(1,[{tag,128,0,'EXPLICIT',32}]); -busy -> ?RT_BER:encode_enumerated(2,[{tag,128,0,'EXPLICIT',32}]); -hold -> ?RT_BER:encode_enumerated(3,[{tag,128,0,'EXPLICIT',32}]); -Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) + case element(2,Val) of +idle -> encode_tags([<<10>>,<<160>>], [0], 1); +ring -> encode_tags([<<10>>,<<160>>], [1], 1); +busy -> encode_tags([<<10>>,<<160>>], [2], 1); +hold -> encode_tags([<<10>>,<<160>>], [3], 1); +Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}}) end; parkStatus -> - 'enc_KmeDeviceCallStatus_SEQOF_status_parkStatus'(element(2,Val), [{tag,128,1,'EXPLICIT',32}]); + 'enc_KmeDeviceCallStatus_SEQOF_status_parkStatus'(element(2,Val), [<<48>>,<<161>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). +encode_tags(TagIn, EncBytes, EncLen). @@ -4908,391 +5402,439 @@ end; %% KmeDeviceCallStatus_SEQOF_status_parkStatus %%================================ 'enc_KmeDeviceCallStatus_SEQOF_status_parkStatus'(Val, TagIn) -> - + {_,Cindex1, Cindex2, Cindex3} = Val, + %%------------------------------------------------- -%% attribute number 1 with type INTEGER +%% attribute area(1) with type INTEGER %%------------------------------------------------- - {EncBytes1,EncLen1} = ?RT_BER:encode_integer([], ?RT_BER:cindex(2,Val,area), [{tag,128,0,'EXPLICIT',32}]), + {EncBytes1,EncLen1} = encode_integer(Cindex1, [<<2>>,<<160>>]), %%------------------------------------------------- -%% attribute number 2 with type OCTET STRING +%% attribute call(2) with type OCTET STRING %%------------------------------------------------- - {EncBytes2,EncLen2} = ?RT_BER:encode_octet_string([], ?RT_BER:cindex(3,Val,call), [{tag,128,1,'EXPLICIT',32}]), + {EncBytes2,EncLen2} = encode_restricted_string(Cindex2, [<<4>>,<<161>>]), %%------------------------------------------------- -%% attribute number 3 with type ENUMERATED +%% attribute action(3) with type ENUMERATED %%------------------------------------------------- - {EncBytes3,EncLen3} = case (case ?RT_BER:cindex(4,Val,action) of {_,Enumval3}->Enumval3;_->?RT_BER:cindex(4,Val,action) end) of -parkin -> ?RT_BER:encode_enumerated(0,[]); -parkout -> ?RT_BER:encode_enumerated(1,[]); -Enumval4 -> exit({error,{asn1, {enumerated_not_in_range,Enumval4}}}) + {EncBytes3,EncLen3} = case Cindex3 of +parkin -> encode_tags([<<10>>], [0], 1); +parkout -> encode_tags([<<10>>], [1], 1); +Enumval3 -> exit({error,{asn1, {enumerated_not_in_range,Enumval3}}}) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3], - LenSoFar = EncLen1 + EncLen2 + EncLen3, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). -'dec_KmeDeviceCallStatus_SEQOF_status_parkStatus'(Bytes, OptOrMand, TagIn) -> +LenSoFar = EncLen1 + EncLen2 + EncLen3, +encode_tags(TagIn, BytesSoFar, LenSoFar). + + +'dec_KmeDeviceCallStatus'(Tlv) -> + 'dec_KmeDeviceCallStatus'(Tlv, [16]). + +'dec_KmeDeviceCallStatus'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), +['dec_KmeDeviceCallStatus_SEQOF'(V1, [16]) || V1 <- Tlv1]. -%%------------------------------------------------- -%% attribute number 1 with type INTEGER -%%------------------------------------------------- - {Term1,Bytes3,Rb2} = ?RT_BER:decode_integer(Bytes2,{0,999},[{tag,128,0,'EXPLICIT',32}], mandatory), + +'dec_KmeDeviceCallStatus_SEQOF'(Tlv, TagIn) -> + %%------------------------------------------------- + %% decode tag and length + %%------------------------------------------------- +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 2 with type OCTET STRING +%% attribute device(1) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {Term2,Bytes4,Rb3} = ?RT_BER:decode_octet_string(Bytes3,[],[{tag,128,1,'EXPLICIT',32}], no_length, mandatory), +[V1|Tlv2] = Tlv1, +Term1 = 'CSTA-device-identifiers':'dec_DeviceID'(V1, [131072,16]), %%------------------------------------------------- -%% attribute number 3 with type ENUMERATED +%% attribute status(2) with type CHOICE %%------------------------------------------------- - {Term3,Bytes5,Rb4} = ?RT_BER:decode_enumerated(Bytes4,[],[{parkin,0},{parkout,1}],[], mandatory), +[V2|Tlv3] = Tlv2, +Term2 = 'dec_KmeDeviceCallStatus_SEQOF_status'(V2, [131073]), - {Bytes6,Rb5} = ?RT_BER:restbytes2(RemBytes, Bytes5,noext), - {{'KmeDeviceCallStatus_SEQOF_status_parkStatus', Term1, Term2, Term3}, Bytes6, Rb1+Rb2+Rb3+Rb4+Rb5}. -'dec_KmeDeviceCallStatus_SEQOF_status'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of +case Tlv3 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed +end, + {'KmeDeviceCallStatus_SEQOF', Term1, Term2}. + +'dec_KmeDeviceCallStatus_SEQOF_status'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of %% 'lineStatus' - <<2:2,_:1,0:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_enumerated(Bytes1,[],[{idle,0},{ring,1},{busy,2},{hold,3}],[{tag,128,0,'EXPLICIT',32}], mandatory), - {{lineStatus, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131072, V1} -> + {lineStatus, case decode_integer(V1, [10]) of +0 -> idle; +1 -> ring; +2 -> busy; +3 -> hold; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end}; %% 'parkStatus' - <<2:2,_:1,1:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeDeviceCallStatus_SEQOF_status_parkStatus'(Bytes1, mandatory, [{tag,128,1,'EXPLICIT',32}]), - {{parkStatus, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131073, V1} -> + {parkStatus, 'dec_KmeDeviceCallStatus_SEQOF_status_parkStatus'(V1, [16])}; Else -> - case OptOrMand of - mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}}); - _ ->exit({error,{asn1,{no_optional_tag,Else}}}) - end - end. -'dec_KmeDeviceCallStatus_SEQOF'(Bytes, OptOrMand, TagIn) -> + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. +'dec_KmeDeviceCallStatus_SEQOF_status_parkStatus'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 External CSTA-device-identifiers:DeviceID +%% attribute area(1) with type INTEGER %%------------------------------------------------- - {Term1,Bytes3,Rb2} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes2, mandatory, [{tag,128,0,'EXPLICIT',32}]), +[V1|Tlv2] = Tlv1, +Term1 = begin +Val1 = decode_integer(V1, [131072,2]), +if 0 =< Val1, Val1 =< 999 -> +Val1; +true -> +exit({error,{asn1,bad_range}}) +end +end, %%------------------------------------------------- -%% attribute number 2 with type CHOICE +%% attribute call(2) with type OCTET STRING %%------------------------------------------------- - {Term2,Bytes4,Rb3} = 'dec_KmeDeviceCallStatus_SEQOF_status'(Bytes3, mandatory, [{tag,128,1,'EXPLICIT',32}]), - - {Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext), - {{'KmeDeviceCallStatus_SEQOF', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}. +[V2|Tlv3] = Tlv2, +Term2 = decode_octet_string(V2, [131073,4]), +%%------------------------------------------------- +%% attribute action(3) with type ENUMERATED +%%------------------------------------------------- +[V3|Tlv4] = Tlv3, +Term3 = case decode_integer(V3, [10]) of +0 -> parkin; +1 -> parkout; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end, -'dec_KmeDeviceCallStatus'(Bytes, OptOrMand) -> - 'dec_KmeDeviceCallStatus'(Bytes, OptOrMand, []). - -'dec_KmeDeviceCallStatus'(Bytes, OptOrMand, TagIn) -> - %%------------------------------------------------- - %% decode tag and length - %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), - ?RT_BER:decode_components(Rb1, Len, Bytes1, fun 'dec_KmeDeviceCallStatus_SEQOF'/3, [], []). - +case Tlv4 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowed +end, + {'KmeDeviceCallStatus_SEQOF_status_parkStatus', Term1, Term2, Term3}. %%================================ %% KmeDeviceServiceStatus %%================================ +'enc_KmeDeviceServiceStatus'(Val) -> + 'enc_KmeDeviceServiceStatus'(Val, [<<48>>]). + 'enc_KmeDeviceServiceStatus'(Val, TagIn) -> +{_,Cindex1, Cindex2} = Val, %%------------------------------------------------- -%% attribute number 1 with type CHOICE +%% attribute source(1) with type CHOICE %%------------------------------------------------- - {EncBytes1,EncLen1} = 'enc_KmeDeviceServiceStatus_source'(?RT_BER:cindex(2,Val,source), [{tag,128,0,'EXPLICIT',32}]), + {EncBytes1,EncLen1} = 'enc_KmeDeviceServiceStatus_source'(Cindex1, [<<160>>]), %%------------------------------------------------- -%% attribute number 2 with type ENUMERATED +%% attribute status(2) with type ENUMERATED %%------------------------------------------------- - {EncBytes2,EncLen2} = case (case ?RT_BER:cindex(3,Val,status) of {_,Enumval1}->Enumval1;_->?RT_BER:cindex(3,Val,status) end) of -ous -> ?RT_BER:encode_enumerated(0,[{tag,128,1,'EXPLICIT',32}]); -ins -> ?RT_BER:encode_enumerated(1,[{tag,128,1,'EXPLICIT',32}]); -Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) + {EncBytes2,EncLen2} = case Cindex2 of +ous -> encode_tags([<<10>>,<<161>>], [0], 1); +ins -> encode_tags([<<10>>,<<161>>], [1], 1); +Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}}) end, BytesSoFar = [EncBytes1, EncBytes2], - LenSoFar = EncLen1 + EncLen2, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2, +encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% KmeDeviceServiceStatus_source %%================================ - -'enc_KmeDeviceServiceStatus_source'({'KmeDeviceServiceStatus_source',Val}, TagIn) -> - 'enc_KmeDeviceServiceStatus_source'(Val, TagIn); - 'enc_KmeDeviceServiceStatus_source'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of device -> - 'CSTA-device-identifiers':'enc_DeviceID'(element(2,Val), [{tag,128,0,'EXPLICIT',32}]); + 'CSTA-device-identifiers':'enc_DeviceID'(element(2,Val), [<<48>>,<<160>>]); cabinet -> - ?RT_BER:encode_integer([], element(2,Val), [{tag,128,1,'EXPLICIT',32}]); + encode_integer(element(2,Val), [<<2>>,<<161>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). +encode_tags(TagIn, EncBytes, EncLen). -'dec_KmeDeviceServiceStatus_source'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of - -%% 'device' - <<2:2,_:1,0:5,_/binary>> -> - {Dec, Rest, RbCho} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes1, mandatory, [{tag,128,0,'EXPLICIT',32}]), - {{device, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; -%% 'cabinet' - <<2:2,_:1,1:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_integer(Bytes1,[],[{tag,128,1,'EXPLICIT',32}], mandatory), - {{cabinet, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; +'dec_KmeDeviceServiceStatus'(Tlv) -> + 'dec_KmeDeviceServiceStatus'(Tlv, [16]). - Else -> - case OptOrMand of - mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}}); - _ ->exit({error,{asn1,{no_optional_tag,Else}}}) - end - end. - - -'dec_KmeDeviceServiceStatus'(Bytes, OptOrMand) -> - 'dec_KmeDeviceServiceStatus'(Bytes, OptOrMand, []). - -'dec_KmeDeviceServiceStatus'(Bytes, OptOrMand, TagIn) -> +'dec_KmeDeviceServiceStatus'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 with type CHOICE +%% attribute source(1) with type CHOICE %%------------------------------------------------- - {Term1,Bytes3,Rb2} = 'dec_KmeDeviceServiceStatus_source'(Bytes2, mandatory, [{tag,128,0,'EXPLICIT',32}]), +[V1|Tlv2] = Tlv1, +Term1 = 'dec_KmeDeviceServiceStatus_source'(V1, [131072]), %%------------------------------------------------- -%% attribute number 2 with type ENUMERATED +%% attribute status(2) with type ENUMERATED %%------------------------------------------------- - {Term2,Bytes4,Rb3} = ?RT_BER:decode_enumerated(Bytes3,[],[{ous,0},{ins,1}],[{tag,128,1,'EXPLICIT',32}], mandatory), +[V2|Tlv3] = Tlv2, +Term2 = case decode_integer(V2, [131073,10]) of +0 -> ous; +1 -> ins; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end, + +case Tlv3 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed +end, + {'KmeDeviceServiceStatus', Term1, Term2}. + +'dec_KmeDeviceServiceStatus_source'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of + +%% 'device' + {131072, V1} -> + {device, 'CSTA-device-identifiers':'dec_DeviceID'(V1, [16])}; + + +%% 'cabinet' + {131073, V1} -> + {cabinet, decode_integer(V1, [2])}; - {Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext), - {{'KmeDeviceServiceStatus', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}. + Else -> + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. %%================================ %% KmeLineStatus %%================================ +'enc_KmeLineStatus'(Val) -> + 'enc_KmeLineStatus'(Val, [<<48>>]). + 'enc_KmeLineStatus'(Val, TagIn) -> +{_,Cindex1, Cindex2} = Val, %%------------------------------------------------- -%% attribute number 1 with type ENUMERATED +%% attribute segmentId(1) with type ENUMERATED %%------------------------------------------------- - {EncBytes1,EncLen1} = case (case ?RT_BER:cindex(2,Val,segmentId) of {_,Enumval1}->Enumval1;_->?RT_BER:cindex(2,Val,segmentId) end) of -wired1 -> ?RT_BER:encode_enumerated(0,[]); -wired2 -> ?RT_BER:encode_enumerated(1,[]); -wireless -> ?RT_BER:encode_enumerated(2,[]); -trunk -> ?RT_BER:encode_enumerated(3,[]); -Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) + {EncBytes1,EncLen1} = case Cindex1 of +wired1 -> encode_tags([<<10>>], [0], 1); +wired2 -> encode_tags([<<10>>], [1], 1); +wireless -> encode_tags([<<10>>], [2], 1); +trunk -> encode_tags([<<10>>], [3], 1); +Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}}) end, %%------------------------------------------------- -%% attribute number 2 with type OCTET STRING +%% attribute lineInformation(2) with type OCTET STRING %%------------------------------------------------- - {EncBytes2,EncLen2} = ?RT_BER:encode_octet_string([], ?RT_BER:cindex(3,Val,lineInformation), []), + {EncBytes2,EncLen2} = encode_restricted_string(Cindex2, [<<4>>]), BytesSoFar = [EncBytes1, EncBytes2], - LenSoFar = EncLen1 + EncLen2, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2, +encode_tags(TagIn, BytesSoFar, LenSoFar). -'dec_KmeLineStatus'(Bytes, OptOrMand) -> - 'dec_KmeLineStatus'(Bytes, OptOrMand, []). +'dec_KmeLineStatus'(Tlv) -> + 'dec_KmeLineStatus'(Tlv, [16]). -'dec_KmeLineStatus'(Bytes, OptOrMand, TagIn) -> +'dec_KmeLineStatus'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 with type ENUMERATED +%% attribute segmentId(1) with type ENUMERATED %%------------------------------------------------- - {Term1,Bytes3,Rb2} = ?RT_BER:decode_enumerated(Bytes2,[],[{wired1,0},{wired2,1},{wireless,2},{trunk,3}],[], mandatory), +[V1|Tlv2] = Tlv1, +Term1 = case decode_integer(V1, [10]) of +0 -> wired1; +1 -> wired2; +2 -> wireless; +3 -> trunk; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end, %%------------------------------------------------- -%% attribute number 2 with type OCTET STRING +%% attribute lineInformation(2) with type OCTET STRING %%------------------------------------------------- - {Term2,Bytes4,Rb3} = ?RT_BER:decode_octet_string(Bytes3,{0,384},[], no_length, mandatory), +[V2|Tlv3] = Tlv2, +Term2 = begin +Val1 = decode_octet_string(V2, [4]), +C1 = byte_size(Val1), +if 0 =< C1, C1 =< 384 -> +Val1; +true -> +exit({error,{asn1,bad_range}}) +end +end, + +case Tlv3 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed +end, + {'KmeLineStatus', Term1, Term2}. - {Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext), - {{'KmeLineStatus', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}. %%================================ %% KmeLineStatusSegment %%================================ - -'enc_KmeLineStatusSegment'({'KmeLineStatusSegment',Val}, TagIn) -> - 'enc_KmeLineStatusSegment'(Val, TagIn); +'enc_KmeLineStatusSegment'(Val) -> + 'enc_KmeLineStatusSegment'(Val, [<<10>>]). 'enc_KmeLineStatusSegment'(Val, TagIn) -> -case (case Val of {_,Enumval1}->Enumval1;_->Val end) of -wired1 -> ?RT_BER:encode_enumerated(0,TagIn ++ []); -wired2 -> ?RT_BER:encode_enumerated(1,TagIn ++ []); -wireless -> ?RT_BER:encode_enumerated(2,TagIn ++ []); -trunk -> ?RT_BER:encode_enumerated(3,TagIn ++ []); -Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) +case Val of +wired1 -> encode_tags(TagIn, [0], 1); +wired2 -> encode_tags(TagIn, [1], 1); +wireless -> encode_tags(TagIn, [2], 1); +trunk -> encode_tags(TagIn, [3], 1); +Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}}) end. -'dec_KmeLineStatusSegment'(Bytes, OptOrMand) -> - 'dec_KmeLineStatusSegment'(Bytes, OptOrMand, []). +'dec_KmeLineStatusSegment'(Tlv) -> + 'dec_KmeLineStatusSegment'(Tlv, [10]). -'dec_KmeLineStatusSegment'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_enumerated(Bytes,[],[{wired1,0},{wired2,1},{wireless,2},{trunk,3}],TagIn++[], OptOrMand). +'dec_KmeLineStatusSegment'(Tlv, TagIn) -> +case decode_integer(Tlv, TagIn) of +0 -> wired1; +1 -> wired2; +2 -> wireless; +3 -> trunk; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end. %%================================ %% KmeStartDeviceMonitor %%================================ - -'enc_KmeStartDeviceMonitor'({'KmeStartDeviceMonitor',Val}, TagIn) -> - 'enc_KmeStartDeviceMonitor'(Val, TagIn); +'enc_KmeStartDeviceMonitor'(Val) -> + 'enc_KmeStartDeviceMonitor'(Val, []). 'enc_KmeStartDeviceMonitor'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of null -> - ?RT_BER:encode_null(element(2,Val), []); + encode_null(element(2,Val), [<<5>>]); event -> - case (case element(2,Val) of {_,Enumval2}->Enumval2;_->element(2,Val) end) of -deviceCallStatus -> ?RT_BER:encode_enumerated(0,[]); -deviceLineStatus -> ?RT_BER:encode_enumerated(1,[]); -Enumval3 -> exit({error,{asn1, {enumerated_not_in_range,Enumval3}}}) + case element(2,Val) of +deviceCallStatus -> encode_tags([<<10>>], [0], 1); +deviceLineStatus -> encode_tags([<<10>>], [1], 1); +Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) end; Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). +encode_tags(TagIn, EncBytes, EncLen). -'dec_KmeStartDeviceMonitor'(Bytes, OptOrMand) -> - 'dec_KmeStartDeviceMonitor'(Bytes, OptOrMand, []). +'dec_KmeStartDeviceMonitor'(Tlv) -> + 'dec_KmeStartDeviceMonitor'(Tlv, []). -'dec_KmeStartDeviceMonitor'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of +'dec_KmeStartDeviceMonitor'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of %% 'null' - <<0:2,_:1,5:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_null(Bytes1,[], mandatory), - {{null, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {5, V1} -> + {null, decode_null(V1, [])}; %% 'event' - <<0:2,_:1,10:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_enumerated(Bytes1,[],[{deviceCallStatus,0},{deviceLineStatus,1}],[], mandatory), - {{event, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {10, V1} -> + {event, case decode_integer(V1, []) of +0 -> deviceCallStatus; +1 -> deviceLineStatus; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end}; Else -> - case OptOrMand of - mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}}); - _ ->exit({error,{asn1,{no_optional_tag,Else}}}) - end - end. + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. %%================================ %% KmeStopDeviceMonitor %%================================ - -'enc_KmeStopDeviceMonitor'({'KmeStopDeviceMonitor',Val}, TagIn) -> - 'enc_KmeStopDeviceMonitor'(Val, TagIn); +'enc_KmeStopDeviceMonitor'(Val) -> + 'enc_KmeStopDeviceMonitor'(Val, [<<5>>]). 'enc_KmeStopDeviceMonitor'(Val, TagIn) -> -?RT_BER:encode_null(Val, TagIn ++ []). +encode_null(Val, TagIn). -'dec_KmeStopDeviceMonitor'(Bytes, OptOrMand) -> - 'dec_KmeStopDeviceMonitor'(Bytes, OptOrMand, []). +'dec_KmeStopDeviceMonitor'(Tlv) -> + 'dec_KmeStopDeviceMonitor'(Tlv, [5]). -'dec_KmeStopDeviceMonitor'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_null(Bytes,TagIn++[], OptOrMand). +'dec_KmeStopDeviceMonitor'(Tlv, TagIn) -> +decode_null(Tlv, TagIn). %%================================ %% CallMonitorEvent %%================================ - -'enc_CallMonitorEvent'({'CallMonitorEvent',Val}, TagIn) -> - 'enc_CallMonitorEvent'(Val, TagIn); +'enc_CallMonitorEvent'(Val) -> + 'enc_CallMonitorEvent'(Val, [<<10>>]). 'enc_CallMonitorEvent'(Val, TagIn) -> -case (case Val of {_,Enumval1}->Enumval1;_->Val end) of -deviceCallStatus -> ?RT_BER:encode_enumerated(0,TagIn ++ []); -deviceLineStatus -> ?RT_BER:encode_enumerated(1,TagIn ++ []); -Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) +case Val of +deviceCallStatus -> encode_tags(TagIn, [0], 1); +deviceLineStatus -> encode_tags(TagIn, [1], 1); +Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}}) end. -'dec_CallMonitorEvent'(Bytes, OptOrMand) -> - 'dec_CallMonitorEvent'(Bytes, OptOrMand, []). +'dec_CallMonitorEvent'(Tlv) -> + 'dec_CallMonitorEvent'(Tlv, [10]). -'dec_CallMonitorEvent'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_enumerated(Bytes,[],[{deviceCallStatus,0},{deviceLineStatus,1}],TagIn++[], OptOrMand). +'dec_CallMonitorEvent'(Tlv, TagIn) -> +case decode_integer(Tlv, TagIn) of +0 -> deviceCallStatus; +1 -> deviceLineStatus; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end. %%================================ %% KmeBroadcastGroupList %%================================ - -'enc_KmeBroadcastGroupList'({'KmeBroadcastGroupList',Val}, TagIn) -> - 'enc_KmeBroadcastGroupList'(Val, TagIn); +'enc_KmeBroadcastGroupList'(Val) -> + 'enc_KmeBroadcastGroupList'(Val, [<<48>>]). 'enc_KmeBroadcastGroupList'(Val, TagIn) -> {EncBytes,EncLen} = 'enc_KmeBroadcastGroupList_components'(Val,[],0), - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], EncBytes, EncLen). + encode_tags(TagIn, EncBytes, EncLen). 'enc_KmeBroadcastGroupList_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_KmeBroadcastGroupList_components'([H|T],AccBytes, AccLen) -> - {EncBytes,EncLen} = 'enc_KmeBroadcastGroupList_SEQOF'(H, []), + {EncBytes,EncLen} = 'enc_KmeBroadcastGroupList_SEQOF'(H, [<<48>>]), 'enc_KmeBroadcastGroupList_components'(T,[EncBytes|AccBytes], AccLen + EncLen). @@ -5302,277 +5844,298 @@ end. %% KmeBroadcastGroupList_SEQOF %%================================ 'enc_KmeBroadcastGroupList_SEQOF'(Val, TagIn) -> - + {_,Cindex1, Cindex2} = Val, + %%------------------------------------------------- -%% attribute number 1 with type INTEGER +%% attribute groupNo(1) with type INTEGER %%------------------------------------------------- - {EncBytes1,EncLen1} = ?RT_BER:encode_integer([], ?RT_BER:cindex(2,Val,groupNo), []), + {EncBytes1,EncLen1} = encode_integer(Cindex1, [<<2>>]), %%------------------------------------------------- -%% attribute number 2 External KME-specific-types:KmeExtName OPTIONAL +%% attribute name(2) External KME-specific-types:KmeExtName OPTIONAL %%------------------------------------------------- - {EncBytes2,EncLen2} = case ?RT_BER:cindex(3,Val,name) of + {EncBytes2,EncLen2} = case Cindex2 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_KmeExtName'(?RT_BER:cindex(3,Val,name), []) + 'enc_KmeExtName'(Cindex2, []) end, BytesSoFar = [EncBytes1, EncBytes2], - LenSoFar = EncLen1 + EncLen2, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). -'dec_KmeBroadcastGroupList_SEQOF'(Bytes, OptOrMand, TagIn) -> +LenSoFar = EncLen1 + EncLen2, +encode_tags(TagIn, BytesSoFar, LenSoFar). + + +'dec_KmeBroadcastGroupList'(Tlv) -> + 'dec_KmeBroadcastGroupList'(Tlv, [16]). + +'dec_KmeBroadcastGroupList'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), +['dec_KmeBroadcastGroupList_SEQOF'(V1, [16]) || V1 <- Tlv1]. + + +'dec_KmeBroadcastGroupList_SEQOF'(Tlv, TagIn) -> + %%------------------------------------------------- + %% decode tag and length + %%------------------------------------------------- +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 with type INTEGER +%% attribute groupNo(1) with type INTEGER %%------------------------------------------------- - {Term1,Bytes3,Rb2} = ?RT_BER:decode_integer(Bytes2,[],[], mandatory), +[V1|Tlv2] = Tlv1, +Term1 = decode_integer(V1, [2]), %%------------------------------------------------- -%% attribute number 2 External KME-specific-types:KmeExtName OPTIONAL +%% attribute name(2) External KME-specific-types:KmeExtName OPTIONAL %%------------------------------------------------- - {Term2,Bytes4,Rb3} = case (catch 'dec_KmeExtName'(Bytes3, opt_or_default, [])) of -{'EXIT',{error,{asn1,{no_optional_tag,_}}}} -> { asn1_NOVALUE, Bytes3, 0 }; -Casetmp1-> Casetmp1 +{Term2,Tlv3} = case Tlv2 of +[V2 = {131072,_}|TempTlv3] -> + {'dec_KmeExtName'(V2, []), TempTlv3}; +[V2 = {131073,_}|TempTlv3] -> + {'dec_KmeExtName'(V2, []), TempTlv3}; + _ -> + { asn1_NOVALUE, Tlv2} end, - {Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext), - {{'KmeBroadcastGroupList_SEQOF', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}. - - -'dec_KmeBroadcastGroupList'(Bytes, OptOrMand) -> - 'dec_KmeBroadcastGroupList'(Bytes, OptOrMand, []). - -'dec_KmeBroadcastGroupList'(Bytes, OptOrMand, TagIn) -> - %%------------------------------------------------- - %% decode tag and length - %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), - ?RT_BER:decode_components(Rb1, Len, Bytes1, fun 'dec_KmeBroadcastGroupList_SEQOF'/3, [], []). - +case Tlv3 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed +end, + {'KmeBroadcastGroupList_SEQOF', Term1, Term2}. %%================================ %% KmeBroadcastGrpMembers %%================================ +'enc_KmeBroadcastGrpMembers'(Val) -> + 'enc_KmeBroadcastGrpMembers'(Val, [<<48>>]). + 'enc_KmeBroadcastGrpMembers'(Val, TagIn) -> +{_,Cindex1, Cindex2} = Val, %%------------------------------------------------- -%% attribute number 1 with type INTEGER +%% attribute groupNo(1) with type INTEGER %%------------------------------------------------- - {EncBytes1,EncLen1} = ?RT_BER:encode_integer([], ?RT_BER:cindex(2,Val,groupNo), [{tag,128,0,'EXPLICIT',32}]), + {EncBytes1,EncLen1} = encode_integer(Cindex1, [<<2>>,<<160>>]), %%------------------------------------------------- -%% attribute number 2 with type SEQUENCE OF +%% attribute members(2) with type SEQUENCE OF %%------------------------------------------------- - {EncBytes2,EncLen2} = 'enc_KmeBroadcastGrpMembers_members'(?RT_BER:cindex(3,Val,members), [{tag,128,1,'IMPLICIT',32}]), + {EncBytes2,EncLen2} = 'enc_KmeBroadcastGrpMembers_members'(Cindex2, [<<161>>]), BytesSoFar = [EncBytes1, EncBytes2], - LenSoFar = EncLen1 + EncLen2, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2, +encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% KmeBroadcastGrpMembers_members %%================================ - -'enc_KmeBroadcastGrpMembers_members'({'KmeBroadcastGrpMembers_members',Val}, TagIn) -> - 'enc_KmeBroadcastGrpMembers_members'(Val, TagIn); - 'enc_KmeBroadcastGrpMembers_members'(Val, TagIn) -> {EncBytes,EncLen} = 'enc_KmeBroadcastGrpMembers_members_components'(Val,[],0), - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], EncBytes, EncLen). + encode_tags(TagIn, EncBytes, EncLen). 'enc_KmeBroadcastGrpMembers_members_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_KmeBroadcastGrpMembers_members_components'([H|T],AccBytes, AccLen) -> - {EncBytes,EncLen} = 'CSTA-device-identifiers':'enc_DeviceID'(H, []), + {EncBytes,EncLen} = 'CSTA-device-identifiers':'enc_DeviceID'(H, [<<48>>]), 'enc_KmeBroadcastGrpMembers_members_components'(T,[EncBytes|AccBytes], AccLen + EncLen). -'dec_KmeBroadcastGrpMembers_members'(Bytes, OptOrMand, TagIn) -> - %%------------------------------------------------- - %% decode tag and length - %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), - ?RT_BER:decode_components(Rb1, Len, Bytes1, fun 'CSTA-device-identifiers':'dec_DeviceID'/3, [], []). - +'dec_KmeBroadcastGrpMembers'(Tlv) -> + 'dec_KmeBroadcastGrpMembers'(Tlv, [16]). -'dec_KmeBroadcastGrpMembers'(Bytes, OptOrMand) -> - 'dec_KmeBroadcastGrpMembers'(Bytes, OptOrMand, []). - -'dec_KmeBroadcastGrpMembers'(Bytes, OptOrMand, TagIn) -> +'dec_KmeBroadcastGrpMembers'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 with type INTEGER +%% attribute groupNo(1) with type INTEGER %%------------------------------------------------- - {Term1,Bytes3,Rb2} = ?RT_BER:decode_integer(Bytes2,[],[{tag,128,0,'EXPLICIT',32}], mandatory), +[V1|Tlv2] = Tlv1, +Term1 = decode_integer(V1, [131072,2]), %%------------------------------------------------- -%% attribute number 2 with type SEQUENCE OF +%% attribute members(2) with type SEQUENCE OF %%------------------------------------------------- - {Term2,Bytes4,Rb3} = 'dec_KmeBroadcastGrpMembers_members'(Bytes3, mandatory, [{tag,128,1,'IMPLICIT',32}]), +[V2|Tlv3] = Tlv2, +Term2 = 'dec_KmeBroadcastGrpMembers_members'(V2, [131073]), + +case Tlv3 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed +end, + {'KmeBroadcastGrpMembers', Term1, Term2}. + +'dec_KmeBroadcastGrpMembers_members'(Tlv, TagIn) -> + %%------------------------------------------------- + %% decode tag and length + %%------------------------------------------------- +Tlv1 = match_tags(Tlv, TagIn), +['CSTA-device-identifiers':'dec_DeviceID'(V1, [16]) || V1 <- Tlv1]. + - {Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext), - {{'KmeBroadcastGrpMembers', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}. %%================================ %% KmeAlterIfSrvEvt %%================================ - -'enc_KmeAlterIfSrvEvt'({'KmeAlterIfSrvEvt',Val}, TagIn) -> - 'enc_KmeAlterIfSrvEvt'(Val, TagIn); +'enc_KmeAlterIfSrvEvt'(Val) -> + 'enc_KmeAlterIfSrvEvt'(Val, []). 'enc_KmeAlterIfSrvEvt'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of alterIf -> - case (case element(2,Val) of {_,Enumval1}->Enumval1;_->element(2,Val) end) of -version0 -> ?RT_BER:encode_enumerated(0,[{tag,128,0,'EXPLICIT',32}]); -version1 -> ?RT_BER:encode_enumerated(1,[{tag,128,0,'EXPLICIT',32}]); -Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) + case element(2,Val) of +version0 -> encode_tags([<<10>>,<<160>>], [0], 1); +version1 -> encode_tags([<<10>>,<<160>>], [1], 1); +Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}}) end; ifAltered -> - case (case element(2,Val) of {_,Enumval3}->Enumval3;_->element(2,Val) end) of -version0 -> ?RT_BER:encode_enumerated(0,[{tag,128,1,'EXPLICIT',32}]); -version1 -> ?RT_BER:encode_enumerated(1,[{tag,128,1,'EXPLICIT',32}]); -Enumval4 -> exit({error,{asn1, {enumerated_not_in_range,Enumval4}}}) + case element(2,Val) of +version0 -> encode_tags([<<10>>,<<161>>], [0], 1); +version1 -> encode_tags([<<10>>,<<161>>], [1], 1); +Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) end; Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). +encode_tags(TagIn, EncBytes, EncLen). -'dec_KmeAlterIfSrvEvt'(Bytes, OptOrMand) -> - 'dec_KmeAlterIfSrvEvt'(Bytes, OptOrMand, []). +'dec_KmeAlterIfSrvEvt'(Tlv) -> + 'dec_KmeAlterIfSrvEvt'(Tlv, []). -'dec_KmeAlterIfSrvEvt'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of +'dec_KmeAlterIfSrvEvt'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of %% 'alterIf' - <<2:2,_:1,0:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_enumerated(Bytes1,[],[{version0,0},{version1,1}],[{tag,128,0,'EXPLICIT',32}], mandatory), - {{alterIf, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131072, V1} -> + {alterIf, case decode_integer(V1, [10]) of +0 -> version0; +1 -> version1; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end}; %% 'ifAltered' - <<2:2,_:1,1:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_enumerated(Bytes1,[],[{version0,0},{version1,1}],[{tag,128,1,'EXPLICIT',32}], mandatory), - {{ifAltered, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131073, V1} -> + {ifAltered, case decode_integer(V1, [10]) of +0 -> version0; +1 -> version1; +Default2 -> exit({error,{asn1,{illegal_enumerated,Default2}}}) +end}; Else -> - case OptOrMand of - mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}}); - _ ->exit({error,{asn1,{no_optional_tag,Else}}}) - end - end. + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. %%================================ %% KmeAlterIf %%================================ - -'enc_KmeAlterIf'({'KmeAlterIf',Val}, TagIn) -> - 'enc_KmeAlterIf'(Val, TagIn); +'enc_KmeAlterIf'(Val) -> + 'enc_KmeAlterIf'(Val, [<<10>>]). 'enc_KmeAlterIf'(Val, TagIn) -> -case (case Val of {_,Enumval1}->Enumval1;_->Val end) of -version0 -> ?RT_BER:encode_enumerated(0,TagIn ++ []); -version1 -> ?RT_BER:encode_enumerated(1,TagIn ++ []); -Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) +case Val of +version0 -> encode_tags(TagIn, [0], 1); +version1 -> encode_tags(TagIn, [1], 1); +Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}}) end. -'dec_KmeAlterIf'(Bytes, OptOrMand) -> - 'dec_KmeAlterIf'(Bytes, OptOrMand, []). +'dec_KmeAlterIf'(Tlv) -> + 'dec_KmeAlterIf'(Tlv, [10]). -'dec_KmeAlterIf'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_enumerated(Bytes,[],[{version0,0},{version1,1}],TagIn++[], OptOrMand). +'dec_KmeAlterIf'(Tlv, TagIn) -> +case decode_integer(Tlv, TagIn) of +0 -> version0; +1 -> version1; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end. %%================================ %% KmeIfAltered %%================================ - -'enc_KmeIfAltered'({'KmeIfAltered',Val}, TagIn) -> - 'enc_KmeIfAltered'(Val, TagIn); +'enc_KmeIfAltered'(Val) -> + 'enc_KmeIfAltered'(Val, [<<10>>]). 'enc_KmeIfAltered'(Val, TagIn) -> -case (case Val of {_,Enumval1}->Enumval1;_->Val end) of -version0 -> ?RT_BER:encode_enumerated(0,TagIn ++ []); -version1 -> ?RT_BER:encode_enumerated(1,TagIn ++ []); -Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) +case Val of +version0 -> encode_tags(TagIn, [0], 1); +version1 -> encode_tags(TagIn, [1], 1); +Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}}) end. -'dec_KmeIfAltered'(Bytes, OptOrMand) -> - 'dec_KmeIfAltered'(Bytes, OptOrMand, []). +'dec_KmeIfAltered'(Tlv) -> + 'dec_KmeIfAltered'(Tlv, [10]). -'dec_KmeIfAltered'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_enumerated(Bytes,[],[{version0,0},{version1,1}],TagIn++[], OptOrMand). +'dec_KmeIfAltered'(Tlv, TagIn) -> +case decode_integer(Tlv, TagIn) of +0 -> version0; +1 -> version1; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end. %%================================ %% IfVersion %%================================ - -'enc_IfVersion'({'IfVersion',Val}, TagIn) -> - 'enc_IfVersion'(Val, TagIn); +'enc_IfVersion'(Val) -> + 'enc_IfVersion'(Val, [<<10>>]). 'enc_IfVersion'(Val, TagIn) -> -case (case Val of {_,Enumval1}->Enumval1;_->Val end) of -version0 -> ?RT_BER:encode_enumerated(0,TagIn ++ []); -version1 -> ?RT_BER:encode_enumerated(1,TagIn ++ []); -Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) +case Val of +version0 -> encode_tags(TagIn, [0], 1); +version1 -> encode_tags(TagIn, [1], 1); +Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}}) end. -'dec_IfVersion'(Bytes, OptOrMand) -> - 'dec_IfVersion'(Bytes, OptOrMand, []). +'dec_IfVersion'(Tlv) -> + 'dec_IfVersion'(Tlv, [10]). -'dec_IfVersion'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_enumerated(Bytes,[],[{version0,0},{version1,1}],TagIn++[], OptOrMand). +'dec_IfVersion'(Tlv, TagIn) -> +case decode_integer(Tlv, TagIn) of +0 -> version0; +1 -> version1; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end. %%================================ %% KmeDeviceDataList %%================================ - -'enc_KmeDeviceDataList'({'KmeDeviceDataList',Val}, TagIn) -> - 'enc_KmeDeviceDataList'(Val, TagIn); +'enc_KmeDeviceDataList'(Val) -> + 'enc_KmeDeviceDataList'(Val, [<<48>>]). 'enc_KmeDeviceDataList'(Val, TagIn) -> {EncBytes,EncLen} = 'enc_KmeDeviceDataList_components'(Val,[],0), - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], EncBytes, EncLen). + encode_tags(TagIn, EncBytes, EncLen). 'enc_KmeDeviceDataList_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_KmeDeviceDataList_components'([H|T],AccBytes, AccLen) -> - {EncBytes,EncLen} = 'enc_KmeDeviceDataList_SEQOF'(H, []), + {EncBytes,EncLen} = 'enc_KmeDeviceDataList_SEQOF'(H, [<<48>>]), 'enc_KmeDeviceDataList_components'(T,[EncBytes|AccBytes], AccLen + EncLen). @@ -5582,45 +6145,42 @@ end. %% KmeDeviceDataList_SEQOF %%================================ 'enc_KmeDeviceDataList_SEQOF'(Val, TagIn) -> - + {_,Cindex1, Cindex2} = Val, + %%------------------------------------------------- -%% attribute number 1 External CSTA-device-identifiers:DeviceID +%% attribute device(1) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {EncBytes1,EncLen1} = 'CSTA-device-identifiers':'enc_DeviceID'(?RT_BER:cindex(2,Val,device), [{tag,128,0,'EXPLICIT',32}]), + {EncBytes1,EncLen1} = 'CSTA-device-identifiers':'enc_DeviceID'(Cindex1, [<<48>>,<<160>>]), %%------------------------------------------------- -%% attribute number 2 with type CHOICE +%% attribute sysData(2) with type CHOICE %%------------------------------------------------- - {EncBytes2,EncLen2} = 'enc_KmeDeviceDataList_SEQOF_sysData'(?RT_BER:cindex(3,Val,sysData), [{tag,128,1,'EXPLICIT',32}]), + {EncBytes2,EncLen2} = 'enc_KmeDeviceDataList_SEQOF_sysData'(Cindex2, [<<161>>]), BytesSoFar = [EncBytes1, EncBytes2], - LenSoFar = EncLen1 + EncLen2, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2, +encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% KmeDeviceDataList_SEQOF_sysData %%================================ - -'enc_KmeDeviceDataList_SEQOF_sysData'({'KmeDeviceDataList_SEQOF_sysData',Val}, TagIn) -> - 'enc_KmeDeviceDataList_SEQOF_sysData'(Val, TagIn); - 'enc_KmeDeviceDataList_SEQOF_sysData'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of standardInfo -> - 'enc_KmeDeviceDataList_SEQOF_sysData_standardInfo'(element(2,Val), []); + 'enc_KmeDeviceDataList_SEQOF_sysData_standardInfo'(element(2,Val), [<<48>>]); extName -> - 'enc_KmeExtName'(element(2,Val), [{tag,128,41,'EXPLICIT',32}]); + 'enc_KmeExtName'(element(2,Val), [<<191,41>>]); fcoKeyList -> - 'enc_KmeFcoKeyList'(element(2,Val), [{tag,128,44,'EXPLICIT',32}]); + 'enc_KmeFcoKeyList'(element(2,Val), [<<48>>,<<191,44>>]); sxdpMaster -> - 'CSTA-device-identifiers':'enc_DeviceID'(element(2,Val), [{tag,128,45,'EXPLICIT',32}]); + 'CSTA-device-identifiers':'enc_DeviceID'(element(2,Val), [<<48>>,<<191,45>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). +encode_tags(TagIn, EncBytes, EncLen). @@ -5630,311 +6190,314 @@ end. %% KmeDeviceDataList_SEQOF_sysData_standardInfo %%================================ 'enc_KmeDeviceDataList_SEQOF_sysData_standardInfo'(Val, TagIn) -> - + {_,Cindex1, Cindex2, Cindex3, Cindex4, Cindex5, Cindex6, Cindex7, Cindex8, Cindex9, Cindex10} = Val, + %%------------------------------------------------- -%% attribute number 1 External KME-specific-types:KmeWakeUpInfo OPTIONAL +%% attribute wakeUp(1) External KME-specific-types:KmeWakeUpInfo OPTIONAL %%------------------------------------------------- - {EncBytes1,EncLen1} = case ?RT_BER:cindex(2,Val,wakeUp) of + {EncBytes1,EncLen1} = case Cindex1 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_KmeWakeUpInfo'(?RT_BER:cindex(2,Val,wakeUp), [{tag,128,9,'EXPLICIT',32}]) + 'enc_KmeWakeUpInfo'(Cindex1, [<<48>>,<<169>>]) end, %%------------------------------------------------- -%% attribute number 2 with type ENUMERATED OPTIONAL +%% attribute remoteLock(2) with type ENUMERATED OPTIONAL %%------------------------------------------------- - {EncBytes2,EncLen2} = case ?RT_BER:cindex(3,Val,remoteLock) of + {EncBytes2,EncLen2} = case Cindex2 of asn1_NOVALUE -> {<<>>,0}; _ -> - case (case ?RT_BER:cindex(3,Val,remoteLock) of {_,Enumval1}->Enumval1;_->?RT_BER:cindex(3,Val,remoteLock) end) of -lock -> ?RT_BER:encode_enumerated(0,[{tag,128,10,'EXPLICIT',32}]); -unlock -> ?RT_BER:encode_enumerated(1,[{tag,128,10,'EXPLICIT',32}]); -Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) + case Cindex2 of +lock -> encode_tags([<<10>>,<<170>>], [0], 1); +unlock -> encode_tags([<<10>>,<<170>>], [1], 1); +Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}}) end end, %%------------------------------------------------- -%% attribute number 3 with type ENUMERATED OPTIONAL +%% attribute callLogLock(3) with type ENUMERATED OPTIONAL %%------------------------------------------------- - {EncBytes3,EncLen3} = case ?RT_BER:cindex(4,Val,callLogLock) of + {EncBytes3,EncLen3} = case Cindex3 of asn1_NOVALUE -> {<<>>,0}; _ -> - case (case ?RT_BER:cindex(4,Val,callLogLock) of {_,Enumval3}->Enumval3;_->?RT_BER:cindex(4,Val,callLogLock) end) of -lock -> ?RT_BER:encode_enumerated(0,[{tag,128,11,'EXPLICIT',32}]); -unlock -> ?RT_BER:encode_enumerated(1,[{tag,128,11,'EXPLICIT',32}]); -Enumval4 -> exit({error,{asn1, {enumerated_not_in_range,Enumval4}}}) + case Cindex3 of +lock -> encode_tags([<<10>>,<<171>>], [0], 1); +unlock -> encode_tags([<<10>>,<<171>>], [1], 1); +Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) end end, %%------------------------------------------------- -%% attribute number 4 External KME-specific-types:KmeAbsentMessage OPTIONAL +%% attribute absentMessage(4) External KME-specific-types:KmeAbsentMessage OPTIONAL %%------------------------------------------------- - {EncBytes4,EncLen4} = case ?RT_BER:cindex(5,Val,absentMessage) of + {EncBytes4,EncLen4} = case Cindex4 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_KmeAbsentMessage'(?RT_BER:cindex(5,Val,absentMessage), [{tag,128,12,'EXPLICIT',32}]) + 'enc_KmeAbsentMessage'(Cindex4, [<<172>>]) end, %%------------------------------------------------- -%% attribute number 5 External CSTA-device-feature-types:ForwardList OPTIONAL +%% attribute forwardDnd(5) External CSTA-device-feature-types:ForwardList OPTIONAL %%------------------------------------------------- - {EncBytes5,EncLen5} = case ?RT_BER:cindex(6,Val,forwardDnd) of + {EncBytes5,EncLen5} = case Cindex5 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'CSTA-device-feature-types':'enc_ForwardList'(?RT_BER:cindex(6,Val,forwardDnd), [{tag,128,13,'EXPLICIT',32}]) + 'CSTA-device-feature-types':'enc_ForwardList'(Cindex5, [<<48>>,<<173>>]) end, %%------------------------------------------------- -%% attribute number 6 with type INTEGER OPTIONAL +%% attribute cos(6) with type INTEGER OPTIONAL %%------------------------------------------------- - {EncBytes6,EncLen6} = case ?RT_BER:cindex(7,Val,cos) of + {EncBytes6,EncLen6} = case Cindex6 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_integer([], ?RT_BER:cindex(7,Val,cos), [{tag,128,34,'EXPLICIT',32}]) + encode_integer(Cindex6, [<<2>>,<<191,34>>]) end, %%------------------------------------------------- -%% attribute number 7 External KME-specific-types:KmePhoneProperty OPTIONAL +%% attribute phoneProperty(7) External KME-specific-types:KmePhoneProperty OPTIONAL %%------------------------------------------------- - {EncBytes7,EncLen7} = case ?RT_BER:cindex(8,Val,phoneProperty) of + {EncBytes7,EncLen7} = case Cindex7 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_KmePhoneProperty'(?RT_BER:cindex(8,Val,phoneProperty), [{tag,128,35,'EXPLICIT',32}]) + 'enc_KmePhoneProperty'(Cindex7, [<<48>>,<<191,35>>]) end, %%------------------------------------------------- -%% attribute number 8 with type BIT STRING OPTIONAL +%% attribute assocIncomGroup(8) with type BIT STRING OPTIONAL %%------------------------------------------------- - {EncBytes8,EncLen8} = case ?RT_BER:cindex(9,Val,assocIncomGroup) of + {EncBytes8,EncLen8} = case Cindex8 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_bit_string([], ?RT_BER:cindex(9,Val,assocIncomGroup), [{one,0},{two,1},{three,2},{four,3},{five,4},{six,5},{seven,6},{eight,7},{nine,8},{ten,9},{eleven,10},{twelve,11},{thirteen,12},{fourteen,13},{fifteen,14},{sixteen,15},{seventeen,16},{eighteen,17},{nineteen,18},{twenty,19},{twentyOne,20},{twentyTwo,21},{twentyThree,22},{twentyFour,23},{twentyFive,24},{twentySix,25},{twentySeven,26},{twentyEight,27},{twentyNine,28},{thirty,29},{thirtyOne,30},{thirtyTwo,31},{thirtyThree,32},{thirtyFour,33},{thirtyFive,34},{thirtySix,35},{thirtySeven,36},{thirtyEight,37},{thirtyNine,38},{fourty,39},{fourtyOne,40},{fourtyTwo,41},{fourtyThree,42},{fourtyFour,43},{fourtyFive,44},{fourtySix,45},{fourtySeven,46},{fourtyEight,47},{fourtyNine,48},{fifty,49},{fiftyOne,50},{fiftyTwo,51},{fiftyThree,52},{fiftyFour,53},{fiftyFive,54},{fiftySix,55},{fiftySeven,56},{fiftyEight,57},{fiftyNine,58},{sixty,59},{sixtyOne,60},{sixtyTwo,61},{sixtyThree,62},{sixtyFour,63},{sixtyFive,64},{sixtySix,65},{sixtySeven,66},{sixtyEight,67},{sixtyNine,68},{seventy,69},{seventyOne,70},{seventyTwo,71},{seventyThree,72},{seventyFour,73},{seventyFive,74},{seventySix,75},{seventySeven,76},{seventyEight,77},{seventyNine,78},{eighty,79},{eightyOne,80},{eightyTwo,81},{eightyThree,82},{eightyFour,83},{eightyFive,84},{eightySix,85},{eightySeven,86},{eightyEight,87},{eightyNine,88},{ninety,89},{ninetyOne,90},{ninetyTwo,91},{ninetyThree,92},{ninetyFour,93},{ninetyFive,94},{ninetySix,95},{ninetySeven,96},{ninetyEight,97},{ninetyNine,98},{oneHundred,99},{oneHundredOne,100},{oneHundredTwo,101},{oneHundredThree,102},{oneHundredFour,103},{oneHundredFive,104},{oneHundredSix,105},{oneHundredSeven,106},{oneHundredEitht,107},{oneHundredNine,108},{oneHundredTen,109},{oneHundredEleven,110},{oneHundredTwelve,111},{oneHundredThirteen,112},{oneHundredFourteen,113},{oneHundredFifteen,114},{oneHundredSixteen,115},{oneHundredSeventeen,116},{oneHundredEithteen,117},{oneHundredNineteen,118},{oneHundredTwenty,119},{oneHundredTwentyOne,120},{oneHundredTwentyTwo,121},{oneHundredTwentyThree,122},{oneHundredTwentyFour,123},{oneHundredTwentyFive,124},{oneHundredTwentySix,125},{oneHundredTwentySeven,126},{oneHundredTwentyEight,127}], [{tag,128,36,'EXPLICIT',32}]) + encode_named_bit_string(Cindex8, [{one,0},{two,1},{three,2},{four,3},{five,4},{six,5},{seven,6},{eight,7},{nine,8},{ten,9},{eleven,10},{twelve,11},{thirteen,12},{fourteen,13},{fifteen,14},{sixteen,15},{seventeen,16},{eighteen,17},{nineteen,18},{twenty,19},{twentyOne,20},{twentyTwo,21},{twentyThree,22},{twentyFour,23},{twentyFive,24},{twentySix,25},{twentySeven,26},{twentyEight,27},{twentyNine,28},{thirty,29},{thirtyOne,30},{thirtyTwo,31},{thirtyThree,32},{thirtyFour,33},{thirtyFive,34},{thirtySix,35},{thirtySeven,36},{thirtyEight,37},{thirtyNine,38},{fourty,39},{fourtyOne,40},{fourtyTwo,41},{fourtyThree,42},{fourtyFour,43},{fourtyFive,44},{fourtySix,45},{fourtySeven,46},{fourtyEight,47},{fourtyNine,48},{fifty,49},{fiftyOne,50},{fiftyTwo,51},{fiftyThree,52},{fiftyFour,53},{fiftyFive,54},{fiftySix,55},{fiftySeven,56},{fiftyEight,57},{fiftyNine,58},{sixty,59},{sixtyOne,60},{sixtyTwo,61},{sixtyThree,62},{sixtyFour,63},{sixtyFive,64},{sixtySix,65},{sixtySeven,66},{sixtyEight,67},{sixtyNine,68},{seventy,69},{seventyOne,70},{seventyTwo,71},{seventyThree,72},{seventyFour,73},{seventyFive,74},{seventySix,75},{seventySeven,76},{seventyEight,77},{seventyNine,78},{eighty,79},{eightyOne,80},{eightyTwo,81},{eightyThree,82},{eightyFour,83},{eightyFive,84},{eightySix,85},{eightySeven,86},{eightyEight,87},{eightyNine,88},{ninety,89},{ninetyOne,90},{ninetyTwo,91},{ninetyThree,92},{ninetyFour,93},{ninetyFive,94},{ninetySix,95},{ninetySeven,96},{ninetyEight,97},{ninetyNine,98},{oneHundred,99},{oneHundredOne,100},{oneHundredTwo,101},{oneHundredThree,102},{oneHundredFour,103},{oneHundredFive,104},{oneHundredSix,105},{oneHundredSeven,106},{oneHundredEitht,107},{oneHundredNine,108},{oneHundredTen,109},{oneHundredEleven,110},{oneHundredTwelve,111},{oneHundredThirteen,112},{oneHundredFourteen,113},{oneHundredFifteen,114},{oneHundredSixteen,115},{oneHundredSeventeen,116},{oneHundredEithteen,117},{oneHundredNineteen,118},{oneHundredTwenty,119},{oneHundredTwentyOne,120},{oneHundredTwentyTwo,121},{oneHundredTwentyThree,122},{oneHundredTwentyFour,123},{oneHundredTwentyFive,124},{oneHundredTwentySix,125},{oneHundredTwentySeven,126},{oneHundredTwentyEight,127}], [<<3>>,<<191,36>>]) end, %%------------------------------------------------- -%% attribute number 9 with type SEQUENCE OF OPTIONAL +%% attribute messageWaiting(9) with type SEQUENCE OF OPTIONAL %%------------------------------------------------- - {EncBytes9,EncLen9} = case ?RT_BER:cindex(10,Val,messageWaiting) of + {EncBytes9,EncLen9} = case Cindex9 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_KmeDeviceDataList_SEQOF_sysData_standardInfo_messageWaiting'(?RT_BER:cindex(10,Val,messageWaiting), [{tag,128,37,'EXPLICIT',32}]) + 'enc_KmeDeviceDataList_SEQOF_sysData_standardInfo_messageWaiting'(Cindex9, [<<48>>,<<191,37>>]) end, %%------------------------------------------------- -%% attribute number 10 with type INTEGER OPTIONAL +%% attribute assocExtGroup(10) with type INTEGER OPTIONAL %%------------------------------------------------- - {EncBytes10,EncLen10} = case ?RT_BER:cindex(11,Val,assocExtGroup) of + {EncBytes10,EncLen10} = case Cindex10 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_integer([], ?RT_BER:cindex(11,Val,assocExtGroup), [{tag,128,39,'EXPLICIT',32}]) + encode_integer(Cindex10, [<<2>>,<<191,39>>]) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4, EncBytes5, EncBytes6, EncBytes7, EncBytes8, EncBytes9, EncBytes10], - LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5 + EncLen6 + EncLen7 + EncLen8 + EncLen9 + EncLen10, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5 + EncLen6 + EncLen7 + EncLen8 + EncLen9 + EncLen10, +encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% KmeDeviceDataList_SEQOF_sysData_standardInfo_messageWaiting %%================================ - -'enc_KmeDeviceDataList_SEQOF_sysData_standardInfo_messageWaiting'({'KmeDeviceDataList_SEQOF_sysData_standardInfo_messageWaiting',Val}, TagIn) -> - 'enc_KmeDeviceDataList_SEQOF_sysData_standardInfo_messageWaiting'(Val, TagIn); - 'enc_KmeDeviceDataList_SEQOF_sysData_standardInfo_messageWaiting'(Val, TagIn) -> {EncBytes,EncLen} = 'enc_KmeDeviceDataList_SEQOF_sysData_standardInfo_messageWaiting_components'(Val,[],0), - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], EncBytes, EncLen). + encode_tags(TagIn, EncBytes, EncLen). 'enc_KmeDeviceDataList_SEQOF_sysData_standardInfo_messageWaiting_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_KmeDeviceDataList_SEQOF_sysData_standardInfo_messageWaiting_components'([H|T],AccBytes, AccLen) -> - {EncBytes,EncLen} = 'CSTA-device-identifiers':'enc_DeviceID'(H, []), + {EncBytes,EncLen} = 'CSTA-device-identifiers':'enc_DeviceID'(H, [<<48>>]), 'enc_KmeDeviceDataList_SEQOF_sysData_standardInfo_messageWaiting_components'(T,[EncBytes|AccBytes], AccLen + EncLen). -'dec_KmeDeviceDataList_SEQOF_sysData_standardInfo_messageWaiting'(Bytes, OptOrMand, TagIn) -> + + +'dec_KmeDeviceDataList'(Tlv) -> + 'dec_KmeDeviceDataList'(Tlv, [16]). + +'dec_KmeDeviceDataList'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), - ?RT_BER:decode_components(Rb1, Len, Bytes1, fun 'CSTA-device-identifiers':'dec_DeviceID'/3, [], []). +Tlv1 = match_tags(Tlv, TagIn), +['dec_KmeDeviceDataList_SEQOF'(V1, [16]) || V1 <- Tlv1]. -'dec_KmeDeviceDataList_SEQOF_sysData_standardInfo'(Bytes, OptOrMand, TagIn) -> +'dec_KmeDeviceDataList_SEQOF'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 External KME-specific-types:KmeWakeUpInfo OPTIONAL +%% attribute device(1) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {Term1,Bytes3,Rb2} = case Bytes2 of -<<2:2,_:1,9:5,_/binary>> -> -'dec_KmeWakeUpInfo'(Bytes2, opt_or_default, [{tag,128,9,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes2, 0 } -end, +[V1|Tlv2] = Tlv1, +Term1 = 'CSTA-device-identifiers':'dec_DeviceID'(V1, [131072,16]), %%------------------------------------------------- -%% attribute number 2 with type ENUMERATED OPTIONAL +%% attribute sysData(2) with type CHOICE %%------------------------------------------------- - {Term2,Bytes4,Rb3} = case Bytes3 of -<<2:2,_:1,10:5,_/binary>> -> -?RT_BER:decode_enumerated(Bytes3,[],[{lock,0},{unlock,1}],[{tag,128,10,'EXPLICIT',32}], mandatory); -_ -> -{ asn1_NOVALUE, Bytes3, 0 } +[V2|Tlv3] = Tlv2, +Term2 = 'dec_KmeDeviceDataList_SEQOF_sysData'(V2, [131073]), + +case Tlv3 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed end, + {'KmeDeviceDataList_SEQOF', Term1, Term2}. + +'dec_KmeDeviceDataList_SEQOF_sysData'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of + +%% 'standardInfo' + {16, V1} -> + {standardInfo, 'dec_KmeDeviceDataList_SEQOF_sysData_standardInfo'(V1, [])}; + + +%% 'extName' + {131113, V1} -> + {extName, 'dec_KmeExtName'(V1, [])}; + + +%% 'fcoKeyList' + {131116, V1} -> + {fcoKeyList, 'dec_KmeFcoKeyList'(V1, [16])}; + + +%% 'sxdpMaster' + {131117, V1} -> + {sxdpMaster, 'CSTA-device-identifiers':'dec_DeviceID'(V1, [16])}; + + Else -> + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. +'dec_KmeDeviceDataList_SEQOF_sysData_standardInfo'(Tlv, TagIn) -> + %%------------------------------------------------- + %% decode tag and length + %%------------------------------------------------- +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 3 with type ENUMERATED OPTIONAL +%% attribute wakeUp(1) External KME-specific-types:KmeWakeUpInfo OPTIONAL %%------------------------------------------------- - {Term3,Bytes5,Rb4} = case Bytes4 of -<<2:2,_:1,11:5,_/binary>> -> -?RT_BER:decode_enumerated(Bytes4,[],[{lock,0},{unlock,1}],[{tag,128,11,'EXPLICIT',32}], mandatory); -_ -> -{ asn1_NOVALUE, Bytes4, 0 } +{Term1,Tlv2} = case Tlv1 of +[{131081,V1}|TempTlv2] -> + {'dec_KmeWakeUpInfo'(V1, [16]), TempTlv2}; + _ -> + { asn1_NOVALUE, Tlv1} end, %%------------------------------------------------- -%% attribute number 4 External KME-specific-types:KmeAbsentMessage OPTIONAL +%% attribute remoteLock(2) with type ENUMERATED OPTIONAL %%------------------------------------------------- - {Term4,Bytes6,Rb5} = case Bytes5 of -<<2:2,_:1,12:5,_/binary>> -> -'dec_KmeAbsentMessage'(Bytes5, opt_or_default, [{tag,128,12,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes5, 0 } +{Term2,Tlv3} = case Tlv2 of +[{131082,V2}|TempTlv3] -> + {case decode_integer(V2, [10]) of +0 -> lock; +1 -> unlock; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end, TempTlv3}; + _ -> + { asn1_NOVALUE, Tlv2} end, %%------------------------------------------------- -%% attribute number 5 External CSTA-device-feature-types:ForwardList OPTIONAL +%% attribute callLogLock(3) with type ENUMERATED OPTIONAL %%------------------------------------------------- - {Term5,Bytes7,Rb6} = case Bytes6 of -<<2:2,_:1,13:5,_/binary>> -> -'CSTA-device-feature-types':'dec_ForwardList'(Bytes6, opt_or_default, [{tag,128,13,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes6, 0 } +{Term3,Tlv4} = case Tlv3 of +[{131083,V3}|TempTlv4] -> + {case decode_integer(V3, [10]) of +0 -> lock; +1 -> unlock; +Default2 -> exit({error,{asn1,{illegal_enumerated,Default2}}}) +end, TempTlv4}; + _ -> + { asn1_NOVALUE, Tlv3} end, %%------------------------------------------------- -%% attribute number 6 with type INTEGER OPTIONAL +%% attribute absentMessage(4) External KME-specific-types:KmeAbsentMessage OPTIONAL %%------------------------------------------------- - {Term6,Bytes8,Rb7} = case Bytes7 of -<<2:2,_:1,31:5,34,_/binary>> -> -?RT_BER:decode_integer(Bytes7,[],[{tag,128,34,'EXPLICIT',32}], mandatory); -_ -> -{ asn1_NOVALUE, Bytes7, 0 } +{Term4,Tlv5} = case Tlv4 of +[{131084,V4}|TempTlv5] -> + {'dec_KmeAbsentMessage'(V4, []), TempTlv5}; + _ -> + { asn1_NOVALUE, Tlv4} end, %%------------------------------------------------- -%% attribute number 7 External KME-specific-types:KmePhoneProperty OPTIONAL +%% attribute forwardDnd(5) External CSTA-device-feature-types:ForwardList OPTIONAL %%------------------------------------------------- - {Term7,Bytes9,Rb8} = case Bytes8 of -<<2:2,_:1,31:5,35,_/binary>> -> -'dec_KmePhoneProperty'(Bytes8, opt_or_default, [{tag,128,35,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes8, 0 } +{Term5,Tlv6} = case Tlv5 of +[{131085,V5}|TempTlv6] -> + {'CSTA-device-feature-types':'dec_ForwardList'(V5, [16]), TempTlv6}; + _ -> + { asn1_NOVALUE, Tlv5} end, %%------------------------------------------------- -%% attribute number 8 with type BIT STRING OPTIONAL +%% attribute cos(6) with type INTEGER OPTIONAL %%------------------------------------------------- - {Term8,Bytes10,Rb9} = case Bytes9 of -<<2:2,_:1,31:5,36,_/binary>> -> -?RT_BER:decode_bit_string(Bytes9,[],[{one,0},{two,1},{three,2},{four,3},{five,4},{six,5},{seven,6},{eight,7},{nine,8},{ten,9},{eleven,10},{twelve,11},{thirteen,12},{fourteen,13},{fifteen,14},{sixteen,15},{seventeen,16},{eighteen,17},{nineteen,18},{twenty,19},{twentyOne,20},{twentyTwo,21},{twentyThree,22},{twentyFour,23},{twentyFive,24},{twentySix,25},{twentySeven,26},{twentyEight,27},{twentyNine,28},{thirty,29},{thirtyOne,30},{thirtyTwo,31},{thirtyThree,32},{thirtyFour,33},{thirtyFive,34},{thirtySix,35},{thirtySeven,36},{thirtyEight,37},{thirtyNine,38},{fourty,39},{fourtyOne,40},{fourtyTwo,41},{fourtyThree,42},{fourtyFour,43},{fourtyFive,44},{fourtySix,45},{fourtySeven,46},{fourtyEight,47},{fourtyNine,48},{fifty,49},{fiftyOne,50},{fiftyTwo,51},{fiftyThree,52},{fiftyFour,53},{fiftyFive,54},{fiftySix,55},{fiftySeven,56},{fiftyEight,57},{fiftyNine,58},{sixty,59},{sixtyOne,60},{sixtyTwo,61},{sixtyThree,62},{sixtyFour,63},{sixtyFive,64},{sixtySix,65},{sixtySeven,66},{sixtyEight,67},{sixtyNine,68},{seventy,69},{seventyOne,70},{seventyTwo,71},{seventyThree,72},{seventyFour,73},{seventyFive,74},{seventySix,75},{seventySeven,76},{seventyEight,77},{seventyNine,78},{eighty,79},{eightyOne,80},{eightyTwo,81},{eightyThree,82},{eightyFour,83},{eightyFive,84},{eightySix,85},{eightySeven,86},{eightyEight,87},{eightyNine,88},{ninety,89},{ninetyOne,90},{ninetyTwo,91},{ninetyThree,92},{ninetyFour,93},{ninetyFive,94},{ninetySix,95},{ninetySeven,96},{ninetyEight,97},{ninetyNine,98},{oneHundred,99},{oneHundredOne,100},{oneHundredTwo,101},{oneHundredThree,102},{oneHundredFour,103},{oneHundredFive,104},{oneHundredSix,105},{oneHundredSeven,106},{oneHundredEitht,107},{oneHundredNine,108},{oneHundredTen,109},{oneHundredEleven,110},{oneHundredTwelve,111},{oneHundredThirteen,112},{oneHundredFourteen,113},{oneHundredFifteen,114},{oneHundredSixteen,115},{oneHundredSeventeen,116},{oneHundredEithteen,117},{oneHundredNineteen,118},{oneHundredTwenty,119},{oneHundredTwentyOne,120},{oneHundredTwentyTwo,121},{oneHundredTwentyThree,122},{oneHundredTwentyFour,123},{oneHundredTwentyFive,124},{oneHundredTwentySix,125},{oneHundredTwentySeven,126},{oneHundredTwentyEight,127}],[{tag,128,36,'EXPLICIT',32}], no_length, mandatory); -_ -> -{ asn1_NOVALUE, Bytes9, 0 } +{Term6,Tlv7} = case Tlv6 of +[{131106,V6}|TempTlv7] -> + {decode_integer(V6, [2]), TempTlv7}; + _ -> + { asn1_NOVALUE, Tlv6} end, %%------------------------------------------------- -%% attribute number 9 with type SEQUENCE OF OPTIONAL +%% attribute phoneProperty(7) External KME-specific-types:KmePhoneProperty OPTIONAL %%------------------------------------------------- - {Term9,Bytes11,Rb10} = case Bytes10 of -<<2:2,_:1,31:5,37,_/binary>> -> -'dec_KmeDeviceDataList_SEQOF_sysData_standardInfo_messageWaiting'(Bytes10, opt_or_default, [{tag,128,37,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes10, 0 } +{Term7,Tlv8} = case Tlv7 of +[{131107,V7}|TempTlv8] -> + {'dec_KmePhoneProperty'(V7, [16]), TempTlv8}; + _ -> + { asn1_NOVALUE, Tlv7} end, %%------------------------------------------------- -%% attribute number 10 with type INTEGER OPTIONAL +%% attribute assocIncomGroup(8) with type BIT STRING OPTIONAL %%------------------------------------------------- - {Term10,Bytes12,Rb11} = case Bytes11 of -<<2:2,_:1,31:5,39,_/binary>> -> -?RT_BER:decode_integer(Bytes11,[],[{tag,128,39,'EXPLICIT',32}], mandatory); -_ -> -{ asn1_NOVALUE, Bytes11, 0 } +{Term8,Tlv9} = case Tlv8 of +[{131108,V8}|TempTlv9] -> + {decode_named_bit_string(V8, [{one,0},{two,1},{three,2},{four,3},{five,4},{six,5},{seven,6},{eight,7},{nine,8},{ten,9},{eleven,10},{twelve,11},{thirteen,12},{fourteen,13},{fifteen,14},{sixteen,15},{seventeen,16},{eighteen,17},{nineteen,18},{twenty,19},{twentyOne,20},{twentyTwo,21},{twentyThree,22},{twentyFour,23},{twentyFive,24},{twentySix,25},{twentySeven,26},{twentyEight,27},{twentyNine,28},{thirty,29},{thirtyOne,30},{thirtyTwo,31},{thirtyThree,32},{thirtyFour,33},{thirtyFive,34},{thirtySix,35},{thirtySeven,36},{thirtyEight,37},{thirtyNine,38},{fourty,39},{fourtyOne,40},{fourtyTwo,41},{fourtyThree,42},{fourtyFour,43},{fourtyFive,44},{fourtySix,45},{fourtySeven,46},{fourtyEight,47},{fourtyNine,48},{fifty,49},{fiftyOne,50},{fiftyTwo,51},{fiftyThree,52},{fiftyFour,53},{fiftyFive,54},{fiftySix,55},{fiftySeven,56},{fiftyEight,57},{fiftyNine,58},{sixty,59},{sixtyOne,60},{sixtyTwo,61},{sixtyThree,62},{sixtyFour,63},{sixtyFive,64},{sixtySix,65},{sixtySeven,66},{sixtyEight,67},{sixtyNine,68},{seventy,69},{seventyOne,70},{seventyTwo,71},{seventyThree,72},{seventyFour,73},{seventyFive,74},{seventySix,75},{seventySeven,76},{seventyEight,77},{seventyNine,78},{eighty,79},{eightyOne,80},{eightyTwo,81},{eightyThree,82},{eightyFour,83},{eightyFive,84},{eightySix,85},{eightySeven,86},{eightyEight,87},{eightyNine,88},{ninety,89},{ninetyOne,90},{ninetyTwo,91},{ninetyThree,92},{ninetyFour,93},{ninetyFive,94},{ninetySix,95},{ninetySeven,96},{ninetyEight,97},{ninetyNine,98},{oneHundred,99},{oneHundredOne,100},{oneHundredTwo,101},{oneHundredThree,102},{oneHundredFour,103},{oneHundredFive,104},{oneHundredSix,105},{oneHundredSeven,106},{oneHundredEitht,107},{oneHundredNine,108},{oneHundredTen,109},{oneHundredEleven,110},{oneHundredTwelve,111},{oneHundredThirteen,112},{oneHundredFourteen,113},{oneHundredFifteen,114},{oneHundredSixteen,115},{oneHundredSeventeen,116},{oneHundredEithteen,117},{oneHundredNineteen,118},{oneHundredTwenty,119},{oneHundredTwentyOne,120},{oneHundredTwentyTwo,121},{oneHundredTwentyThree,122},{oneHundredTwentyFour,123},{oneHundredTwentyFive,124},{oneHundredTwentySix,125},{oneHundredTwentySeven,126},{oneHundredTwentyEight,127}], [3]), TempTlv9}; + _ -> + { asn1_NOVALUE, Tlv8} end, - {Bytes13,Rb12} = ?RT_BER:restbytes2(RemBytes, Bytes12,noext), - {{'KmeDeviceDataList_SEQOF_sysData_standardInfo', Term1, Term2, Term3, Term4, Term5, Term6, Term7, Term8, Term9, Term10}, Bytes13, Rb1+Rb2+Rb3+Rb4+Rb5+Rb6+Rb7+Rb8+Rb9+Rb10+Rb11+Rb12}. -'dec_KmeDeviceDataList_SEQOF_sysData'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of - -%% 'standardInfo' - <<0:2,_:1,16:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeDeviceDataList_SEQOF_sysData_standardInfo'(Bytes1, mandatory, []), - {{standardInfo, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; - - -%% 'extName' - <<2:2,_:1,31:5,41,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeExtName'(Bytes1, mandatory, [{tag,128,41,'EXPLICIT',32}]), - {{extName, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; - - -%% 'fcoKeyList' - <<2:2,_:1,31:5,44,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeFcoKeyList'(Bytes1, mandatory, [{tag,128,44,'EXPLICIT',32}]), - {{fcoKeyList, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; - - -%% 'sxdpMaster' - <<2:2,_:1,31:5,45,_/binary>> -> - {Dec, Rest, RbCho} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes1, mandatory, [{tag,128,45,'EXPLICIT',32}]), - {{sxdpMaster, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; - - Else -> - case OptOrMand of - mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}}); - _ ->exit({error,{asn1,{no_optional_tag,Else}}}) - end - end. -'dec_KmeDeviceDataList_SEQOF'(Bytes, OptOrMand, TagIn) -> - %%------------------------------------------------- - %% decode tag and length - %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), - %%------------------------------------------------- -%% attribute number 1 External CSTA-device-identifiers:DeviceID +%% attribute messageWaiting(9) with type SEQUENCE OF OPTIONAL %%------------------------------------------------- - {Term1,Bytes3,Rb2} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes2, mandatory, [{tag,128,0,'EXPLICIT',32}]), +{Term9,Tlv10} = case Tlv9 of +[{131109,V9}|TempTlv10] -> + {'dec_KmeDeviceDataList_SEQOF_sysData_standardInfo_messageWaiting'(V9, [16]), TempTlv10}; + _ -> + { asn1_NOVALUE, Tlv9} +end, %%------------------------------------------------- -%% attribute number 2 with type CHOICE +%% attribute assocExtGroup(10) with type INTEGER OPTIONAL %%------------------------------------------------- - {Term2,Bytes4,Rb3} = 'dec_KmeDeviceDataList_SEQOF_sysData'(Bytes3, mandatory, [{tag,128,1,'EXPLICIT',32}]), - - {Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext), - {{'KmeDeviceDataList_SEQOF', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}. - +{Term10,Tlv11} = case Tlv10 of +[{131111,V10}|TempTlv11] -> + {decode_integer(V10, [2]), TempTlv11}; + _ -> + { asn1_NOVALUE, Tlv10} +end, -'dec_KmeDeviceDataList'(Bytes, OptOrMand) -> - 'dec_KmeDeviceDataList'(Bytes, OptOrMand, []). +case Tlv11 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv11}}}) % extra fields not allowed +end, + {'KmeDeviceDataList_SEQOF_sysData_standardInfo', Term1, Term2, Term3, Term4, Term5, Term6, Term7, Term8, Term9, Term10}. -'dec_KmeDeviceDataList'(Bytes, OptOrMand, TagIn) -> +'dec_KmeDeviceDataList_SEQOF_sysData_standardInfo_messageWaiting'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), - ?RT_BER:decode_components(Rb1, Len, Bytes1, fun 'dec_KmeDeviceDataList_SEQOF'/3, [], []). +Tlv1 = match_tags(Tlv, TagIn), +['CSTA-device-identifiers':'dec_DeviceID'(V1, [16]) || V1 <- Tlv1]. @@ -5942,182 +6505,173 @@ end, %%================================ %% KmePdnGMembers %%================================ +'enc_KmePdnGMembers'(Val) -> + 'enc_KmePdnGMembers'(Val, [<<48>>]). + 'enc_KmePdnGMembers'(Val, TagIn) -> +{_,Cindex1, Cindex2} = Val, %%------------------------------------------------- -%% attribute number 1 External CSTA-device-identifiers:DeviceID +%% attribute groupDevice(1) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {EncBytes1,EncLen1} = 'CSTA-device-identifiers':'enc_DeviceID'(?RT_BER:cindex(2,Val,groupDevice), [{tag,128,0,'IMPLICIT',32}]), + {EncBytes1,EncLen1} = 'CSTA-device-identifiers':'enc_DeviceID'(Cindex1, [<<160>>]), %%------------------------------------------------- -%% attribute number 2 with type SEQUENCE OF +%% attribute members(2) with type SEQUENCE OF %%------------------------------------------------- - {EncBytes2,EncLen2} = 'enc_KmePdnGMembers_members'(?RT_BER:cindex(3,Val,members), [{tag,128,1,'IMPLICIT',32}]), + {EncBytes2,EncLen2} = 'enc_KmePdnGMembers_members'(Cindex2, [<<161>>]), BytesSoFar = [EncBytes1, EncBytes2], - LenSoFar = EncLen1 + EncLen2, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2, +encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% KmePdnGMembers_members %%================================ - -'enc_KmePdnGMembers_members'({'KmePdnGMembers_members',Val}, TagIn) -> - 'enc_KmePdnGMembers_members'(Val, TagIn); - 'enc_KmePdnGMembers_members'(Val, TagIn) -> {EncBytes,EncLen} = 'enc_KmePdnGMembers_members_components'(Val,[],0), - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], EncBytes, EncLen). + encode_tags(TagIn, EncBytes, EncLen). 'enc_KmePdnGMembers_members_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_KmePdnGMembers_members_components'([H|T],AccBytes, AccLen) -> - {EncBytes,EncLen} = 'CSTA-device-identifiers':'enc_DeviceID'(H, []), + {EncBytes,EncLen} = 'CSTA-device-identifiers':'enc_DeviceID'(H, [<<48>>]), 'enc_KmePdnGMembers_members_components'(T,[EncBytes|AccBytes], AccLen + EncLen). -'dec_KmePdnGMembers_members'(Bytes, OptOrMand, TagIn) -> - %%------------------------------------------------- - %% decode tag and length - %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), - ?RT_BER:decode_components(Rb1, Len, Bytes1, fun 'CSTA-device-identifiers':'dec_DeviceID'/3, [], []). +'dec_KmePdnGMembers'(Tlv) -> + 'dec_KmePdnGMembers'(Tlv, [16]). - -'dec_KmePdnGMembers'(Bytes, OptOrMand) -> - 'dec_KmePdnGMembers'(Bytes, OptOrMand, []). - -'dec_KmePdnGMembers'(Bytes, OptOrMand, TagIn) -> +'dec_KmePdnGMembers'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 External CSTA-device-identifiers:DeviceID +%% attribute groupDevice(1) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {Term1,Bytes3,Rb2} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes2, mandatory, [{tag,128,0,'IMPLICIT',32}]), +[V1|Tlv2] = Tlv1, +Term1 = 'CSTA-device-identifiers':'dec_DeviceID'(V1, [131072]), %%------------------------------------------------- -%% attribute number 2 with type SEQUENCE OF +%% attribute members(2) with type SEQUENCE OF %%------------------------------------------------- - {Term2,Bytes4,Rb3} = 'dec_KmePdnGMembers_members'(Bytes3, mandatory, [{tag,128,1,'IMPLICIT',32}]), +[V2|Tlv3] = Tlv2, +Term2 = 'dec_KmePdnGMembers_members'(V2, [131073]), + +case Tlv3 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed +end, + {'KmePdnGMembers', Term1, Term2}. + +'dec_KmePdnGMembers_members'(Tlv, TagIn) -> + %%------------------------------------------------- + %% decode tag and length + %%------------------------------------------------- +Tlv1 = match_tags(Tlv, TagIn), +['CSTA-device-identifiers':'dec_DeviceID'(V1, [16]) || V1 <- Tlv1]. + - {Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext), - {{'KmePdnGMembers', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}. %%================================ %% KmeHotelSrvEvt %%================================ - -'enc_KmeHotelSrvEvt'({'KmeHotelSrvEvt',Val}, TagIn) -> - 'enc_KmeHotelSrvEvt'(Val, TagIn); +'enc_KmeHotelSrvEvt'(Val) -> + 'enc_KmeHotelSrvEvt'(Val, []). 'enc_KmeHotelSrvEvt'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of guestCheckIn -> - 'CSTA-device-identifiers':'enc_DeviceID'(element(2,Val), [{tag,128,0,'IMPLICIT',32}]); + 'CSTA-device-identifiers':'enc_DeviceID'(element(2,Val), [<<160>>]); guestCheckOut -> - 'CSTA-device-identifiers':'enc_DeviceID'(element(2,Val), [{tag,128,1,'IMPLICIT',32}]); + 'CSTA-device-identifiers':'enc_DeviceID'(element(2,Val), [<<161>>]); checkedIn -> - 'CSTA-device-identifiers':'enc_DeviceID'(element(2,Val), [{tag,128,2,'IMPLICIT',32}]); + 'CSTA-device-identifiers':'enc_DeviceID'(element(2,Val), [<<162>>]); checkedOut -> - 'CSTA-device-identifiers':'enc_DeviceID'(element(2,Val), [{tag,128,3,'IMPLICIT',32}]); + 'CSTA-device-identifiers':'enc_DeviceID'(element(2,Val), [<<163>>]); cleanUp -> - 'CSTA-device-identifiers':'enc_DeviceID'(element(2,Val), [{tag,128,4,'IMPLICIT',32}]); + 'CSTA-device-identifiers':'enc_DeviceID'(element(2,Val), [<<164>>]); cleanUpReady -> - 'CSTA-device-identifiers':'enc_DeviceID'(element(2,Val), [{tag,128,5,'IMPLICIT',32}]); + 'CSTA-device-identifiers':'enc_DeviceID'(element(2,Val), [<<165>>]); cleanUpNotReady -> - 'CSTA-device-identifiers':'enc_DeviceID'(element(2,Val), [{tag,128,6,'IMPLICIT',32}]); + 'CSTA-device-identifiers':'enc_DeviceID'(element(2,Val), [<<166>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). +encode_tags(TagIn, EncBytes, EncLen). -'dec_KmeHotelSrvEvt'(Bytes, OptOrMand) -> - 'dec_KmeHotelSrvEvt'(Bytes, OptOrMand, []). +'dec_KmeHotelSrvEvt'(Tlv) -> + 'dec_KmeHotelSrvEvt'(Tlv, []). -'dec_KmeHotelSrvEvt'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of +'dec_KmeHotelSrvEvt'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of %% 'guestCheckIn' - <<2:2,_:1,0:5,_/binary>> -> - {Dec, Rest, RbCho} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes1, mandatory, [{tag,128,0,'IMPLICIT',32}]), - {{guestCheckIn, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131072, V1} -> + {guestCheckIn, 'CSTA-device-identifiers':'dec_DeviceID'(V1, [])}; %% 'guestCheckOut' - <<2:2,_:1,1:5,_/binary>> -> - {Dec, Rest, RbCho} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes1, mandatory, [{tag,128,1,'IMPLICIT',32}]), - {{guestCheckOut, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131073, V1} -> + {guestCheckOut, 'CSTA-device-identifiers':'dec_DeviceID'(V1, [])}; %% 'checkedIn' - <<2:2,_:1,2:5,_/binary>> -> - {Dec, Rest, RbCho} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes1, mandatory, [{tag,128,2,'IMPLICIT',32}]), - {{checkedIn, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131074, V1} -> + {checkedIn, 'CSTA-device-identifiers':'dec_DeviceID'(V1, [])}; %% 'checkedOut' - <<2:2,_:1,3:5,_/binary>> -> - {Dec, Rest, RbCho} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes1, mandatory, [{tag,128,3,'IMPLICIT',32}]), - {{checkedOut, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131075, V1} -> + {checkedOut, 'CSTA-device-identifiers':'dec_DeviceID'(V1, [])}; %% 'cleanUp' - <<2:2,_:1,4:5,_/binary>> -> - {Dec, Rest, RbCho} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes1, mandatory, [{tag,128,4,'IMPLICIT',32}]), - {{cleanUp, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131076, V1} -> + {cleanUp, 'CSTA-device-identifiers':'dec_DeviceID'(V1, [])}; %% 'cleanUpReady' - <<2:2,_:1,5:5,_/binary>> -> - {Dec, Rest, RbCho} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes1, mandatory, [{tag,128,5,'IMPLICIT',32}]), - {{cleanUpReady, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131077, V1} -> + {cleanUpReady, 'CSTA-device-identifiers':'dec_DeviceID'(V1, [])}; %% 'cleanUpNotReady' - <<2:2,_:1,6:5,_/binary>> -> - {Dec, Rest, RbCho} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes1, mandatory, [{tag,128,6,'IMPLICIT',32}]), - {{cleanUpNotReady, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131078, V1} -> + {cleanUpNotReady, 'CSTA-device-identifiers':'dec_DeviceID'(V1, [])}; Else -> - case OptOrMand of - mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}}); - _ ->exit({error,{asn1,{no_optional_tag,Else}}}) - end - end. + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. %%================================ %% KmeCheckStatusList %%================================ - -'enc_KmeCheckStatusList'({'KmeCheckStatusList',Val}, TagIn) -> - 'enc_KmeCheckStatusList'(Val, TagIn); +'enc_KmeCheckStatusList'(Val) -> + 'enc_KmeCheckStatusList'(Val, [<<48>>]). 'enc_KmeCheckStatusList'(Val, TagIn) -> {EncBytes,EncLen} = 'enc_KmeCheckStatusList_components'(Val,[],0), - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], EncBytes, EncLen). + encode_tags(TagIn, EncBytes, EncLen). 'enc_KmeCheckStatusList_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_KmeCheckStatusList_components'([H|T],AccBytes, AccLen) -> - {EncBytes,EncLen} = 'enc_KmeCheckStatusList_SEQOF'(H, []), + {EncBytes,EncLen} = 'enc_KmeCheckStatusList_SEQOF'(H, [<<48>>]), 'enc_KmeCheckStatusList_components'(T,[EncBytes|AccBytes], AccLen + EncLen). @@ -6127,187 +6681,205 @@ end, %% KmeCheckStatusList_SEQOF %%================================ 'enc_KmeCheckStatusList_SEQOF'(Val, TagIn) -> - + {_,Cindex1, Cindex2, Cindex3} = Val, + %%------------------------------------------------- -%% attribute number 1 External CSTA-device-identifiers:DeviceID +%% attribute extNo(1) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {EncBytes1,EncLen1} = 'CSTA-device-identifiers':'enc_DeviceID'(?RT_BER:cindex(2,Val,extNo), []), + {EncBytes1,EncLen1} = 'CSTA-device-identifiers':'enc_DeviceID'(Cindex1, [<<48>>]), %%------------------------------------------------- -%% attribute number 2 with type ENUMERATED +%% attribute status(2) with type ENUMERATED %%------------------------------------------------- - {EncBytes2,EncLen2} = case (case ?RT_BER:cindex(3,Val,status) of {_,Enumval1}->Enumval1;_->?RT_BER:cindex(3,Val,status) end) of -checkIn -> ?RT_BER:encode_enumerated(0,[]); -checkOut -> ?RT_BER:encode_enumerated(1,[]); -Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) + {EncBytes2,EncLen2} = case Cindex2 of +checkIn -> encode_tags([<<10>>], [0], 1); +checkOut -> encode_tags([<<10>>], [1], 1); +Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}}) end, %%------------------------------------------------- -%% attribute number 3 with type ENUMERATED OPTIONAL +%% attribute cleanUpStatus(3) with type ENUMERATED OPTIONAL %%------------------------------------------------- - {EncBytes3,EncLen3} = case ?RT_BER:cindex(4,Val,cleanUpStatus) of + {EncBytes3,EncLen3} = case Cindex3 of asn1_NOVALUE -> {<<>>,0}; _ -> - case (case ?RT_BER:cindex(4,Val,cleanUpStatus) of {_,Enumval3}->Enumval3;_->?RT_BER:cindex(4,Val,cleanUpStatus) end) of -ready -> ?RT_BER:encode_enumerated(0,[]); -notReady -> ?RT_BER:encode_enumerated(1,[]); -Enumval4 -> exit({error,{asn1, {enumerated_not_in_range,Enumval4}}}) + case Cindex3 of +ready -> encode_tags([<<10>>], [0], 1); +notReady -> encode_tags([<<10>>], [1], 1); +Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) end end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3], - LenSoFar = EncLen1 + EncLen2 + EncLen3, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). -'dec_KmeCheckStatusList_SEQOF'(Bytes, OptOrMand, TagIn) -> +LenSoFar = EncLen1 + EncLen2 + EncLen3, +encode_tags(TagIn, BytesSoFar, LenSoFar). + + +'dec_KmeCheckStatusList'(Tlv) -> + 'dec_KmeCheckStatusList'(Tlv, [16]). + +'dec_KmeCheckStatusList'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), +['dec_KmeCheckStatusList_SEQOF'(V1, [16]) || V1 <- Tlv1]. + + +'dec_KmeCheckStatusList_SEQOF'(Tlv, TagIn) -> + %%------------------------------------------------- + %% decode tag and length + %%------------------------------------------------- +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 External CSTA-device-identifiers:DeviceID +%% attribute extNo(1) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {Term1,Bytes3,Rb2} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes2, mandatory, []), +[V1|Tlv2] = Tlv1, +Term1 = 'CSTA-device-identifiers':'dec_DeviceID'(V1, [16]), %%------------------------------------------------- -%% attribute number 2 with type ENUMERATED +%% attribute status(2) with type ENUMERATED %%------------------------------------------------- - {Term2,Bytes4,Rb3} = ?RT_BER:decode_enumerated(Bytes3,[],[{checkIn,0},{checkOut,1}],[], mandatory), +[V2|Tlv3] = Tlv2, +Term2 = case decode_integer(V2, [10]) of +0 -> checkIn; +1 -> checkOut; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end, %%------------------------------------------------- -%% attribute number 3 with type ENUMERATED OPTIONAL +%% attribute cleanUpStatus(3) with type ENUMERATED OPTIONAL %%------------------------------------------------- - {Term3,Bytes5,Rb4} = case Bytes4 of -<<0:2,_:1,10:5,_/binary>> -> -?RT_BER:decode_enumerated(Bytes4,[],[{ready,0},{notReady,1}],[], mandatory); -_ -> -{ asn1_NOVALUE, Bytes4, 0 } +{Term3,Tlv4} = case Tlv3 of +[{10,V3}|TempTlv4] -> + {case decode_integer(V3, []) of +0 -> ready; +1 -> notReady; +Default2 -> exit({error,{asn1,{illegal_enumerated,Default2}}}) +end, TempTlv4}; + _ -> + { asn1_NOVALUE, Tlv3} end, - {Bytes6,Rb5} = ?RT_BER:restbytes2(RemBytes, Bytes5,noext), - {{'KmeCheckStatusList_SEQOF', Term1, Term2, Term3}, Bytes6, Rb1+Rb2+Rb3+Rb4+Rb5}. - - -'dec_KmeCheckStatusList'(Bytes, OptOrMand) -> - 'dec_KmeCheckStatusList'(Bytes, OptOrMand, []). - -'dec_KmeCheckStatusList'(Bytes, OptOrMand, TagIn) -> - %%------------------------------------------------- - %% decode tag and length - %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), - ?RT_BER:decode_components(Rb1, Len, Bytes1, fun 'dec_KmeCheckStatusList_SEQOF'/3, [], []). - +case Tlv4 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowed +end, + {'KmeCheckStatusList_SEQOF', Term1, Term2, Term3}. %%================================ %% KmeRoomStatus %%================================ - -'enc_KmeRoomStatus'({'KmeRoomStatus',Val}, TagIn) -> - 'enc_KmeRoomStatus'(Val, TagIn); +'enc_KmeRoomStatus'(Val) -> + 'enc_KmeRoomStatus'(Val, [<<10>>]). 'enc_KmeRoomStatus'(Val, TagIn) -> -case (case Val of {_,Enumval1}->Enumval1;_->Val end) of -checkIn -> ?RT_BER:encode_enumerated(0,TagIn ++ []); -checkOut -> ?RT_BER:encode_enumerated(1,TagIn ++ []); -Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) +case Val of +checkIn -> encode_tags(TagIn, [0], 1); +checkOut -> encode_tags(TagIn, [1], 1); +Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}}) end. -'dec_KmeRoomStatus'(Bytes, OptOrMand) -> - 'dec_KmeRoomStatus'(Bytes, OptOrMand, []). +'dec_KmeRoomStatus'(Tlv) -> + 'dec_KmeRoomStatus'(Tlv, [10]). -'dec_KmeRoomStatus'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_enumerated(Bytes,[],[{checkIn,0},{checkOut,1}],TagIn++[], OptOrMand). +'dec_KmeRoomStatus'(Tlv, TagIn) -> +case decode_integer(Tlv, TagIn) of +0 -> checkIn; +1 -> checkOut; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end. %%================================ %% KmeCleanUpStatus %%================================ - -'enc_KmeCleanUpStatus'({'KmeCleanUpStatus',Val}, TagIn) -> - 'enc_KmeCleanUpStatus'(Val, TagIn); +'enc_KmeCleanUpStatus'(Val) -> + 'enc_KmeCleanUpStatus'(Val, [<<10>>]). 'enc_KmeCleanUpStatus'(Val, TagIn) -> -case (case Val of {_,Enumval1}->Enumval1;_->Val end) of -ready -> ?RT_BER:encode_enumerated(0,TagIn ++ []); -notReady -> ?RT_BER:encode_enumerated(1,TagIn ++ []); -Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) +case Val of +ready -> encode_tags(TagIn, [0], 1); +notReady -> encode_tags(TagIn, [1], 1); +Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}}) end. -'dec_KmeCleanUpStatus'(Bytes, OptOrMand) -> - 'dec_KmeCleanUpStatus'(Bytes, OptOrMand, []). +'dec_KmeCleanUpStatus'(Tlv) -> + 'dec_KmeCleanUpStatus'(Tlv, [10]). -'dec_KmeCleanUpStatus'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_enumerated(Bytes,[],[{ready,0},{notReady,1}],TagIn++[], OptOrMand). +'dec_KmeCleanUpStatus'(Tlv, TagIn) -> +case decode_integer(Tlv, TagIn) of +0 -> ready; +1 -> notReady; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end. %%================================ %% KmeGetSystemDataReq %%================================ - -'enc_KmeGetSystemDataReq'({'KmeGetSystemDataReq',Val}, TagIn) -> - 'enc_KmeGetSystemDataReq'(Val, TagIn); +'enc_KmeGetSystemDataReq'(Val) -> + 'enc_KmeGetSystemDataReq'(Val, []). 'enc_KmeGetSystemDataReq'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of systemData -> - case (case element(2,Val) of {_,Enumval1}->Enumval1;_->element(2,Val) end) of -sysTimeStamp -> ?RT_BER:encode_enumerated(0,[{tag,128,0,'EXPLICIT',32}]); -devTimeStamp -> ?RT_BER:encode_enumerated(1,[{tag,128,0,'EXPLICIT',32}]); -featureList -> ?RT_BER:encode_enumerated(2,[{tag,128,0,'EXPLICIT',32}]); -speedDial -> ?RT_BER:encode_enumerated(3,[{tag,128,0,'EXPLICIT',32}]); -trunkGroup -> ?RT_BER:encode_enumerated(4,[{tag,128,0,'EXPLICIT',32}]); -extensionGroup -> ?RT_BER:encode_enumerated(5,[{tag,128,0,'EXPLICIT',32}]); -pickupGroup -> ?RT_BER:encode_enumerated(6,[{tag,128,0,'EXPLICIT',32}]); -pagingGroup -> ?RT_BER:encode_enumerated(7,[{tag,128,0,'EXPLICIT',32}]); -incomingGroup -> ?RT_BER:encode_enumerated(8,[{tag,128,0,'EXPLICIT',32}]); -dayNightMode -> ?RT_BER:encode_enumerated(9,[{tag,128,0,'EXPLICIT',32}]); -doorPhone -> ?RT_BER:encode_enumerated(10,[{tag,128,0,'EXPLICIT',32}]); -vmGroup -> ?RT_BER:encode_enumerated(11,[{tag,128,0,'EXPLICIT',32}]); -manufacturerName -> ?RT_BER:encode_enumerated(12,[{tag,128,0,'EXPLICIT',32}]); -subdomainName -> ?RT_BER:encode_enumerated(13,[{tag,128,0,'EXPLICIT',32}]); -softwareVersion -> ?RT_BER:encode_enumerated(14,[{tag,128,0,'EXPLICIT',32}]); -ctiVersion -> ?RT_BER:encode_enumerated(15,[{tag,128,0,'EXPLICIT',32}]); -regionCode -> ?RT_BER:encode_enumerated(16,[{tag,128,0,'EXPLICIT',32}]); -systemTime -> ?RT_BER:encode_enumerated(17,[{tag,128,0,'EXPLICIT',32}]); -numberOfMsgPort -> ?RT_BER:encode_enumerated(18,[{tag,128,0,'EXPLICIT',32}]); -psGroup -> ?RT_BER:encode_enumerated(19,[{tag,128,0,'EXPLICIT',32}]); -whoAmI -> ?RT_BER:encode_enumerated(20,[{tag,128,0,'EXPLICIT',32}]); -broadcastGroup -> ?RT_BER:encode_enumerated(21,[{tag,128,0,'EXPLICIT',32}]); -pbxType -> ?RT_BER:encode_enumerated(22,[{tag,128,0,'EXPLICIT',32}]); -externalSensor -> ?RT_BER:encode_enumerated(23,[{tag,128,0,'EXPLICIT',32}]); -svm -> ?RT_BER:encode_enumerated(24,[{tag,128,0,'EXPLICIT',32}]); -pdn -> ?RT_BER:encode_enumerated(25,[{tag,128,0,'EXPLICIT',32}]); -Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) + case element(2,Val) of +sysTimeStamp -> encode_tags([<<10>>,<<160>>], [0], 1); +devTimeStamp -> encode_tags([<<10>>,<<160>>], [1], 1); +featureList -> encode_tags([<<10>>,<<160>>], [2], 1); +speedDial -> encode_tags([<<10>>,<<160>>], [3], 1); +trunkGroup -> encode_tags([<<10>>,<<160>>], [4], 1); +extensionGroup -> encode_tags([<<10>>,<<160>>], [5], 1); +pickupGroup -> encode_tags([<<10>>,<<160>>], [6], 1); +pagingGroup -> encode_tags([<<10>>,<<160>>], [7], 1); +incomingGroup -> encode_tags([<<10>>,<<160>>], [8], 1); +dayNightMode -> encode_tags([<<10>>,<<160>>], [9], 1); +doorPhone -> encode_tags([<<10>>,<<160>>], [10], 1); +vmGroup -> encode_tags([<<10>>,<<160>>], [11], 1); +manufacturerName -> encode_tags([<<10>>,<<160>>], [12], 1); +subdomainName -> encode_tags([<<10>>,<<160>>], [13], 1); +softwareVersion -> encode_tags([<<10>>,<<160>>], [14], 1); +ctiVersion -> encode_tags([<<10>>,<<160>>], [15], 1); +regionCode -> encode_tags([<<10>>,<<160>>], [16], 1); +systemTime -> encode_tags([<<10>>,<<160>>], [17], 1); +numberOfMsgPort -> encode_tags([<<10>>,<<160>>], [18], 1); +psGroup -> encode_tags([<<10>>,<<160>>], [19], 1); +whoAmI -> encode_tags([<<10>>,<<160>>], [20], 1); +broadcastGroup -> encode_tags([<<10>>,<<160>>], [21], 1); +pbxType -> encode_tags([<<10>>,<<160>>], [22], 1); +externalSensor -> encode_tags([<<10>>,<<160>>], [23], 1); +svm -> encode_tags([<<10>>,<<160>>], [24], 1); +pdn -> encode_tags([<<10>>,<<160>>], [25], 1); +Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}}) end; deviceData -> - 'enc_KmeGetSystemDataReq_deviceData'(element(2,Val), [{tag,128,1,'EXPLICIT',32}]); + 'enc_KmeGetSystemDataReq_deviceData'(element(2,Val), [<<48>>,<<161>>]); trkExtGMember -> - 'enc_KmeGetSystemDataReq_trkExtGMember'(element(2,Val), [{tag,128,2,'IMPLICIT',32}]); + 'enc_KmeGetSystemDataReq_trkExtGMember'(element(2,Val), [<<162>>]); incomGMember -> - 'enc_KmeGetSystemDataReq_incomGMember'(element(2,Val), [{tag,128,3,'IMPLICIT',32}]); + 'enc_KmeGetSystemDataReq_incomGMember'(element(2,Val), [<<163>>]); deviceList -> - 'enc_KmeRequestedDevice'(element(2,Val), [{tag,128,4,'EXPLICIT',32}]); + 'enc_KmeRequestedDevice'(element(2,Val), [<<164>>]); vmGMember -> - 'CSTA-device-identifiers':'enc_DeviceID'(element(2,Val), [{tag,128,5,'EXPLICIT',32}]); + 'CSTA-device-identifiers':'enc_DeviceID'(element(2,Val), [<<48>>,<<165>>]); speedDial -> - 'enc_KmeSpeedDialRequest'(element(2,Val), [{tag,128,6,'EXPLICIT',32}]); + 'enc_KmeSpeedDialRequest'(element(2,Val), [<<48>>,<<166>>]); broadcastGMembers -> - ?RT_BER:encode_integer([], element(2,Val), [{tag,128,7,'EXPLICIT',32}]); + encode_integer(element(2,Val), [<<2>>,<<167>>]); guestCheckStatus -> - 'CSTA-device-identifiers':'enc_DeviceID'(element(2,Val), [{tag,128,8,'IMPLICIT',32}]); + 'CSTA-device-identifiers':'enc_DeviceID'(element(2,Val), [<<168>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). +encode_tags(TagIn, EncBytes, EncLen). @@ -6317,101 +6889,44 @@ end; %% KmeGetSystemDataReq_deviceData %%================================ 'enc_KmeGetSystemDataReq_deviceData'(Val, TagIn) -> - + {_,Cindex1, Cindex2} = Val, + %%------------------------------------------------- -%% attribute number 1 External CSTA-device-identifiers:DeviceID +%% attribute device(1) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {EncBytes1,EncLen1} = 'CSTA-device-identifiers':'enc_DeviceID'(?RT_BER:cindex(2,Val,device), [{tag,128,0,'EXPLICIT',32}]), + {EncBytes1,EncLen1} = 'CSTA-device-identifiers':'enc_DeviceID'(Cindex1, [<<48>>,<<160>>]), %%------------------------------------------------- -%% attribute number 2 with type CHOICE +%% attribute sysData(2) with type CHOICE %%------------------------------------------------- - {EncBytes2,EncLen2} = 'enc_KmeGetSystemDataReq_deviceData_sysData'(?RT_BER:cindex(3,Val,sysData), [{tag,128,1,'EXPLICIT',32}]), + {EncBytes2,EncLen2} = 'enc_KmeGetSystemDataReq_deviceData_sysData'(Cindex2, [<<161>>]), BytesSoFar = [EncBytes1, EncBytes2], - LenSoFar = EncLen1 + EncLen2, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2, +encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% KmeGetSystemDataReq_deviceData_sysData %%================================ - -'enc_KmeGetSystemDataReq_deviceData_sysData'({'KmeGetSystemDataReq_deviceData_sysData',Val}, TagIn) -> - 'enc_KmeGetSystemDataReq_deviceData_sysData'(Val, TagIn); - 'enc_KmeGetSystemDataReq_deviceData_sysData'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of standardInfo -> - ?RT_BER:encode_bit_string([], element(2,Val), [{wakeUp,0},{remoteStatationLock,1},{callLogLock,2},{absentMessage,3},{forwardDnd,4},{cos,5},{phoneProperty,6},{assocIncomGroup,7},{messageWating,8},{assocExtGroup,9}], []); + encode_named_bit_string(element(2,Val), [{wakeUp,0},{remoteStatationLock,1},{callLogLock,2},{absentMessage,3},{forwardDnd,4},{cos,5},{phoneProperty,6},{assocIncomGroup,7},{messageWating,8},{assocExtGroup,9}], [<<3>>]); extName -> - ?RT_BER:encode_null(element(2,Val), [{tag,128,1,'EXPLICIT',32}]); + encode_null(element(2,Val), [<<5>>,<<161>>]); fcoKey -> - ?RT_BER:encode_null(element(2,Val), [{tag,128,2,'EXPLICIT',32}]); + encode_null(element(2,Val), [<<5>>,<<162>>]); sxdpMaster -> - ?RT_BER:encode_null(element(2,Val), [{tag,128,3,'EXPLICIT',32}]); + encode_null(element(2,Val), [<<5>>,<<163>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). - - -'dec_KmeGetSystemDataReq_deviceData_sysData'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of - -%% 'standardInfo' - <<0:2,_:1,3:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_bit_string(Bytes1,[],[{wakeUp,0},{remoteStatationLock,1},{callLogLock,2},{absentMessage,3},{forwardDnd,4},{cos,5},{phoneProperty,6},{assocIncomGroup,7},{messageWating,8},{assocExtGroup,9}],[], no_length, mandatory), - {{standardInfo, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; - - -%% 'extName' - <<2:2,_:1,1:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_null(Bytes1,[{tag,128,1,'EXPLICIT',32}], mandatory), - {{extName, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; - - -%% 'fcoKey' - <<2:2,_:1,2:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_null(Bytes1,[{tag,128,2,'EXPLICIT',32}], mandatory), - {{fcoKey, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; - +encode_tags(TagIn, EncBytes, EncLen). -%% 'sxdpMaster' - <<2:2,_:1,3:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_null(Bytes1,[{tag,128,3,'EXPLICIT',32}], mandatory), - {{sxdpMaster, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; - - Else -> - case OptOrMand of - mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}}); - _ ->exit({error,{asn1,{no_optional_tag,Else}}}) - end - end. -'dec_KmeGetSystemDataReq_deviceData'(Bytes, OptOrMand, TagIn) -> - %%------------------------------------------------- - %% decode tag and length - %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), - -%%------------------------------------------------- -%% attribute number 1 External CSTA-device-identifiers:DeviceID -%%------------------------------------------------- - {Term1,Bytes3,Rb2} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes2, mandatory, [{tag,128,0,'EXPLICIT',32}]), - -%%------------------------------------------------- -%% attribute number 2 with type CHOICE -%%------------------------------------------------- - {Term2,Bytes4,Rb3} = 'dec_KmeGetSystemDataReq_deviceData_sysData'(Bytes3, mandatory, [{tag,128,1,'EXPLICIT',32}]), - {Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext), - {{'KmeGetSystemDataReq_deviceData', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}. @@ -6419,43 +6934,25 @@ end; %% KmeGetSystemDataReq_trkExtGMember %%================================ 'enc_KmeGetSystemDataReq_trkExtGMember'(Val, TagIn) -> - + {_,Cindex1, Cindex2} = Val, + %%------------------------------------------------- -%% attribute number 1 with type INTEGER +%% attribute groupNo(1) with type INTEGER %%------------------------------------------------- - {EncBytes1,EncLen1} = ?RT_BER:encode_integer([], ?RT_BER:cindex(2,Val,groupNo), []), + {EncBytes1,EncLen1} = encode_integer(Cindex1, [<<2>>]), %%------------------------------------------------- -%% attribute number 2 with type ENUMERATED +%% attribute groupType(2) with type ENUMERATED %%------------------------------------------------- - {EncBytes2,EncLen2} = case (case ?RT_BER:cindex(3,Val,groupType) of {_,Enumval2}->Enumval2;_->?RT_BER:cindex(3,Val,groupType) end) of -trunkGMembers -> ?RT_BER:encode_enumerated(0,[]); -extGMembers -> ?RT_BER:encode_enumerated(1,[]); -Enumval3 -> exit({error,{asn1, {enumerated_not_in_range,Enumval3}}}) + {EncBytes2,EncLen2} = case Cindex2 of +trunkGMembers -> encode_tags([<<10>>], [0], 1); +extGMembers -> encode_tags([<<10>>], [1], 1); +Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) end, BytesSoFar = [EncBytes1, EncBytes2], - LenSoFar = EncLen1 + EncLen2, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). -'dec_KmeGetSystemDataReq_trkExtGMember'(Bytes, OptOrMand, TagIn) -> - %%------------------------------------------------- - %% decode tag and length - %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), - -%%------------------------------------------------- -%% attribute number 1 with type INTEGER -%%------------------------------------------------- - {Term1,Bytes3,Rb2} = ?RT_BER:decode_integer(Bytes2,[],[], mandatory), - -%%------------------------------------------------- -%% attribute number 2 with type ENUMERATED -%%------------------------------------------------- - {Term2,Bytes4,Rb3} = ?RT_BER:decode_enumerated(Bytes3,[],[{trunkGMembers,0},{extGMembers,1}],[], mandatory), - - {Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext), - {{'KmeGetSystemDataReq_trkExtGMember', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}. +LenSoFar = EncLen1 + EncLen2, +encode_tags(TagIn, BytesSoFar, LenSoFar). @@ -6463,1138 +6960,1274 @@ end, %% KmeGetSystemDataReq_incomGMember %%================================ 'enc_KmeGetSystemDataReq_incomGMember'(Val, TagIn) -> - -%%------------------------------------------------- -%% attribute number 1 External CSTA-device-identifiers:DeviceID -%%------------------------------------------------- - {EncBytes1,EncLen1} = 'CSTA-device-identifiers':'enc_DeviceID'(?RT_BER:cindex(2,Val,groupNo), []), - - BytesSoFar = [EncBytes1], - LenSoFar = EncLen1, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). -'dec_KmeGetSystemDataReq_incomGMember'(Bytes, OptOrMand, TagIn) -> - %%------------------------------------------------- - %% decode tag and length - %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), + {_,Cindex1} = Val, %%------------------------------------------------- -%% attribute number 1 External CSTA-device-identifiers:DeviceID +%% attribute groupNo(1) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {Term1,Bytes3,Rb2} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes2, mandatory, []), + {EncBytes1,EncLen1} = 'CSTA-device-identifiers':'enc_DeviceID'(Cindex1, [<<48>>]), - {Bytes4,Rb3} = ?RT_BER:restbytes2(RemBytes, Bytes3,noext), - {{'KmeGetSystemDataReq_incomGMember', Term1}, Bytes4, Rb1+Rb2+Rb3}. + BytesSoFar = [EncBytes1], +LenSoFar = EncLen1, +encode_tags(TagIn, BytesSoFar, LenSoFar). -'dec_KmeGetSystemDataReq'(Bytes, OptOrMand) -> - 'dec_KmeGetSystemDataReq'(Bytes, OptOrMand, []). +'dec_KmeGetSystemDataReq'(Tlv) -> + 'dec_KmeGetSystemDataReq'(Tlv, []). -'dec_KmeGetSystemDataReq'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of +'dec_KmeGetSystemDataReq'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of %% 'systemData' - <<2:2,_:1,0:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_enumerated(Bytes1,[],[{sysTimeStamp,0},{devTimeStamp,1},{featureList,2},{speedDial,3},{trunkGroup,4},{extensionGroup,5},{pickupGroup,6},{pagingGroup,7},{incomingGroup,8},{dayNightMode,9},{doorPhone,10},{vmGroup,11},{manufacturerName,12},{subdomainName,13},{softwareVersion,14},{ctiVersion,15},{regionCode,16},{systemTime,17},{numberOfMsgPort,18},{psGroup,19},{whoAmI,20},{broadcastGroup,21},{pbxType,22},{externalSensor,23},{svm,24},{pdn,25}],[{tag,128,0,'EXPLICIT',32}], mandatory), - {{systemData, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131072, V1} -> + {systemData, case decode_integer(V1, [10]) of +0 -> sysTimeStamp; +1 -> devTimeStamp; +2 -> featureList; +3 -> speedDial; +4 -> trunkGroup; +5 -> extensionGroup; +6 -> pickupGroup; +7 -> pagingGroup; +8 -> incomingGroup; +9 -> dayNightMode; +10 -> doorPhone; +11 -> vmGroup; +12 -> manufacturerName; +13 -> subdomainName; +14 -> softwareVersion; +15 -> ctiVersion; +16 -> regionCode; +17 -> systemTime; +18 -> numberOfMsgPort; +19 -> psGroup; +20 -> whoAmI; +21 -> broadcastGroup; +22 -> pbxType; +23 -> externalSensor; +24 -> svm; +25 -> pdn; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end}; %% 'deviceData' - <<2:2,_:1,1:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeGetSystemDataReq_deviceData'(Bytes1, mandatory, [{tag,128,1,'EXPLICIT',32}]), - {{deviceData, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131073, V1} -> + {deviceData, 'dec_KmeGetSystemDataReq_deviceData'(V1, [16])}; %% 'trkExtGMember' - <<2:2,_:1,2:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeGetSystemDataReq_trkExtGMember'(Bytes1, mandatory, [{tag,128,2,'IMPLICIT',32}]), - {{trkExtGMember, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131074, V1} -> + {trkExtGMember, 'dec_KmeGetSystemDataReq_trkExtGMember'(V1, [])}; %% 'incomGMember' - <<2:2,_:1,3:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeGetSystemDataReq_incomGMember'(Bytes1, mandatory, [{tag,128,3,'IMPLICIT',32}]), - {{incomGMember, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131075, V1} -> + {incomGMember, 'dec_KmeGetSystemDataReq_incomGMember'(V1, [])}; %% 'deviceList' - <<2:2,_:1,4:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeRequestedDevice'(Bytes1, mandatory, [{tag,128,4,'EXPLICIT',32}]), - {{deviceList, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131076, V1} -> + {deviceList, 'dec_KmeRequestedDevice'(V1, [])}; %% 'vmGMember' - <<2:2,_:1,5:5,_/binary>> -> - {Dec, Rest, RbCho} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes1, mandatory, [{tag,128,5,'EXPLICIT',32}]), - {{vmGMember, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131077, V1} -> + {vmGMember, 'CSTA-device-identifiers':'dec_DeviceID'(V1, [16])}; %% 'speedDial' - <<2:2,_:1,6:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeSpeedDialRequest'(Bytes1, mandatory, [{tag,128,6,'EXPLICIT',32}]), - {{speedDial, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131078, V1} -> + {speedDial, 'dec_KmeSpeedDialRequest'(V1, [16])}; %% 'broadcastGMembers' - <<2:2,_:1,7:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_integer(Bytes1,[],[{tag,128,7,'EXPLICIT',32}], mandatory), - {{broadcastGMembers, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131079, V1} -> + {broadcastGMembers, decode_integer(V1, [2])}; %% 'guestCheckStatus' - <<2:2,_:1,8:5,_/binary>> -> - {Dec, Rest, RbCho} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes1, mandatory, [{tag,128,8,'IMPLICIT',32}]), - {{guestCheckStatus, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131080, V1} -> + {guestCheckStatus, 'CSTA-device-identifiers':'dec_DeviceID'(V1, [])}; Else -> - case OptOrMand of - mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}}); - _ ->exit({error,{asn1,{no_optional_tag,Else}}}) - end - end. + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. +'dec_KmeGetSystemDataReq_deviceData'(Tlv, TagIn) -> + %%------------------------------------------------- + %% decode tag and length + %%------------------------------------------------- +Tlv1 = match_tags(Tlv, TagIn), + +%%------------------------------------------------- +%% attribute device(1) External CSTA-device-identifiers:DeviceID +%%------------------------------------------------- +[V1|Tlv2] = Tlv1, +Term1 = 'CSTA-device-identifiers':'dec_DeviceID'(V1, [131072,16]), + +%%------------------------------------------------- +%% attribute sysData(2) with type CHOICE +%%------------------------------------------------- +[V2|Tlv3] = Tlv2, +Term2 = 'dec_KmeGetSystemDataReq_deviceData_sysData'(V2, [131073]), + +case Tlv3 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed +end, + {'KmeGetSystemDataReq_deviceData', Term1, Term2}. + +'dec_KmeGetSystemDataReq_deviceData_sysData'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of + +%% 'standardInfo' + {3, V1} -> + {standardInfo, decode_named_bit_string(V1, [{wakeUp,0},{remoteStatationLock,1},{callLogLock,2},{absentMessage,3},{forwardDnd,4},{cos,5},{phoneProperty,6},{assocIncomGroup,7},{messageWating,8},{assocExtGroup,9}], [])}; + + +%% 'extName' + {131073, V1} -> + {extName, decode_null(V1, [5])}; + + +%% 'fcoKey' + {131074, V1} -> + {fcoKey, decode_null(V1, [5])}; + + +%% 'sxdpMaster' + {131075, V1} -> + {sxdpMaster, decode_null(V1, [5])}; + + Else -> + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. +'dec_KmeGetSystemDataReq_trkExtGMember'(Tlv, TagIn) -> + %%------------------------------------------------- + %% decode tag and length + %%------------------------------------------------- +Tlv1 = match_tags(Tlv, TagIn), + +%%------------------------------------------------- +%% attribute groupNo(1) with type INTEGER +%%------------------------------------------------- +[V1|Tlv2] = Tlv1, +Term1 = decode_integer(V1, [2]), + +%%------------------------------------------------- +%% attribute groupType(2) with type ENUMERATED +%%------------------------------------------------- +[V2|Tlv3] = Tlv2, +Term2 = case decode_integer(V2, [10]) of +0 -> trunkGMembers; +1 -> extGMembers; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end, + +case Tlv3 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed +end, + {'KmeGetSystemDataReq_trkExtGMember', Term1, Term2}. + +'dec_KmeGetSystemDataReq_incomGMember'(Tlv, TagIn) -> + %%------------------------------------------------- + %% decode tag and length + %%------------------------------------------------- +Tlv1 = match_tags(Tlv, TagIn), + +%%------------------------------------------------- +%% attribute groupNo(1) External CSTA-device-identifiers:DeviceID +%%------------------------------------------------- +[V1|Tlv2] = Tlv1, +Term1 = 'CSTA-device-identifiers':'dec_DeviceID'(V1, [16]), + +case Tlv2 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv2}}}) % extra fields not allowed +end, + {'KmeGetSystemDataReq_incomGMember', Term1}. + %%================================ %% KmeGetSystemDataRsp %%================================ +'enc_KmeGetSystemDataRsp'(Val) -> + 'enc_KmeGetSystemDataRsp'(Val, [<<48>>]). + 'enc_KmeGetSystemDataRsp'(Val, TagIn) -> +{_,Cindex1, Cindex2, Cindex3, Cindex4, Cindex5, Cindex6, Cindex7, Cindex8, Cindex9, Cindex10, Cindex11, Cindex12, Cindex13, Cindex14, Cindex15, Cindex16, Cindex17, Cindex18, Cindex19, Cindex20, Cindex21, Cindex22, Cindex23, Cindex24, Cindex25, Cindex26, Cindex27, Cindex28, Cindex29, Cindex30, Cindex31, Cindex32, Cindex33, Cindex34, Cindex35, Cindex36, Cindex37, Cindex38, Cindex39, Cindex40, Cindex41, Cindex42, Cindex43, Cindex44, Cindex45, Cindex46} = Val, %%------------------------------------------------- -%% attribute number 1 with type GeneralizedTime OPTIONAL +%% attribute timeStamp(1) with type GeneralizedTime OPTIONAL %%------------------------------------------------- - {EncBytes1,EncLen1} = case ?RT_BER:cindex(2,Val,timeStamp) of + {EncBytes1,EncLen1} = case Cindex1 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_generalized_time([], ?RT_BER:cindex(2,Val,timeStamp), [{tag,128,0,'EXPLICIT',32}]) + encode_restricted_string(Cindex1, [<<24>>,<<160>>]) end, %%------------------------------------------------- -%% attribute number 2 External KME-specific-types:KmeFeatureList OPTIONAL +%% attribute featureList(2) External KME-specific-types:KmeFeatureList OPTIONAL %%------------------------------------------------- - {EncBytes2,EncLen2} = case ?RT_BER:cindex(3,Val,featureList) of + {EncBytes2,EncLen2} = case Cindex2 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_KmeFeatureList'(?RT_BER:cindex(3,Val,featureList), [{tag,128,1,'EXPLICIT',32}]) + 'enc_KmeFeatureList'(Cindex2, [<<48>>,<<161>>]) end, %%------------------------------------------------- -%% attribute number 3 External KME-specific-types:KmeSpeedDial OPTIONAL +%% attribute speedDial(3) External KME-specific-types:KmeSpeedDial OPTIONAL %%------------------------------------------------- - {EncBytes3,EncLen3} = case ?RT_BER:cindex(4,Val,speedDial) of + {EncBytes3,EncLen3} = case Cindex3 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_KmeSpeedDial'(?RT_BER:cindex(4,Val,speedDial), [{tag,128,2,'EXPLICIT',32}]) + 'enc_KmeSpeedDial'(Cindex3, [<<48>>,<<162>>]) end, %%------------------------------------------------- -%% attribute number 4 External KME-specific-types:KmeExtTrkGroupList OPTIONAL +%% attribute trunkGroup(4) External KME-specific-types:KmeExtTrkGroupList OPTIONAL %%------------------------------------------------- - {EncBytes4,EncLen4} = case ?RT_BER:cindex(5,Val,trunkGroup) of + {EncBytes4,EncLen4} = case Cindex4 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_KmeExtTrkGroupList'(?RT_BER:cindex(5,Val,trunkGroup), [{tag,128,3,'EXPLICIT',32}]) + 'enc_KmeExtTrkGroupList'(Cindex4, [<<48>>,<<163>>]) end, %%------------------------------------------------- -%% attribute number 5 External KME-specific-types:KmeExtTrkGroupList OPTIONAL +%% attribute extGroup(5) External KME-specific-types:KmeExtTrkGroupList OPTIONAL %%------------------------------------------------- - {EncBytes5,EncLen5} = case ?RT_BER:cindex(6,Val,extGroup) of + {EncBytes5,EncLen5} = case Cindex5 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_KmeExtTrkGroupList'(?RT_BER:cindex(6,Val,extGroup), [{tag,128,4,'EXPLICIT',32}]) + 'enc_KmeExtTrkGroupList'(Cindex5, [<<48>>,<<164>>]) end, %%------------------------------------------------- -%% attribute number 6 External KME-specific-types:KmePckPagGroupList OPTIONAL +%% attribute pickGroup(6) External KME-specific-types:KmePckPagGroupList OPTIONAL %%------------------------------------------------- - {EncBytes6,EncLen6} = case ?RT_BER:cindex(7,Val,pickGroup) of + {EncBytes6,EncLen6} = case Cindex6 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_KmePckPagGroupList'(?RT_BER:cindex(7,Val,pickGroup), [{tag,128,5,'EXPLICIT',32}]) + 'enc_KmePckPagGroupList'(Cindex6, [<<48>>,<<165>>]) end, %%------------------------------------------------- -%% attribute number 7 External KME-specific-types:KmePckPagGroupList OPTIONAL +%% attribute pagingGroup(7) External KME-specific-types:KmePckPagGroupList OPTIONAL %%------------------------------------------------- - {EncBytes7,EncLen7} = case ?RT_BER:cindex(8,Val,pagingGroup) of + {EncBytes7,EncLen7} = case Cindex7 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_KmePckPagGroupList'(?RT_BER:cindex(8,Val,pagingGroup), [{tag,128,6,'EXPLICIT',32}]) + 'enc_KmePckPagGroupList'(Cindex7, [<<48>>,<<166>>]) end, %%------------------------------------------------- -%% attribute number 8 External KME-specific-types:KmeIncomingGroupList OPTIONAL +%% attribute incomingGroup(8) External KME-specific-types:KmeIncomingGroupList OPTIONAL %%------------------------------------------------- - {EncBytes8,EncLen8} = case ?RT_BER:cindex(9,Val,incomingGroup) of + {EncBytes8,EncLen8} = case Cindex8 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_KmeIncomingGroupList'(?RT_BER:cindex(9,Val,incomingGroup), [{tag,128,7,'EXPLICIT',32}]) + 'enc_KmeIncomingGroupList'(Cindex8, [<<48>>,<<167>>]) end, %%------------------------------------------------- -%% attribute number 9 External KME-specific-types:KmeDayNightMode OPTIONAL +%% attribute dayNightMode(9) External KME-specific-types:KmeDayNightMode OPTIONAL %%------------------------------------------------- - {EncBytes9,EncLen9} = case ?RT_BER:cindex(10,Val,dayNightMode) of + {EncBytes9,EncLen9} = case Cindex9 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_KmeDayNightMode'(?RT_BER:cindex(10,Val,dayNightMode), [{tag,128,8,'EXPLICIT',32}]) + 'enc_KmeDayNightMode'(Cindex9, [<<48>>,<<168>>]) end, %%------------------------------------------------- -%% attribute number 10 External KME-specific-types:KmeWakeUpInfo OPTIONAL +%% attribute wakeUp(10) External KME-specific-types:KmeWakeUpInfo OPTIONAL %%------------------------------------------------- - {EncBytes10,EncLen10} = case ?RT_BER:cindex(11,Val,wakeUp) of + {EncBytes10,EncLen10} = case Cindex10 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_KmeWakeUpInfo'(?RT_BER:cindex(11,Val,wakeUp), [{tag,128,9,'EXPLICIT',32}]) + 'enc_KmeWakeUpInfo'(Cindex10, [<<48>>,<<169>>]) end, %%------------------------------------------------- -%% attribute number 11 with type ENUMERATED OPTIONAL +%% attribute remoteLock(11) with type ENUMERATED OPTIONAL %%------------------------------------------------- - {EncBytes11,EncLen11} = case ?RT_BER:cindex(12,Val,remoteLock) of + {EncBytes11,EncLen11} = case Cindex11 of asn1_NOVALUE -> {<<>>,0}; _ -> - case (case ?RT_BER:cindex(12,Val,remoteLock) of {_,Enumval2}->Enumval2;_->?RT_BER:cindex(12,Val,remoteLock) end) of -lock -> ?RT_BER:encode_enumerated(0,[{tag,128,10,'EXPLICIT',32}]); -unlock -> ?RT_BER:encode_enumerated(1,[{tag,128,10,'EXPLICIT',32}]); -Enumval3 -> exit({error,{asn1, {enumerated_not_in_range,Enumval3}}}) + case Cindex11 of +lock -> encode_tags([<<10>>,<<170>>], [0], 1); +unlock -> encode_tags([<<10>>,<<170>>], [1], 1); +Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) end end, %%------------------------------------------------- -%% attribute number 12 External KME-specific-types:KmeAbsentMessage OPTIONAL +%% attribute callLogLock(12) External KME-specific-types:KmeAbsentMessage OPTIONAL %%------------------------------------------------- - {EncBytes12,EncLen12} = case ?RT_BER:cindex(13,Val,callLogLock) of + {EncBytes12,EncLen12} = case Cindex12 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_KmeAbsentMessage'(?RT_BER:cindex(13,Val,callLogLock), [{tag,128,12,'EXPLICIT',32}]) + 'enc_KmeAbsentMessage'(Cindex12, [<<172>>]) end, %%------------------------------------------------- -%% attribute number 13 with type ENUMERATED OPTIONAL +%% attribute forwardDnd(13) with type ENUMERATED OPTIONAL %%------------------------------------------------- - {EncBytes13,EncLen13} = case ?RT_BER:cindex(14,Val,forwardDnd) of + {EncBytes13,EncLen13} = case Cindex13 of asn1_NOVALUE -> {<<>>,0}; _ -> - case (case ?RT_BER:cindex(14,Val,forwardDnd) of {_,Enumval4}->Enumval4;_->?RT_BER:cindex(14,Val,forwardDnd) end) of -lock -> ?RT_BER:encode_enumerated(0,[{tag,128,11,'EXPLICIT',32}]); -unlock -> ?RT_BER:encode_enumerated(1,[{tag,128,11,'EXPLICIT',32}]); -Enumval5 -> exit({error,{asn1, {enumerated_not_in_range,Enumval5}}}) + case Cindex13 of +lock -> encode_tags([<<10>>,<<171>>], [0], 1); +unlock -> encode_tags([<<10>>,<<171>>], [1], 1); +Enumval3 -> exit({error,{asn1, {enumerated_not_in_range,Enumval3}}}) end end, %%------------------------------------------------- -%% attribute number 14 External CSTA-device-feature-types:ForwardList OPTIONAL +%% attribute absentMessage(14) External CSTA-device-feature-types:ForwardList OPTIONAL %%------------------------------------------------- - {EncBytes14,EncLen14} = case ?RT_BER:cindex(15,Val,absentMessage) of + {EncBytes14,EncLen14} = case Cindex14 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'CSTA-device-feature-types':'enc_ForwardList'(?RT_BER:cindex(15,Val,absentMessage), [{tag,128,13,'EXPLICIT',32}]) + 'CSTA-device-feature-types':'enc_ForwardList'(Cindex14, [<<48>>,<<173>>]) end, %%------------------------------------------------- -%% attribute number 15 External KME-specific-types:KmeTrkMembers OPTIONAL +%% attribute trkGMembers(15) External KME-specific-types:KmeTrkMembers OPTIONAL %%------------------------------------------------- - {EncBytes15,EncLen15} = case ?RT_BER:cindex(16,Val,trkGMembers) of + {EncBytes15,EncLen15} = case Cindex15 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_KmeTrkMembers'(?RT_BER:cindex(16,Val,trkGMembers), [{tag,128,14,'EXPLICIT',32}]) + 'enc_KmeTrkMembers'(Cindex15, [<<48>>,<<174>>]) end, %%------------------------------------------------- -%% attribute number 16 External KME-specific-types:KmeExtMembers OPTIONAL +%% attribute extGMembers(16) External KME-specific-types:KmeExtMembers OPTIONAL %%------------------------------------------------- - {EncBytes16,EncLen16} = case ?RT_BER:cindex(17,Val,extGMembers) of + {EncBytes16,EncLen16} = case Cindex16 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_KmeExtMembers'(?RT_BER:cindex(17,Val,extGMembers), [{tag,128,15,'EXPLICIT',32}]) + 'enc_KmeExtMembers'(Cindex16, [<<48>>,<<175>>]) end, %%------------------------------------------------- -%% attribute number 17 External KME-specific-types:KmeIcmGrpMembers OPTIONAL +%% attribute incomGMembers(17) External KME-specific-types:KmeIcmGrpMembers OPTIONAL %%------------------------------------------------- - {EncBytes17,EncLen17} = case ?RT_BER:cindex(18,Val,incomGMembers) of + {EncBytes17,EncLen17} = case Cindex17 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_KmeIcmGrpMembers'(?RT_BER:cindex(18,Val,incomGMembers), [{tag,128,16,'EXPLICIT',32}]) + 'enc_KmeIcmGrpMembers'(Cindex17, [<<48>>,<<176>>]) end, %%------------------------------------------------- -%% attribute number 18 External KME-specific-types:KmeDoorPhone OPTIONAL +%% attribute doorPhone(18) External KME-specific-types:KmeDoorPhone OPTIONAL %%------------------------------------------------- - {EncBytes18,EncLen18} = case ?RT_BER:cindex(19,Val,doorPhone) of + {EncBytes18,EncLen18} = case Cindex18 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_KmeDoorPhone'(?RT_BER:cindex(19,Val,doorPhone), [{tag,128,17,'EXPLICIT',32}]) + 'enc_KmeDoorPhone'(Cindex18, [<<48>>,<<177>>]) end, %%------------------------------------------------- -%% attribute number 19 External KME-specific-types:KmeVmGroupList OPTIONAL +%% attribute vmGroup(19) External KME-specific-types:KmeVmGroupList OPTIONAL %%------------------------------------------------- - {EncBytes19,EncLen19} = case ?RT_BER:cindex(20,Val,vmGroup) of + {EncBytes19,EncLen19} = case Cindex19 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_KmeVmGroupList'(?RT_BER:cindex(20,Val,vmGroup), [{tag,128,18,'EXPLICIT',32}]) + 'enc_KmeVmGroupList'(Cindex19, [<<48>>,<<178>>]) end, %%------------------------------------------------- -%% attribute number 20 with type IA5String OPTIONAL +%% attribute manufacturerName(20) with type IA5String OPTIONAL %%------------------------------------------------- - {EncBytes20,EncLen20} = case ?RT_BER:cindex(21,Val,manufacturerName) of + {EncBytes20,EncLen20} = case Cindex20 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_restricted_string([], ?RT_BER:cindex(21,Val,manufacturerName), 22, [{tag,128,19,'EXPLICIT',32}]) + encode_restricted_string(Cindex20, [<<22>>,<<179>>]) end, %%------------------------------------------------- -%% attribute number 21 with type IA5String OPTIONAL +%% attribute subdomainName(21) with type IA5String OPTIONAL %%------------------------------------------------- - {EncBytes21,EncLen21} = case ?RT_BER:cindex(22,Val,subdomainName) of + {EncBytes21,EncLen21} = case Cindex21 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_restricted_string([], ?RT_BER:cindex(22,Val,subdomainName), 22, [{tag,128,20,'EXPLICIT',32}]) + encode_restricted_string(Cindex21, [<<22>>,<<180>>]) end, %%------------------------------------------------- -%% attribute number 22 with type IA5String OPTIONAL +%% attribute softwareVersion(22) with type IA5String OPTIONAL %%------------------------------------------------- - {EncBytes22,EncLen22} = case ?RT_BER:cindex(23,Val,softwareVersion) of + {EncBytes22,EncLen22} = case Cindex22 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_restricted_string([], ?RT_BER:cindex(23,Val,softwareVersion), 22, [{tag,128,21,'EXPLICIT',32}]) + encode_restricted_string(Cindex22, [<<22>>,<<181>>]) end, %%------------------------------------------------- -%% attribute number 23 with type IA5String OPTIONAL +%% attribute ctiVersion(23) with type IA5String OPTIONAL %%------------------------------------------------- - {EncBytes23,EncLen23} = case ?RT_BER:cindex(24,Val,ctiVersion) of + {EncBytes23,EncLen23} = case Cindex23 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_restricted_string([], ?RT_BER:cindex(24,Val,ctiVersion), 22, [{tag,128,22,'EXPLICIT',32}]) + encode_restricted_string(Cindex23, [<<22>>,<<182>>]) end, %%------------------------------------------------- -%% attribute number 24 with type IA5String OPTIONAL +%% attribute regionCode(24) with type IA5String OPTIONAL %%------------------------------------------------- - {EncBytes24,EncLen24} = case ?RT_BER:cindex(25,Val,regionCode) of + {EncBytes24,EncLen24} = case Cindex24 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_restricted_string([], ?RT_BER:cindex(25,Val,regionCode), 22, [{tag,128,23,'EXPLICIT',32}]) + encode_restricted_string(Cindex24, [<<22>>,<<183>>]) end, %%------------------------------------------------- -%% attribute number 25 with type GeneralizedTime OPTIONAL +%% attribute systemTime(25) with type GeneralizedTime OPTIONAL %%------------------------------------------------- - {EncBytes25,EncLen25} = case ?RT_BER:cindex(26,Val,systemTime) of + {EncBytes25,EncLen25} = case Cindex25 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_generalized_time([], ?RT_BER:cindex(26,Val,systemTime), [{tag,128,24,'EXPLICIT',32}]) + encode_restricted_string(Cindex25, [<<24>>,<<184>>]) end, %%------------------------------------------------- -%% attribute number 26 External KME-specific-types:NumberOfMsgPort OPTIONAL +%% attribute numberOfMsgPort(26) External KME-specific-types:NumberOfMsgPort OPTIONAL %%------------------------------------------------- - {EncBytes26,EncLen26} = case ?RT_BER:cindex(27,Val,numberOfMsgPort) of + {EncBytes26,EncLen26} = case Cindex26 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_NumberOfMsgPort'(?RT_BER:cindex(27,Val,numberOfMsgPort), [{tag,128,25,'EXPLICIT',32}]) + 'enc_NumberOfMsgPort'(Cindex26, [<<48>>,<<185>>]) end, %%------------------------------------------------- -%% attribute number 27 External KME-specific-types:KmePsGroupList OPTIONAL +%% attribute psGroup(27) External KME-specific-types:KmePsGroupList OPTIONAL %%------------------------------------------------- - {EncBytes27,EncLen27} = case ?RT_BER:cindex(28,Val,psGroup) of + {EncBytes27,EncLen27} = case Cindex27 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_KmePsGroupList'(?RT_BER:cindex(28,Val,psGroup), [{tag,128,26,'EXPLICIT',32}]) + 'enc_KmePsGroupList'(Cindex27, [<<48>>,<<186>>]) end, %%------------------------------------------------- -%% attribute number 28 External CSTA-device-identifiers:DeviceID OPTIONAL +%% attribute youAre(28) External CSTA-device-identifiers:DeviceID OPTIONAL %%------------------------------------------------- - {EncBytes28,EncLen28} = case ?RT_BER:cindex(29,Val,youAre) of + {EncBytes28,EncLen28} = case Cindex28 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'CSTA-device-identifiers':'enc_DeviceID'(?RT_BER:cindex(29,Val,youAre), [{tag,128,27,'EXPLICIT',32}]) + 'CSTA-device-identifiers':'enc_DeviceID'(Cindex28, [<<48>>,<<187>>]) end, %%------------------------------------------------- -%% attribute number 29 External KME-specific-types:KmeSvmList OPTIONAL +%% attribute svm(29) External KME-specific-types:KmeSvmList OPTIONAL %%------------------------------------------------- - {EncBytes29,EncLen29} = case ?RT_BER:cindex(30,Val,svm) of + {EncBytes29,EncLen29} = case Cindex29 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_KmeSvmList'(?RT_BER:cindex(30,Val,svm), [{tag,128,28,'EXPLICIT',32}]) + 'enc_KmeSvmList'(Cindex29, [<<48>>,<<188>>]) end, %%------------------------------------------------- -%% attribute number 30 External KME-specific-types:KmePdnGMembers OPTIONAL +%% attribute pdn(30) External KME-specific-types:KmePdnGMembers OPTIONAL %%------------------------------------------------- - {EncBytes30,EncLen30} = case ?RT_BER:cindex(31,Val,pdn) of + {EncBytes30,EncLen30} = case Cindex30 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_KmePdnGMembers'(?RT_BER:cindex(31,Val,pdn), [{tag,128,29,'EXPLICIT',32}]) + 'enc_KmePdnGMembers'(Cindex30, [<<48>>,<<189>>]) end, %%------------------------------------------------- -%% attribute number 31 with type INTEGER OPTIONAL +%% attribute cos(31) with type INTEGER OPTIONAL %%------------------------------------------------- - {EncBytes31,EncLen31} = case ?RT_BER:cindex(32,Val,cos) of + {EncBytes31,EncLen31} = case Cindex31 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_integer([], ?RT_BER:cindex(32,Val,cos), [{tag,128,34,'EXPLICIT',32}]) + encode_integer(Cindex31, [<<2>>,<<191,34>>]) end, %%------------------------------------------------- -%% attribute number 32 External KME-specific-types:KmePhoneProperty OPTIONAL +%% attribute phoneProperty(32) External KME-specific-types:KmePhoneProperty OPTIONAL %%------------------------------------------------- - {EncBytes32,EncLen32} = case ?RT_BER:cindex(33,Val,phoneProperty) of + {EncBytes32,EncLen32} = case Cindex32 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_KmePhoneProperty'(?RT_BER:cindex(33,Val,phoneProperty), [{tag,128,35,'EXPLICIT',32}]) + 'enc_KmePhoneProperty'(Cindex32, [<<48>>,<<191,35>>]) end, %%------------------------------------------------- -%% attribute number 33 with type BIT STRING OPTIONAL +%% attribute assocIncomGroup(33) with type BIT STRING OPTIONAL %%------------------------------------------------- - {EncBytes33,EncLen33} = case ?RT_BER:cindex(34,Val,assocIncomGroup) of + {EncBytes33,EncLen33} = case Cindex33 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_bit_string([], ?RT_BER:cindex(34,Val,assocIncomGroup), [{one,0},{two,1},{three,2},{four,3},{five,4},{six,5},{seven,6},{eight,7},{nine,8},{ten,9},{eleven,10},{twelve,11},{thirteen,12},{fourteen,13},{fifteen,14},{sixteen,15},{seventeen,16},{eighteen,17},{nineteen,18},{twenty,19},{twentyOne,20},{twentyTwo,21},{twentyThree,22},{twentyFour,23},{twentyFive,24},{twentySix,25},{twentySeven,26},{twentyEight,27},{twentyNine,28},{thirty,29},{thirtyOne,30},{thirtyTwo,31},{thirtyThree,32},{thirtyFour,33},{thirtyFive,34},{thirtySix,35},{thirtySeven,36},{thirtyEight,37},{thirtyNine,38},{fourty,39},{fourtyOne,40},{fourtyTwo,41},{fourtyThree,42},{fourtyFour,43},{fourtyFive,44},{fourtySix,45},{fourtySeven,46},{fourtyEight,47},{fourtyNine,48},{fifty,49},{fiftyOne,50},{fiftyTwo,51},{fiftyThree,52},{fiftyFour,53},{fiftyFive,54},{fiftySix,55},{fiftySeven,56},{fiftyEight,57},{fiftyNine,58},{sixty,59},{sixtyOne,60},{sixtyTwo,61},{sixtyThree,62},{sixtyFour,63},{sixtyFive,64},{sixtySix,65},{sixtySeven,66},{sixtyEight,67},{sixtyNine,68},{seventy,69},{seventyOne,70},{seventyTwo,71},{seventyThree,72},{seventyFour,73},{seventyFive,74},{seventySix,75},{seventySeven,76},{seventyEight,77},{seventyNine,78},{eighty,79},{eightyOne,80},{eightyTwo,81},{eightyThree,82},{eightyFour,83},{eightyFive,84},{eightySix,85},{eightySeven,86},{eightyEight,87},{eightyNine,88},{ninety,89},{ninetyOne,90},{ninetyTwo,91},{ninetyThree,92},{ninetyFour,93},{ninetyFive,94},{ninetySix,95},{ninetySeven,96},{ninetyEight,97},{ninetyNine,98},{oneHundred,99},{oneHundredOne,100},{oneHundredTwo,101},{oneHundredThree,102},{oneHundredFour,103},{oneHundredFive,104},{oneHundredSix,105},{oneHundredSeven,106},{oneHundredEitht,107},{oneHundredNine,108},{oneHundredTen,109},{oneHundredEleven,110},{oneHundredTwelve,111},{oneHundredThirteen,112},{oneHundredFourteen,113},{oneHundredFifteen,114},{oneHundredSixteen,115},{oneHundredSeventeen,116},{oneHundredEithteen,117},{oneHundredNineteen,118},{oneHundredTwenty,119},{oneHundredTwentyOne,120},{oneHundredTwentyTwo,121},{oneHundredTwentyThree,122},{oneHundredTwentyFour,123},{oneHundredTwentyFive,124},{oneHundredTwentySix,125},{oneHundredTwentySeven,126},{oneHundredTwentyEight,127}], [{tag,128,36,'EXPLICIT',32}]) + encode_named_bit_string(Cindex33, [{one,0},{two,1},{three,2},{four,3},{five,4},{six,5},{seven,6},{eight,7},{nine,8},{ten,9},{eleven,10},{twelve,11},{thirteen,12},{fourteen,13},{fifteen,14},{sixteen,15},{seventeen,16},{eighteen,17},{nineteen,18},{twenty,19},{twentyOne,20},{twentyTwo,21},{twentyThree,22},{twentyFour,23},{twentyFive,24},{twentySix,25},{twentySeven,26},{twentyEight,27},{twentyNine,28},{thirty,29},{thirtyOne,30},{thirtyTwo,31},{thirtyThree,32},{thirtyFour,33},{thirtyFive,34},{thirtySix,35},{thirtySeven,36},{thirtyEight,37},{thirtyNine,38},{fourty,39},{fourtyOne,40},{fourtyTwo,41},{fourtyThree,42},{fourtyFour,43},{fourtyFive,44},{fourtySix,45},{fourtySeven,46},{fourtyEight,47},{fourtyNine,48},{fifty,49},{fiftyOne,50},{fiftyTwo,51},{fiftyThree,52},{fiftyFour,53},{fiftyFive,54},{fiftySix,55},{fiftySeven,56},{fiftyEight,57},{fiftyNine,58},{sixty,59},{sixtyOne,60},{sixtyTwo,61},{sixtyThree,62},{sixtyFour,63},{sixtyFive,64},{sixtySix,65},{sixtySeven,66},{sixtyEight,67},{sixtyNine,68},{seventy,69},{seventyOne,70},{seventyTwo,71},{seventyThree,72},{seventyFour,73},{seventyFive,74},{seventySix,75},{seventySeven,76},{seventyEight,77},{seventyNine,78},{eighty,79},{eightyOne,80},{eightyTwo,81},{eightyThree,82},{eightyFour,83},{eightyFive,84},{eightySix,85},{eightySeven,86},{eightyEight,87},{eightyNine,88},{ninety,89},{ninetyOne,90},{ninetyTwo,91},{ninetyThree,92},{ninetyFour,93},{ninetyFive,94},{ninetySix,95},{ninetySeven,96},{ninetyEight,97},{ninetyNine,98},{oneHundred,99},{oneHundredOne,100},{oneHundredTwo,101},{oneHundredThree,102},{oneHundredFour,103},{oneHundredFive,104},{oneHundredSix,105},{oneHundredSeven,106},{oneHundredEitht,107},{oneHundredNine,108},{oneHundredTen,109},{oneHundredEleven,110},{oneHundredTwelve,111},{oneHundredThirteen,112},{oneHundredFourteen,113},{oneHundredFifteen,114},{oneHundredSixteen,115},{oneHundredSeventeen,116},{oneHundredEithteen,117},{oneHundredNineteen,118},{oneHundredTwenty,119},{oneHundredTwentyOne,120},{oneHundredTwentyTwo,121},{oneHundredTwentyThree,122},{oneHundredTwentyFour,123},{oneHundredTwentyFive,124},{oneHundredTwentySix,125},{oneHundredTwentySeven,126},{oneHundredTwentyEight,127}], [<<3>>,<<191,36>>]) end, %%------------------------------------------------- -%% attribute number 34 with type SEQUENCE OF OPTIONAL +%% attribute messageWaiting(34) with type SEQUENCE OF OPTIONAL %%------------------------------------------------- - {EncBytes34,EncLen34} = case ?RT_BER:cindex(35,Val,messageWaiting) of + {EncBytes34,EncLen34} = case Cindex34 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_KmeGetSystemDataRsp_messageWaiting'(?RT_BER:cindex(35,Val,messageWaiting), [{tag,128,37,'EXPLICIT',32}]) + 'enc_KmeGetSystemDataRsp_messageWaiting'(Cindex34, [<<48>>,<<191,37>>]) end, %%------------------------------------------------- -%% attribute number 35 External KME-specific-types:KmeDeviceStateList OPTIONAL +%% attribute deviceList(35) External KME-specific-types:KmeDeviceStateList OPTIONAL %%------------------------------------------------- - {EncBytes35,EncLen35} = case ?RT_BER:cindex(36,Val,deviceList) of + {EncBytes35,EncLen35} = case Cindex35 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_KmeDeviceStateList'(?RT_BER:cindex(36,Val,deviceList), [{tag,128,38,'EXPLICIT',32}]) + 'enc_KmeDeviceStateList'(Cindex35, [<<48>>,<<191,38>>]) end, %%------------------------------------------------- -%% attribute number 36 with type INTEGER OPTIONAL +%% attribute assocExtGroup(36) with type INTEGER OPTIONAL %%------------------------------------------------- - {EncBytes36,EncLen36} = case ?RT_BER:cindex(37,Val,assocExtGroup) of + {EncBytes36,EncLen36} = case Cindex36 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_integer([], ?RT_BER:cindex(37,Val,assocExtGroup), [{tag,128,39,'EXPLICIT',32}]) + encode_integer(Cindex36, [<<2>>,<<191,39>>]) end, %%------------------------------------------------- -%% attribute number 37 External KME-specific-types:KmeIcmGrpMembers OPTIONAL +%% attribute vmGMembers(37) External KME-specific-types:KmeIcmGrpMembers OPTIONAL %%------------------------------------------------- - {EncBytes37,EncLen37} = case ?RT_BER:cindex(38,Val,vmGMembers) of + {EncBytes37,EncLen37} = case Cindex37 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_KmeIcmGrpMembers'(?RT_BER:cindex(38,Val,vmGMembers), [{tag,128,40,'EXPLICIT',32}]) + 'enc_KmeIcmGrpMembers'(Cindex37, [<<48>>,<<191,40>>]) end, %%------------------------------------------------- -%% attribute number 38 External KME-specific-types:KmeExtName OPTIONAL +%% attribute extName(38) External KME-specific-types:KmeExtName OPTIONAL %%------------------------------------------------- - {EncBytes38,EncLen38} = case ?RT_BER:cindex(39,Val,extName) of + {EncBytes38,EncLen38} = case Cindex38 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_KmeExtName'(?RT_BER:cindex(39,Val,extName), [{tag,128,41,'EXPLICIT',32}]) + 'enc_KmeExtName'(Cindex38, [<<191,41>>]) end, %%------------------------------------------------- -%% attribute number 39 External KME-specific-types:KmeBroadcastGroupList OPTIONAL +%% attribute broadcastGroup(39) External KME-specific-types:KmeBroadcastGroupList OPTIONAL %%------------------------------------------------- - {EncBytes39,EncLen39} = case ?RT_BER:cindex(40,Val,broadcastGroup) of + {EncBytes39,EncLen39} = case Cindex39 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_KmeBroadcastGroupList'(?RT_BER:cindex(40,Val,broadcastGroup), [{tag,128,42,'EXPLICIT',32}]) + 'enc_KmeBroadcastGroupList'(Cindex39, [<<48>>,<<191,42>>]) end, %%------------------------------------------------- -%% attribute number 40 External KME-specific-types:KmeBroadcastGrpMembers OPTIONAL +%% attribute broadcastGMembers(40) External KME-specific-types:KmeBroadcastGrpMembers OPTIONAL %%------------------------------------------------- - {EncBytes40,EncLen40} = case ?RT_BER:cindex(41,Val,broadcastGMembers) of + {EncBytes40,EncLen40} = case Cindex40 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_KmeBroadcastGrpMembers'(?RT_BER:cindex(41,Val,broadcastGMembers), [{tag,128,43,'EXPLICIT',32}]) + 'enc_KmeBroadcastGrpMembers'(Cindex40, [<<48>>,<<191,43>>]) end, %%------------------------------------------------- -%% attribute number 41 External KME-specific-types:KmeFcoKeyList OPTIONAL +%% attribute fcoKeyList(41) External KME-specific-types:KmeFcoKeyList OPTIONAL %%------------------------------------------------- - {EncBytes41,EncLen41} = case ?RT_BER:cindex(42,Val,fcoKeyList) of + {EncBytes41,EncLen41} = case Cindex41 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_KmeFcoKeyList'(?RT_BER:cindex(42,Val,fcoKeyList), [{tag,128,44,'EXPLICIT',32}]) + 'enc_KmeFcoKeyList'(Cindex41, [<<48>>,<<191,44>>]) end, %%------------------------------------------------- -%% attribute number 42 External CSTA-device-identifiers:DeviceID OPTIONAL +%% attribute sxdpMaster(42) External CSTA-device-identifiers:DeviceID OPTIONAL %%------------------------------------------------- - {EncBytes42,EncLen42} = case ?RT_BER:cindex(43,Val,sxdpMaster) of + {EncBytes42,EncLen42} = case Cindex42 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'CSTA-device-identifiers':'enc_DeviceID'(?RT_BER:cindex(43,Val,sxdpMaster), [{tag,128,45,'EXPLICIT',32}]) + 'CSTA-device-identifiers':'enc_DeviceID'(Cindex42, [<<48>>,<<191,45>>]) end, %%------------------------------------------------- -%% attribute number 43 with type INTEGER OPTIONAL +%% attribute pbxType(43) with type INTEGER OPTIONAL %%------------------------------------------------- - {EncBytes43,EncLen43} = case ?RT_BER:cindex(44,Val,pbxType) of + {EncBytes43,EncLen43} = case Cindex43 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_integer([], ?RT_BER:cindex(44,Val,pbxType), [{tag,128,46,'EXPLICIT',32}]) + encode_integer(Cindex43, [<<2>>,<<191,46>>]) end, %%------------------------------------------------- -%% attribute number 44 External KME-specific-types:KmeExternalSensorList OPTIONAL +%% attribute externalSensor(44) External KME-specific-types:KmeExternalSensorList OPTIONAL %%------------------------------------------------- - {EncBytes44,EncLen44} = case ?RT_BER:cindex(45,Val,externalSensor) of + {EncBytes44,EncLen44} = case Cindex44 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_KmeExternalSensorList'(?RT_BER:cindex(45,Val,externalSensor), [{tag,128,47,'EXPLICIT',32}]) + 'enc_KmeExternalSensorList'(Cindex44, [<<48>>,<<191,47>>]) end, %%------------------------------------------------- -%% attribute number 45 External KME-specific-types:KmeDeviceDataList OPTIONAL +%% attribute deviceDataList(45) External KME-specific-types:KmeDeviceDataList OPTIONAL %%------------------------------------------------- - {EncBytes45,EncLen45} = case ?RT_BER:cindex(46,Val,deviceDataList) of + {EncBytes45,EncLen45} = case Cindex45 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_KmeDeviceDataList'(?RT_BER:cindex(46,Val,deviceDataList), [{tag,128,48,'EXPLICIT',32}]) + 'enc_KmeDeviceDataList'(Cindex45, [<<48>>,<<191,48>>]) end, %%------------------------------------------------- -%% attribute number 46 External KME-specific-types:KmeCheckStatusList OPTIONAL +%% attribute guestCheckStatus(46) External KME-specific-types:KmeCheckStatusList OPTIONAL %%------------------------------------------------- - {EncBytes46,EncLen46} = case ?RT_BER:cindex(47,Val,guestCheckStatus) of + {EncBytes46,EncLen46} = case Cindex46 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_KmeCheckStatusList'(?RT_BER:cindex(47,Val,guestCheckStatus), [{tag,128,49,'EXPLICIT',32}]) + 'enc_KmeCheckStatusList'(Cindex46, [<<48>>,<<191,49>>]) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4, EncBytes5, EncBytes6, EncBytes7, EncBytes8, EncBytes9, EncBytes10, EncBytes11, EncBytes12, EncBytes13, EncBytes14, EncBytes15, EncBytes16, EncBytes17, EncBytes18, EncBytes19, EncBytes20, EncBytes21, EncBytes22, EncBytes23, EncBytes24, EncBytes25, EncBytes26, EncBytes27, EncBytes28, EncBytes29, EncBytes30, EncBytes31, EncBytes32, EncBytes33, EncBytes34, EncBytes35, EncBytes36, EncBytes37, EncBytes38, EncBytes39, EncBytes40, EncBytes41, EncBytes42, EncBytes43, EncBytes44, EncBytes45, EncBytes46], - LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5 + EncLen6 + EncLen7 + EncLen8 + EncLen9 + EncLen10 + EncLen11 + EncLen12 + EncLen13 + EncLen14 + EncLen15 + EncLen16 + EncLen17 + EncLen18 + EncLen19 + EncLen20 + EncLen21 + EncLen22 + EncLen23 + EncLen24 + EncLen25 + EncLen26 + EncLen27 + EncLen28 + EncLen29 + EncLen30 + EncLen31 + EncLen32 + EncLen33 + EncLen34 + EncLen35 + EncLen36 + EncLen37 + EncLen38 + EncLen39 + EncLen40 + EncLen41 + EncLen42 + EncLen43 + EncLen44 + EncLen45 + EncLen46, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5 + EncLen6 + EncLen7 + EncLen8 + EncLen9 + EncLen10 + EncLen11 + EncLen12 + EncLen13 + EncLen14 + EncLen15 + EncLen16 + EncLen17 + EncLen18 + EncLen19 + EncLen20 + EncLen21 + EncLen22 + EncLen23 + EncLen24 + EncLen25 + EncLen26 + EncLen27 + EncLen28 + EncLen29 + EncLen30 + EncLen31 + EncLen32 + EncLen33 + EncLen34 + EncLen35 + EncLen36 + EncLen37 + EncLen38 + EncLen39 + EncLen40 + EncLen41 + EncLen42 + EncLen43 + EncLen44 + EncLen45 + EncLen46, +encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% KmeGetSystemDataRsp_messageWaiting %%================================ - -'enc_KmeGetSystemDataRsp_messageWaiting'({'KmeGetSystemDataRsp_messageWaiting',Val}, TagIn) -> - 'enc_KmeGetSystemDataRsp_messageWaiting'(Val, TagIn); - 'enc_KmeGetSystemDataRsp_messageWaiting'(Val, TagIn) -> {EncBytes,EncLen} = 'enc_KmeGetSystemDataRsp_messageWaiting_components'(Val,[],0), - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], EncBytes, EncLen). + encode_tags(TagIn, EncBytes, EncLen). 'enc_KmeGetSystemDataRsp_messageWaiting_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_KmeGetSystemDataRsp_messageWaiting_components'([H|T],AccBytes, AccLen) -> - {EncBytes,EncLen} = 'CSTA-device-identifiers':'enc_DeviceID'(H, []), + {EncBytes,EncLen} = 'CSTA-device-identifiers':'enc_DeviceID'(H, [<<48>>]), 'enc_KmeGetSystemDataRsp_messageWaiting_components'(T,[EncBytes|AccBytes], AccLen + EncLen). -'dec_KmeGetSystemDataRsp_messageWaiting'(Bytes, OptOrMand, TagIn) -> - %%------------------------------------------------- - %% decode tag and length - %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), - ?RT_BER:decode_components(Rb1, Len, Bytes1, fun 'CSTA-device-identifiers':'dec_DeviceID'/3, [], []). - +'dec_KmeGetSystemDataRsp'(Tlv) -> + 'dec_KmeGetSystemDataRsp'(Tlv, [16]). -'dec_KmeGetSystemDataRsp'(Bytes, OptOrMand) -> - 'dec_KmeGetSystemDataRsp'(Bytes, OptOrMand, []). - -'dec_KmeGetSystemDataRsp'(Bytes, OptOrMand, TagIn) -> +'dec_KmeGetSystemDataRsp'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 with type GeneralizedTime OPTIONAL +%% attribute timeStamp(1) with type GeneralizedTime OPTIONAL %%------------------------------------------------- - {Term1,Bytes3,Rb2} = case Bytes2 of -<<2:2,_:1,0:5,_/binary>> -> -?RT_BER:decode_generalized_time(Bytes2,[],[{tag,128,0,'EXPLICIT',32}], no_length, mandatory); -_ -> -{ asn1_NOVALUE, Bytes2, 0 } +{Term1,Tlv2} = case Tlv1 of +[{131072,V1}|TempTlv2] -> + {begin +binary_to_list(decode_restricted_string(V1, [24])) +end +, TempTlv2}; + _ -> + { asn1_NOVALUE, Tlv1} end, %%------------------------------------------------- -%% attribute number 2 External KME-specific-types:KmeFeatureList OPTIONAL +%% attribute featureList(2) External KME-specific-types:KmeFeatureList OPTIONAL %%------------------------------------------------- - {Term2,Bytes4,Rb3} = case Bytes3 of -<<2:2,_:1,1:5,_/binary>> -> -'dec_KmeFeatureList'(Bytes3, opt_or_default, [{tag,128,1,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes3, 0 } +{Term2,Tlv3} = case Tlv2 of +[{131073,V2}|TempTlv3] -> + {'dec_KmeFeatureList'(V2, [16]), TempTlv3}; + _ -> + { asn1_NOVALUE, Tlv2} end, %%------------------------------------------------- -%% attribute number 3 External KME-specific-types:KmeSpeedDial OPTIONAL +%% attribute speedDial(3) External KME-specific-types:KmeSpeedDial OPTIONAL %%------------------------------------------------- - {Term3,Bytes5,Rb4} = case Bytes4 of -<<2:2,_:1,2:5,_/binary>> -> -'dec_KmeSpeedDial'(Bytes4, opt_or_default, [{tag,128,2,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes4, 0 } +{Term3,Tlv4} = case Tlv3 of +[{131074,V3}|TempTlv4] -> + {'dec_KmeSpeedDial'(V3, [16]), TempTlv4}; + _ -> + { asn1_NOVALUE, Tlv3} end, %%------------------------------------------------- -%% attribute number 4 External KME-specific-types:KmeExtTrkGroupList OPTIONAL +%% attribute trunkGroup(4) External KME-specific-types:KmeExtTrkGroupList OPTIONAL %%------------------------------------------------- - {Term4,Bytes6,Rb5} = case Bytes5 of -<<2:2,_:1,3:5,_/binary>> -> -'dec_KmeExtTrkGroupList'(Bytes5, opt_or_default, [{tag,128,3,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes5, 0 } +{Term4,Tlv5} = case Tlv4 of +[{131075,V4}|TempTlv5] -> + {'dec_KmeExtTrkGroupList'(V4, [16]), TempTlv5}; + _ -> + { asn1_NOVALUE, Tlv4} end, %%------------------------------------------------- -%% attribute number 5 External KME-specific-types:KmeExtTrkGroupList OPTIONAL +%% attribute extGroup(5) External KME-specific-types:KmeExtTrkGroupList OPTIONAL %%------------------------------------------------- - {Term5,Bytes7,Rb6} = case Bytes6 of -<<2:2,_:1,4:5,_/binary>> -> -'dec_KmeExtTrkGroupList'(Bytes6, opt_or_default, [{tag,128,4,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes6, 0 } +{Term5,Tlv6} = case Tlv5 of +[{131076,V5}|TempTlv6] -> + {'dec_KmeExtTrkGroupList'(V5, [16]), TempTlv6}; + _ -> + { asn1_NOVALUE, Tlv5} end, %%------------------------------------------------- -%% attribute number 6 External KME-specific-types:KmePckPagGroupList OPTIONAL +%% attribute pickGroup(6) External KME-specific-types:KmePckPagGroupList OPTIONAL %%------------------------------------------------- - {Term6,Bytes8,Rb7} = case Bytes7 of -<<2:2,_:1,5:5,_/binary>> -> -'dec_KmePckPagGroupList'(Bytes7, opt_or_default, [{tag,128,5,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes7, 0 } +{Term6,Tlv7} = case Tlv6 of +[{131077,V6}|TempTlv7] -> + {'dec_KmePckPagGroupList'(V6, [16]), TempTlv7}; + _ -> + { asn1_NOVALUE, Tlv6} end, %%------------------------------------------------- -%% attribute number 7 External KME-specific-types:KmePckPagGroupList OPTIONAL +%% attribute pagingGroup(7) External KME-specific-types:KmePckPagGroupList OPTIONAL %%------------------------------------------------- - {Term7,Bytes9,Rb8} = case Bytes8 of -<<2:2,_:1,6:5,_/binary>> -> -'dec_KmePckPagGroupList'(Bytes8, opt_or_default, [{tag,128,6,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes8, 0 } +{Term7,Tlv8} = case Tlv7 of +[{131078,V7}|TempTlv8] -> + {'dec_KmePckPagGroupList'(V7, [16]), TempTlv8}; + _ -> + { asn1_NOVALUE, Tlv7} end, %%------------------------------------------------- -%% attribute number 8 External KME-specific-types:KmeIncomingGroupList OPTIONAL +%% attribute incomingGroup(8) External KME-specific-types:KmeIncomingGroupList OPTIONAL %%------------------------------------------------- - {Term8,Bytes10,Rb9} = case Bytes9 of -<<2:2,_:1,7:5,_/binary>> -> -'dec_KmeIncomingGroupList'(Bytes9, opt_or_default, [{tag,128,7,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes9, 0 } +{Term8,Tlv9} = case Tlv8 of +[{131079,V8}|TempTlv9] -> + {'dec_KmeIncomingGroupList'(V8, [16]), TempTlv9}; + _ -> + { asn1_NOVALUE, Tlv8} end, %%------------------------------------------------- -%% attribute number 9 External KME-specific-types:KmeDayNightMode OPTIONAL +%% attribute dayNightMode(9) External KME-specific-types:KmeDayNightMode OPTIONAL %%------------------------------------------------- - {Term9,Bytes11,Rb10} = case Bytes10 of -<<2:2,_:1,8:5,_/binary>> -> -'dec_KmeDayNightMode'(Bytes10, opt_or_default, [{tag,128,8,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes10, 0 } +{Term9,Tlv10} = case Tlv9 of +[{131080,V9}|TempTlv10] -> + {'dec_KmeDayNightMode'(V9, [16]), TempTlv10}; + _ -> + { asn1_NOVALUE, Tlv9} end, %%------------------------------------------------- -%% attribute number 10 External KME-specific-types:KmeWakeUpInfo OPTIONAL +%% attribute wakeUp(10) External KME-specific-types:KmeWakeUpInfo OPTIONAL %%------------------------------------------------- - {Term10,Bytes12,Rb11} = case Bytes11 of -<<2:2,_:1,9:5,_/binary>> -> -'dec_KmeWakeUpInfo'(Bytes11, opt_or_default, [{tag,128,9,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes11, 0 } +{Term10,Tlv11} = case Tlv10 of +[{131081,V10}|TempTlv11] -> + {'dec_KmeWakeUpInfo'(V10, [16]), TempTlv11}; + _ -> + { asn1_NOVALUE, Tlv10} end, %%------------------------------------------------- -%% attribute number 11 with type ENUMERATED OPTIONAL +%% attribute remoteLock(11) with type ENUMERATED OPTIONAL %%------------------------------------------------- - {Term11,Bytes13,Rb12} = case Bytes12 of -<<2:2,_:1,10:5,_/binary>> -> -?RT_BER:decode_enumerated(Bytes12,[],[{lock,0},{unlock,1}],[{tag,128,10,'EXPLICIT',32}], mandatory); -_ -> -{ asn1_NOVALUE, Bytes12, 0 } +{Term11,Tlv12} = case Tlv11 of +[{131082,V11}|TempTlv12] -> + {case decode_integer(V11, [10]) of +0 -> lock; +1 -> unlock; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end, TempTlv12}; + _ -> + { asn1_NOVALUE, Tlv11} end, %%------------------------------------------------- -%% attribute number 12 External KME-specific-types:KmeAbsentMessage OPTIONAL +%% attribute callLogLock(12) External KME-specific-types:KmeAbsentMessage OPTIONAL %%------------------------------------------------- - {Term12,Bytes14,Rb13} = case Bytes13 of -<<2:2,_:1,12:5,_/binary>> -> -'dec_KmeAbsentMessage'(Bytes13, opt_or_default, [{tag,128,12,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes13, 0 } +{Term12,Tlv13} = case Tlv12 of +[{131084,V12}|TempTlv13] -> + {'dec_KmeAbsentMessage'(V12, []), TempTlv13}; + _ -> + { asn1_NOVALUE, Tlv12} end, %%------------------------------------------------- -%% attribute number 13 with type ENUMERATED OPTIONAL +%% attribute forwardDnd(13) with type ENUMERATED OPTIONAL %%------------------------------------------------- - {Term13,Bytes15,Rb14} = case Bytes14 of -<<2:2,_:1,11:5,_/binary>> -> -?RT_BER:decode_enumerated(Bytes14,[],[{lock,0},{unlock,1}],[{tag,128,11,'EXPLICIT',32}], mandatory); -_ -> -{ asn1_NOVALUE, Bytes14, 0 } +{Term13,Tlv14} = case Tlv13 of +[{131083,V13}|TempTlv14] -> + {case decode_integer(V13, [10]) of +0 -> lock; +1 -> unlock; +Default2 -> exit({error,{asn1,{illegal_enumerated,Default2}}}) +end, TempTlv14}; + _ -> + { asn1_NOVALUE, Tlv13} end, %%------------------------------------------------- -%% attribute number 14 External CSTA-device-feature-types:ForwardList OPTIONAL +%% attribute absentMessage(14) External CSTA-device-feature-types:ForwardList OPTIONAL %%------------------------------------------------- - {Term14,Bytes16,Rb15} = case Bytes15 of -<<2:2,_:1,13:5,_/binary>> -> -'CSTA-device-feature-types':'dec_ForwardList'(Bytes15, opt_or_default, [{tag,128,13,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes15, 0 } +{Term14,Tlv15} = case Tlv14 of +[{131085,V14}|TempTlv15] -> + {'CSTA-device-feature-types':'dec_ForwardList'(V14, [16]), TempTlv15}; + _ -> + { asn1_NOVALUE, Tlv14} end, %%------------------------------------------------- -%% attribute number 15 External KME-specific-types:KmeTrkMembers OPTIONAL +%% attribute trkGMembers(15) External KME-specific-types:KmeTrkMembers OPTIONAL %%------------------------------------------------- - {Term15,Bytes17,Rb16} = case Bytes16 of -<<2:2,_:1,14:5,_/binary>> -> -'dec_KmeTrkMembers'(Bytes16, opt_or_default, [{tag,128,14,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes16, 0 } +{Term15,Tlv16} = case Tlv15 of +[{131086,V15}|TempTlv16] -> + {'dec_KmeTrkMembers'(V15, [16]), TempTlv16}; + _ -> + { asn1_NOVALUE, Tlv15} end, %%------------------------------------------------- -%% attribute number 16 External KME-specific-types:KmeExtMembers OPTIONAL +%% attribute extGMembers(16) External KME-specific-types:KmeExtMembers OPTIONAL %%------------------------------------------------- - {Term16,Bytes18,Rb17} = case Bytes17 of -<<2:2,_:1,15:5,_/binary>> -> -'dec_KmeExtMembers'(Bytes17, opt_or_default, [{tag,128,15,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes17, 0 } +{Term16,Tlv17} = case Tlv16 of +[{131087,V16}|TempTlv17] -> + {'dec_KmeExtMembers'(V16, [16]), TempTlv17}; + _ -> + { asn1_NOVALUE, Tlv16} end, %%------------------------------------------------- -%% attribute number 17 External KME-specific-types:KmeIcmGrpMembers OPTIONAL +%% attribute incomGMembers(17) External KME-specific-types:KmeIcmGrpMembers OPTIONAL %%------------------------------------------------- - {Term17,Bytes19,Rb18} = case Bytes18 of -<<2:2,_:1,16:5,_/binary>> -> -'dec_KmeIcmGrpMembers'(Bytes18, opt_or_default, [{tag,128,16,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes18, 0 } +{Term17,Tlv18} = case Tlv17 of +[{131088,V17}|TempTlv18] -> + {'dec_KmeIcmGrpMembers'(V17, [16]), TempTlv18}; + _ -> + { asn1_NOVALUE, Tlv17} end, %%------------------------------------------------- -%% attribute number 18 External KME-specific-types:KmeDoorPhone OPTIONAL +%% attribute doorPhone(18) External KME-specific-types:KmeDoorPhone OPTIONAL %%------------------------------------------------- - {Term18,Bytes20,Rb19} = case Bytes19 of -<<2:2,_:1,17:5,_/binary>> -> -'dec_KmeDoorPhone'(Bytes19, opt_or_default, [{tag,128,17,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes19, 0 } +{Term18,Tlv19} = case Tlv18 of +[{131089,V18}|TempTlv19] -> + {'dec_KmeDoorPhone'(V18, [16]), TempTlv19}; + _ -> + { asn1_NOVALUE, Tlv18} end, %%------------------------------------------------- -%% attribute number 19 External KME-specific-types:KmeVmGroupList OPTIONAL +%% attribute vmGroup(19) External KME-specific-types:KmeVmGroupList OPTIONAL %%------------------------------------------------- - {Term19,Bytes21,Rb20} = case Bytes20 of -<<2:2,_:1,18:5,_/binary>> -> -'dec_KmeVmGroupList'(Bytes20, opt_or_default, [{tag,128,18,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes20, 0 } +{Term19,Tlv20} = case Tlv19 of +[{131090,V19}|TempTlv20] -> + {'dec_KmeVmGroupList'(V19, [16]), TempTlv20}; + _ -> + { asn1_NOVALUE, Tlv19} end, %%------------------------------------------------- -%% attribute number 20 with type IA5String OPTIONAL +%% attribute manufacturerName(20) with type IA5String OPTIONAL %%------------------------------------------------- - {Term20,Bytes22,Rb21} = case Bytes21 of -<<2:2,_:1,19:5,_/binary>> -> -?RT_BER:decode_restricted_string(Bytes21,{0,64},22,[{tag,128,19,'EXPLICIT',32}], no_length, mandatory); -_ -> -{ asn1_NOVALUE, Bytes21, 0 } +{Term20,Tlv21} = case Tlv20 of +[{131091,V20}|TempTlv21] -> + {begin +Val1 = decode_restricted_string(V20, [22]), +C1 = byte_size(Val1), +if 0 =< C1, C1 =< 64 -> +binary_to_list(Val1); +true -> +exit({error,{asn1,bad_range}}) +end +end, TempTlv21}; + _ -> + { asn1_NOVALUE, Tlv20} end, %%------------------------------------------------- -%% attribute number 21 with type IA5String OPTIONAL +%% attribute subdomainName(21) with type IA5String OPTIONAL %%------------------------------------------------- - {Term21,Bytes23,Rb22} = case Bytes22 of -<<2:2,_:1,20:5,_/binary>> -> -?RT_BER:decode_restricted_string(Bytes22,{0,20},22,[{tag,128,20,'EXPLICIT',32}], no_length, mandatory); -_ -> -{ asn1_NOVALUE, Bytes22, 0 } +{Term21,Tlv22} = case Tlv21 of +[{131092,V21}|TempTlv22] -> + {begin +Val2 = decode_restricted_string(V21, [22]), +C2 = byte_size(Val2), +if 0 =< C2, C2 =< 20 -> +binary_to_list(Val2); +true -> +exit({error,{asn1,bad_range}}) +end +end, TempTlv22}; + _ -> + { asn1_NOVALUE, Tlv21} end, %%------------------------------------------------- -%% attribute number 22 with type IA5String OPTIONAL +%% attribute softwareVersion(22) with type IA5String OPTIONAL %%------------------------------------------------- - {Term22,Bytes24,Rb23} = case Bytes23 of -<<2:2,_:1,21:5,_/binary>> -> -?RT_BER:decode_restricted_string(Bytes23,{0,32},22,[{tag,128,21,'EXPLICIT',32}], no_length, mandatory); -_ -> -{ asn1_NOVALUE, Bytes23, 0 } +{Term22,Tlv23} = case Tlv22 of +[{131093,V22}|TempTlv23] -> + {begin +Val3 = decode_restricted_string(V22, [22]), +C3 = byte_size(Val3), +if 0 =< C3, C3 =< 32 -> +binary_to_list(Val3); +true -> +exit({error,{asn1,bad_range}}) +end +end, TempTlv23}; + _ -> + { asn1_NOVALUE, Tlv22} end, %%------------------------------------------------- -%% attribute number 23 with type IA5String OPTIONAL +%% attribute ctiVersion(23) with type IA5String OPTIONAL %%------------------------------------------------- - {Term23,Bytes25,Rb24} = case Bytes24 of -<<2:2,_:1,22:5,_/binary>> -> -?RT_BER:decode_restricted_string(Bytes24,{0,32},22,[{tag,128,22,'EXPLICIT',32}], no_length, mandatory); -_ -> -{ asn1_NOVALUE, Bytes24, 0 } +{Term23,Tlv24} = case Tlv23 of +[{131094,V23}|TempTlv24] -> + {begin +Val4 = decode_restricted_string(V23, [22]), +C4 = byte_size(Val4), +if 0 =< C4, C4 =< 32 -> +binary_to_list(Val4); +true -> +exit({error,{asn1,bad_range}}) +end +end, TempTlv24}; + _ -> + { asn1_NOVALUE, Tlv23} end, %%------------------------------------------------- -%% attribute number 24 with type IA5String OPTIONAL +%% attribute regionCode(24) with type IA5String OPTIONAL %%------------------------------------------------- - {Term24,Bytes26,Rb25} = case Bytes25 of -<<2:2,_:1,23:5,_/binary>> -> -?RT_BER:decode_restricted_string(Bytes25,{0,32},22,[{tag,128,23,'EXPLICIT',32}], no_length, mandatory); -_ -> -{ asn1_NOVALUE, Bytes25, 0 } +{Term24,Tlv25} = case Tlv24 of +[{131095,V24}|TempTlv25] -> + {begin +Val5 = decode_restricted_string(V24, [22]), +C5 = byte_size(Val5), +if 0 =< C5, C5 =< 32 -> +binary_to_list(Val5); +true -> +exit({error,{asn1,bad_range}}) +end +end, TempTlv25}; + _ -> + { asn1_NOVALUE, Tlv24} end, %%------------------------------------------------- -%% attribute number 25 with type GeneralizedTime OPTIONAL +%% attribute systemTime(25) with type GeneralizedTime OPTIONAL %%------------------------------------------------- - {Term25,Bytes27,Rb26} = case Bytes26 of -<<2:2,_:1,24:5,_/binary>> -> -?RT_BER:decode_generalized_time(Bytes26,[],[{tag,128,24,'EXPLICIT',32}], no_length, mandatory); -_ -> -{ asn1_NOVALUE, Bytes26, 0 } +{Term25,Tlv26} = case Tlv25 of +[{131096,V25}|TempTlv26] -> + {begin +binary_to_list(decode_restricted_string(V25, [24])) +end +, TempTlv26}; + _ -> + { asn1_NOVALUE, Tlv25} end, %%------------------------------------------------- -%% attribute number 26 External KME-specific-types:NumberOfMsgPort OPTIONAL +%% attribute numberOfMsgPort(26) External KME-specific-types:NumberOfMsgPort OPTIONAL %%------------------------------------------------- - {Term26,Bytes28,Rb27} = case Bytes27 of -<<2:2,_:1,25:5,_/binary>> -> -'dec_NumberOfMsgPort'(Bytes27, opt_or_default, [{tag,128,25,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes27, 0 } +{Term26,Tlv27} = case Tlv26 of +[{131097,V26}|TempTlv27] -> + {'dec_NumberOfMsgPort'(V26, [16]), TempTlv27}; + _ -> + { asn1_NOVALUE, Tlv26} end, %%------------------------------------------------- -%% attribute number 27 External KME-specific-types:KmePsGroupList OPTIONAL +%% attribute psGroup(27) External KME-specific-types:KmePsGroupList OPTIONAL %%------------------------------------------------- - {Term27,Bytes29,Rb28} = case Bytes28 of -<<2:2,_:1,26:5,_/binary>> -> -'dec_KmePsGroupList'(Bytes28, opt_or_default, [{tag,128,26,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes28, 0 } +{Term27,Tlv28} = case Tlv27 of +[{131098,V27}|TempTlv28] -> + {'dec_KmePsGroupList'(V27, [16]), TempTlv28}; + _ -> + { asn1_NOVALUE, Tlv27} end, %%------------------------------------------------- -%% attribute number 28 External CSTA-device-identifiers:DeviceID OPTIONAL +%% attribute youAre(28) External CSTA-device-identifiers:DeviceID OPTIONAL %%------------------------------------------------- - {Term28,Bytes30,Rb29} = case Bytes29 of -<<2:2,_:1,27:5,_/binary>> -> -'CSTA-device-identifiers':'dec_DeviceID'(Bytes29, opt_or_default, [{tag,128,27,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes29, 0 } +{Term28,Tlv29} = case Tlv28 of +[{131099,V28}|TempTlv29] -> + {'CSTA-device-identifiers':'dec_DeviceID'(V28, [16]), TempTlv29}; + _ -> + { asn1_NOVALUE, Tlv28} end, %%------------------------------------------------- -%% attribute number 29 External KME-specific-types:KmeSvmList OPTIONAL +%% attribute svm(29) External KME-specific-types:KmeSvmList OPTIONAL %%------------------------------------------------- - {Term29,Bytes31,Rb30} = case Bytes30 of -<<2:2,_:1,28:5,_/binary>> -> -'dec_KmeSvmList'(Bytes30, opt_or_default, [{tag,128,28,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes30, 0 } +{Term29,Tlv30} = case Tlv29 of +[{131100,V29}|TempTlv30] -> + {'dec_KmeSvmList'(V29, [16]), TempTlv30}; + _ -> + { asn1_NOVALUE, Tlv29} end, %%------------------------------------------------- -%% attribute number 30 External KME-specific-types:KmePdnGMembers OPTIONAL +%% attribute pdn(30) External KME-specific-types:KmePdnGMembers OPTIONAL %%------------------------------------------------- - {Term30,Bytes32,Rb31} = case Bytes31 of -<<2:2,_:1,29:5,_/binary>> -> -'dec_KmePdnGMembers'(Bytes31, opt_or_default, [{tag,128,29,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes31, 0 } +{Term30,Tlv31} = case Tlv30 of +[{131101,V30}|TempTlv31] -> + {'dec_KmePdnGMembers'(V30, [16]), TempTlv31}; + _ -> + { asn1_NOVALUE, Tlv30} end, %%------------------------------------------------- -%% attribute number 31 with type INTEGER OPTIONAL +%% attribute cos(31) with type INTEGER OPTIONAL %%------------------------------------------------- - {Term31,Bytes33,Rb32} = case Bytes32 of -<<2:2,_:1,31:5,34,_/binary>> -> -?RT_BER:decode_integer(Bytes32,[],[{tag,128,34,'EXPLICIT',32}], mandatory); -_ -> -{ asn1_NOVALUE, Bytes32, 0 } +{Term31,Tlv32} = case Tlv31 of +[{131106,V31}|TempTlv32] -> + {decode_integer(V31, [2]), TempTlv32}; + _ -> + { asn1_NOVALUE, Tlv31} end, %%------------------------------------------------- -%% attribute number 32 External KME-specific-types:KmePhoneProperty OPTIONAL +%% attribute phoneProperty(32) External KME-specific-types:KmePhoneProperty OPTIONAL %%------------------------------------------------- - {Term32,Bytes34,Rb33} = case Bytes33 of -<<2:2,_:1,31:5,35,_/binary>> -> -'dec_KmePhoneProperty'(Bytes33, opt_or_default, [{tag,128,35,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes33, 0 } +{Term32,Tlv33} = case Tlv32 of +[{131107,V32}|TempTlv33] -> + {'dec_KmePhoneProperty'(V32, [16]), TempTlv33}; + _ -> + { asn1_NOVALUE, Tlv32} end, %%------------------------------------------------- -%% attribute number 33 with type BIT STRING OPTIONAL +%% attribute assocIncomGroup(33) with type BIT STRING OPTIONAL %%------------------------------------------------- - {Term33,Bytes35,Rb34} = case Bytes34 of -<<2:2,_:1,31:5,36,_/binary>> -> -?RT_BER:decode_bit_string(Bytes34,[],[{one,0},{two,1},{three,2},{four,3},{five,4},{six,5},{seven,6},{eight,7},{nine,8},{ten,9},{eleven,10},{twelve,11},{thirteen,12},{fourteen,13},{fifteen,14},{sixteen,15},{seventeen,16},{eighteen,17},{nineteen,18},{twenty,19},{twentyOne,20},{twentyTwo,21},{twentyThree,22},{twentyFour,23},{twentyFive,24},{twentySix,25},{twentySeven,26},{twentyEight,27},{twentyNine,28},{thirty,29},{thirtyOne,30},{thirtyTwo,31},{thirtyThree,32},{thirtyFour,33},{thirtyFive,34},{thirtySix,35},{thirtySeven,36},{thirtyEight,37},{thirtyNine,38},{fourty,39},{fourtyOne,40},{fourtyTwo,41},{fourtyThree,42},{fourtyFour,43},{fourtyFive,44},{fourtySix,45},{fourtySeven,46},{fourtyEight,47},{fourtyNine,48},{fifty,49},{fiftyOne,50},{fiftyTwo,51},{fiftyThree,52},{fiftyFour,53},{fiftyFive,54},{fiftySix,55},{fiftySeven,56},{fiftyEight,57},{fiftyNine,58},{sixty,59},{sixtyOne,60},{sixtyTwo,61},{sixtyThree,62},{sixtyFour,63},{sixtyFive,64},{sixtySix,65},{sixtySeven,66},{sixtyEight,67},{sixtyNine,68},{seventy,69},{seventyOne,70},{seventyTwo,71},{seventyThree,72},{seventyFour,73},{seventyFive,74},{seventySix,75},{seventySeven,76},{seventyEight,77},{seventyNine,78},{eighty,79},{eightyOne,80},{eightyTwo,81},{eightyThree,82},{eightyFour,83},{eightyFive,84},{eightySix,85},{eightySeven,86},{eightyEight,87},{eightyNine,88},{ninety,89},{ninetyOne,90},{ninetyTwo,91},{ninetyThree,92},{ninetyFour,93},{ninetyFive,94},{ninetySix,95},{ninetySeven,96},{ninetyEight,97},{ninetyNine,98},{oneHundred,99},{oneHundredOne,100},{oneHundredTwo,101},{oneHundredThree,102},{oneHundredFour,103},{oneHundredFive,104},{oneHundredSix,105},{oneHundredSeven,106},{oneHundredEitht,107},{oneHundredNine,108},{oneHundredTen,109},{oneHundredEleven,110},{oneHundredTwelve,111},{oneHundredThirteen,112},{oneHundredFourteen,113},{oneHundredFifteen,114},{oneHundredSixteen,115},{oneHundredSeventeen,116},{oneHundredEithteen,117},{oneHundredNineteen,118},{oneHundredTwenty,119},{oneHundredTwentyOne,120},{oneHundredTwentyTwo,121},{oneHundredTwentyThree,122},{oneHundredTwentyFour,123},{oneHundredTwentyFive,124},{oneHundredTwentySix,125},{oneHundredTwentySeven,126},{oneHundredTwentyEight,127}],[{tag,128,36,'EXPLICIT',32}], no_length, mandatory); -_ -> -{ asn1_NOVALUE, Bytes34, 0 } +{Term33,Tlv34} = case Tlv33 of +[{131108,V33}|TempTlv34] -> + {decode_named_bit_string(V33, [{one,0},{two,1},{three,2},{four,3},{five,4},{six,5},{seven,6},{eight,7},{nine,8},{ten,9},{eleven,10},{twelve,11},{thirteen,12},{fourteen,13},{fifteen,14},{sixteen,15},{seventeen,16},{eighteen,17},{nineteen,18},{twenty,19},{twentyOne,20},{twentyTwo,21},{twentyThree,22},{twentyFour,23},{twentyFive,24},{twentySix,25},{twentySeven,26},{twentyEight,27},{twentyNine,28},{thirty,29},{thirtyOne,30},{thirtyTwo,31},{thirtyThree,32},{thirtyFour,33},{thirtyFive,34},{thirtySix,35},{thirtySeven,36},{thirtyEight,37},{thirtyNine,38},{fourty,39},{fourtyOne,40},{fourtyTwo,41},{fourtyThree,42},{fourtyFour,43},{fourtyFive,44},{fourtySix,45},{fourtySeven,46},{fourtyEight,47},{fourtyNine,48},{fifty,49},{fiftyOne,50},{fiftyTwo,51},{fiftyThree,52},{fiftyFour,53},{fiftyFive,54},{fiftySix,55},{fiftySeven,56},{fiftyEight,57},{fiftyNine,58},{sixty,59},{sixtyOne,60},{sixtyTwo,61},{sixtyThree,62},{sixtyFour,63},{sixtyFive,64},{sixtySix,65},{sixtySeven,66},{sixtyEight,67},{sixtyNine,68},{seventy,69},{seventyOne,70},{seventyTwo,71},{seventyThree,72},{seventyFour,73},{seventyFive,74},{seventySix,75},{seventySeven,76},{seventyEight,77},{seventyNine,78},{eighty,79},{eightyOne,80},{eightyTwo,81},{eightyThree,82},{eightyFour,83},{eightyFive,84},{eightySix,85},{eightySeven,86},{eightyEight,87},{eightyNine,88},{ninety,89},{ninetyOne,90},{ninetyTwo,91},{ninetyThree,92},{ninetyFour,93},{ninetyFive,94},{ninetySix,95},{ninetySeven,96},{ninetyEight,97},{ninetyNine,98},{oneHundred,99},{oneHundredOne,100},{oneHundredTwo,101},{oneHundredThree,102},{oneHundredFour,103},{oneHundredFive,104},{oneHundredSix,105},{oneHundredSeven,106},{oneHundredEitht,107},{oneHundredNine,108},{oneHundredTen,109},{oneHundredEleven,110},{oneHundredTwelve,111},{oneHundredThirteen,112},{oneHundredFourteen,113},{oneHundredFifteen,114},{oneHundredSixteen,115},{oneHundredSeventeen,116},{oneHundredEithteen,117},{oneHundredNineteen,118},{oneHundredTwenty,119},{oneHundredTwentyOne,120},{oneHundredTwentyTwo,121},{oneHundredTwentyThree,122},{oneHundredTwentyFour,123},{oneHundredTwentyFive,124},{oneHundredTwentySix,125},{oneHundredTwentySeven,126},{oneHundredTwentyEight,127}], [3]), TempTlv34}; + _ -> + { asn1_NOVALUE, Tlv33} end, %%------------------------------------------------- -%% attribute number 34 with type SEQUENCE OF OPTIONAL +%% attribute messageWaiting(34) with type SEQUENCE OF OPTIONAL %%------------------------------------------------- - {Term34,Bytes36,Rb35} = case Bytes35 of -<<2:2,_:1,31:5,37,_/binary>> -> -'dec_KmeGetSystemDataRsp_messageWaiting'(Bytes35, opt_or_default, [{tag,128,37,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes35, 0 } +{Term34,Tlv35} = case Tlv34 of +[{131109,V34}|TempTlv35] -> + {'dec_KmeGetSystemDataRsp_messageWaiting'(V34, [16]), TempTlv35}; + _ -> + { asn1_NOVALUE, Tlv34} end, %%------------------------------------------------- -%% attribute number 35 External KME-specific-types:KmeDeviceStateList OPTIONAL +%% attribute deviceList(35) External KME-specific-types:KmeDeviceStateList OPTIONAL %%------------------------------------------------- - {Term35,Bytes37,Rb36} = case Bytes36 of -<<2:2,_:1,31:5,38,_/binary>> -> -'dec_KmeDeviceStateList'(Bytes36, opt_or_default, [{tag,128,38,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes36, 0 } +{Term35,Tlv36} = case Tlv35 of +[{131110,V35}|TempTlv36] -> + {'dec_KmeDeviceStateList'(V35, [16]), TempTlv36}; + _ -> + { asn1_NOVALUE, Tlv35} end, %%------------------------------------------------- -%% attribute number 36 with type INTEGER OPTIONAL +%% attribute assocExtGroup(36) with type INTEGER OPTIONAL %%------------------------------------------------- - {Term36,Bytes38,Rb37} = case Bytes37 of -<<2:2,_:1,31:5,39,_/binary>> -> -?RT_BER:decode_integer(Bytes37,[],[{tag,128,39,'EXPLICIT',32}], mandatory); -_ -> -{ asn1_NOVALUE, Bytes37, 0 } +{Term36,Tlv37} = case Tlv36 of +[{131111,V36}|TempTlv37] -> + {decode_integer(V36, [2]), TempTlv37}; + _ -> + { asn1_NOVALUE, Tlv36} end, %%------------------------------------------------- -%% attribute number 37 External KME-specific-types:KmeIcmGrpMembers OPTIONAL +%% attribute vmGMembers(37) External KME-specific-types:KmeIcmGrpMembers OPTIONAL %%------------------------------------------------- - {Term37,Bytes39,Rb38} = case Bytes38 of -<<2:2,_:1,31:5,40,_/binary>> -> -'dec_KmeIcmGrpMembers'(Bytes38, opt_or_default, [{tag,128,40,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes38, 0 } +{Term37,Tlv38} = case Tlv37 of +[{131112,V37}|TempTlv38] -> + {'dec_KmeIcmGrpMembers'(V37, [16]), TempTlv38}; + _ -> + { asn1_NOVALUE, Tlv37} end, %%------------------------------------------------- -%% attribute number 38 External KME-specific-types:KmeExtName OPTIONAL +%% attribute extName(38) External KME-specific-types:KmeExtName OPTIONAL %%------------------------------------------------- - {Term38,Bytes40,Rb39} = case Bytes39 of -<<2:2,_:1,31:5,41,_/binary>> -> -'dec_KmeExtName'(Bytes39, opt_or_default, [{tag,128,41,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes39, 0 } +{Term38,Tlv39} = case Tlv38 of +[{131113,V38}|TempTlv39] -> + {'dec_KmeExtName'(V38, []), TempTlv39}; + _ -> + { asn1_NOVALUE, Tlv38} end, %%------------------------------------------------- -%% attribute number 39 External KME-specific-types:KmeBroadcastGroupList OPTIONAL +%% attribute broadcastGroup(39) External KME-specific-types:KmeBroadcastGroupList OPTIONAL %%------------------------------------------------- - {Term39,Bytes41,Rb40} = case Bytes40 of -<<2:2,_:1,31:5,42,_/binary>> -> -'dec_KmeBroadcastGroupList'(Bytes40, opt_or_default, [{tag,128,42,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes40, 0 } +{Term39,Tlv40} = case Tlv39 of +[{131114,V39}|TempTlv40] -> + {'dec_KmeBroadcastGroupList'(V39, [16]), TempTlv40}; + _ -> + { asn1_NOVALUE, Tlv39} end, %%------------------------------------------------- -%% attribute number 40 External KME-specific-types:KmeBroadcastGrpMembers OPTIONAL +%% attribute broadcastGMembers(40) External KME-specific-types:KmeBroadcastGrpMembers OPTIONAL %%------------------------------------------------- - {Term40,Bytes42,Rb41} = case Bytes41 of -<<2:2,_:1,31:5,43,_/binary>> -> -'dec_KmeBroadcastGrpMembers'(Bytes41, opt_or_default, [{tag,128,43,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes41, 0 } +{Term40,Tlv41} = case Tlv40 of +[{131115,V40}|TempTlv41] -> + {'dec_KmeBroadcastGrpMembers'(V40, [16]), TempTlv41}; + _ -> + { asn1_NOVALUE, Tlv40} end, %%------------------------------------------------- -%% attribute number 41 External KME-specific-types:KmeFcoKeyList OPTIONAL +%% attribute fcoKeyList(41) External KME-specific-types:KmeFcoKeyList OPTIONAL %%------------------------------------------------- - {Term41,Bytes43,Rb42} = case Bytes42 of -<<2:2,_:1,31:5,44,_/binary>> -> -'dec_KmeFcoKeyList'(Bytes42, opt_or_default, [{tag,128,44,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes42, 0 } +{Term41,Tlv42} = case Tlv41 of +[{131116,V41}|TempTlv42] -> + {'dec_KmeFcoKeyList'(V41, [16]), TempTlv42}; + _ -> + { asn1_NOVALUE, Tlv41} end, %%------------------------------------------------- -%% attribute number 42 External CSTA-device-identifiers:DeviceID OPTIONAL +%% attribute sxdpMaster(42) External CSTA-device-identifiers:DeviceID OPTIONAL %%------------------------------------------------- - {Term42,Bytes44,Rb43} = case Bytes43 of -<<2:2,_:1,31:5,45,_/binary>> -> -'CSTA-device-identifiers':'dec_DeviceID'(Bytes43, opt_or_default, [{tag,128,45,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes43, 0 } +{Term42,Tlv43} = case Tlv42 of +[{131117,V42}|TempTlv43] -> + {'CSTA-device-identifiers':'dec_DeviceID'(V42, [16]), TempTlv43}; + _ -> + { asn1_NOVALUE, Tlv42} end, %%------------------------------------------------- -%% attribute number 43 with type INTEGER OPTIONAL +%% attribute pbxType(43) with type INTEGER OPTIONAL %%------------------------------------------------- - {Term43,Bytes45,Rb44} = case Bytes44 of -<<2:2,_:1,31:5,46,_/binary>> -> -?RT_BER:decode_integer(Bytes44,[],[{tag,128,46,'EXPLICIT',32}], mandatory); -_ -> -{ asn1_NOVALUE, Bytes44, 0 } +{Term43,Tlv44} = case Tlv43 of +[{131118,V43}|TempTlv44] -> + {decode_integer(V43, [2]), TempTlv44}; + _ -> + { asn1_NOVALUE, Tlv43} end, %%------------------------------------------------- -%% attribute number 44 External KME-specific-types:KmeExternalSensorList OPTIONAL +%% attribute externalSensor(44) External KME-specific-types:KmeExternalSensorList OPTIONAL %%------------------------------------------------- - {Term44,Bytes46,Rb45} = case Bytes45 of -<<2:2,_:1,31:5,47,_/binary>> -> -'dec_KmeExternalSensorList'(Bytes45, opt_or_default, [{tag,128,47,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes45, 0 } +{Term44,Tlv45} = case Tlv44 of +[{131119,V44}|TempTlv45] -> + {'dec_KmeExternalSensorList'(V44, [16]), TempTlv45}; + _ -> + { asn1_NOVALUE, Tlv44} end, %%------------------------------------------------- -%% attribute number 45 External KME-specific-types:KmeDeviceDataList OPTIONAL +%% attribute deviceDataList(45) External KME-specific-types:KmeDeviceDataList OPTIONAL %%------------------------------------------------- - {Term45,Bytes47,Rb46} = case Bytes46 of -<<2:2,_:1,31:5,48,_/binary>> -> -'dec_KmeDeviceDataList'(Bytes46, opt_or_default, [{tag,128,48,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes46, 0 } +{Term45,Tlv46} = case Tlv45 of +[{131120,V45}|TempTlv46] -> + {'dec_KmeDeviceDataList'(V45, [16]), TempTlv46}; + _ -> + { asn1_NOVALUE, Tlv45} end, %%------------------------------------------------- -%% attribute number 46 External KME-specific-types:KmeCheckStatusList OPTIONAL +%% attribute guestCheckStatus(46) External KME-specific-types:KmeCheckStatusList OPTIONAL %%------------------------------------------------- - {Term46,Bytes48,Rb47} = case Bytes47 of -<<2:2,_:1,31:5,49,_/binary>> -> -'dec_KmeCheckStatusList'(Bytes47, opt_or_default, [{tag,128,49,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes47, 0 } +{Term46,Tlv47} = case Tlv46 of +[{131121,V46}|TempTlv47] -> + {'dec_KmeCheckStatusList'(V46, [16]), TempTlv47}; + _ -> + { asn1_NOVALUE, Tlv46} end, - {Bytes49,Rb48} = ?RT_BER:restbytes2(RemBytes, Bytes48,noext), - {{'KmeGetSystemDataRsp', Term1, Term2, Term3, Term4, Term5, Term6, Term7, Term8, Term9, Term10, Term11, Term12, Term13, Term14, Term15, Term16, Term17, Term18, Term19, Term20, Term21, Term22, Term23, Term24, Term25, Term26, Term27, Term28, Term29, Term30, Term31, Term32, Term33, Term34, Term35, Term36, Term37, Term38, Term39, Term40, Term41, Term42, Term43, Term44, Term45, Term46}, Bytes49, Rb1+Rb2+Rb3+Rb4+Rb5+Rb6+Rb7+Rb8+Rb9+Rb10+Rb11+Rb12+Rb13+Rb14+Rb15+Rb16+Rb17+Rb18+Rb19+Rb20+Rb21+Rb22+Rb23+Rb24+Rb25+Rb26+Rb27+Rb28+Rb29+Rb30+Rb31+Rb32+Rb33+Rb34+Rb35+Rb36+Rb37+Rb38+Rb39+Rb40+Rb41+Rb42+Rb43+Rb44+Rb45+Rb46+Rb47+Rb48}. +case Tlv47 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv47}}}) % extra fields not allowed +end, + {'KmeGetSystemDataRsp', Term1, Term2, Term3, Term4, Term5, Term6, Term7, Term8, Term9, Term10, Term11, Term12, Term13, Term14, Term15, Term16, Term17, Term18, Term19, Term20, Term21, Term22, Term23, Term24, Term25, Term26, Term27, Term28, Term29, Term30, Term31, Term32, Term33, Term34, Term35, Term36, Term37, Term38, Term39, Term40, Term41, Term42, Term43, Term44, Term45, Term46}. + +'dec_KmeGetSystemDataRsp_messageWaiting'(Tlv, TagIn) -> + %%------------------------------------------------- + %% decode tag and length + %%------------------------------------------------- +Tlv1 = match_tags(Tlv, TagIn), +['CSTA-device-identifiers':'dec_DeviceID'(V1, [16]) || V1 <- Tlv1]. + + %%================================ %% KmeGetSystemData %%================================ - -'enc_KmeGetSystemData'({'KmeGetSystemData',Val}, TagIn) -> - 'enc_KmeGetSystemData'(Val, TagIn); +'enc_KmeGetSystemData'(Val) -> + 'enc_KmeGetSystemData'(Val, []). 'enc_KmeGetSystemData'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of request -> 'enc_KmeGetSystemDataReq'(element(2,Val), []); result -> - 'enc_KmeGetSystemDataRsp'(element(2,Val), []); + 'enc_KmeGetSystemDataRsp'(element(2,Val), [<<48>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). +encode_tags(TagIn, EncBytes, EncLen). -'dec_KmeGetSystemData'(Bytes, OptOrMand) -> - 'dec_KmeGetSystemData'(Bytes, OptOrMand, []). +'dec_KmeGetSystemData'(Tlv) -> + 'dec_KmeGetSystemData'(Tlv, []). -'dec_KmeGetSystemData'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of +'dec_KmeGetSystemData'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of %% 'request' - <<2:2,_:1,0:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeGetSystemDataReq'(Bytes1, mandatory, []), - {{request, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + V1 = {131072,_} -> + {request, 'dec_KmeGetSystemDataReq'(V1, [])}; - <<2:2,_:1,1:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeGetSystemDataReq'(Bytes1, mandatory, []), - {{request, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + V1 = {131073,_} -> + {request, 'dec_KmeGetSystemDataReq'(V1, [])}; - <<2:2,_:1,2:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeGetSystemDataReq'(Bytes1, mandatory, []), - {{request, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + V1 = {131074,_} -> + {request, 'dec_KmeGetSystemDataReq'(V1, [])}; - <<2:2,_:1,3:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeGetSystemDataReq'(Bytes1, mandatory, []), - {{request, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + V1 = {131075,_} -> + {request, 'dec_KmeGetSystemDataReq'(V1, [])}; - <<2:2,_:1,4:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeGetSystemDataReq'(Bytes1, mandatory, []), - {{request, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + V1 = {131076,_} -> + {request, 'dec_KmeGetSystemDataReq'(V1, [])}; - <<2:2,_:1,5:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeGetSystemDataReq'(Bytes1, mandatory, []), - {{request, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + V1 = {131077,_} -> + {request, 'dec_KmeGetSystemDataReq'(V1, [])}; - <<2:2,_:1,6:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeGetSystemDataReq'(Bytes1, mandatory, []), - {{request, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + V1 = {131078,_} -> + {request, 'dec_KmeGetSystemDataReq'(V1, [])}; - <<2:2,_:1,7:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeGetSystemDataReq'(Bytes1, mandatory, []), - {{request, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + V1 = {131079,_} -> + {request, 'dec_KmeGetSystemDataReq'(V1, [])}; - <<2:2,_:1,8:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeGetSystemDataReq'(Bytes1, mandatory, []), - {{request, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + V1 = {131080,_} -> + {request, 'dec_KmeGetSystemDataReq'(V1, [])}; %% 'result' - <<0:2,_:1,16:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeGetSystemDataRsp'(Bytes1, mandatory, []), - {{result, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {16, V1} -> + {result, 'dec_KmeGetSystemDataRsp'(V1, [])}; Else -> - case OptOrMand of - mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}}); - _ ->exit({error,{asn1,{no_optional_tag,Else}}}) - end - end. + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. %%================================ %% KmeSetSystemData %%================================ - -'enc_KmeSetSystemData'({'KmeSetSystemData',Val}, TagIn) -> - 'enc_KmeSetSystemData'(Val, TagIn); +'enc_KmeSetSystemData'(Val) -> + 'enc_KmeSetSystemData'(Val, []). 'enc_KmeSetSystemData'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of systemData -> - 'enc_KmeSetSystemData_systemData'(element(2,Val), [{tag,128,0,'EXPLICIT',32}]); + 'enc_KmeSetSystemData_systemData'(element(2,Val), [<<160>>]); deviceData -> - 'enc_KmeSetSystemData_deviceData'(element(2,Val), [{tag,128,1,'EXPLICIT',32}]); + 'enc_KmeSetSystemData_deviceData'(element(2,Val), [<<48>>,<<161>>]); acdQueue -> - 'enc_KmeSetSystemData_acdQueue'(element(2,Val), [{tag,128,3,'EXPLICIT',32}]); + 'enc_KmeSetSystemData_acdQueue'(element(2,Val), [<<48>>,<<163>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). +encode_tags(TagIn, EncBytes, EncLen). @@ -7603,94 +8236,31 @@ end, %%================================ %% KmeSetSystemData_systemData %%================================ - -'enc_KmeSetSystemData_systemData'({'KmeSetSystemData_systemData',Val}, TagIn) -> - 'enc_KmeSetSystemData_systemData'(Val, TagIn); - 'enc_KmeSetSystemData_systemData'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of speedDial -> - 'enc_KmeSpeedDial'(element(2,Val), [{tag,128,0,'EXPLICIT',32}]); + 'enc_KmeSpeedDial'(element(2,Val), [<<48>>,<<160>>]); dayNightMode -> - 'enc_KmeDayNightMode'(element(2,Val), [{tag,128,1,'EXPLICIT',32}]); + 'enc_KmeDayNightMode'(element(2,Val), [<<48>>,<<161>>]); time -> - ?RT_BER:encode_generalized_time([], element(2,Val), [{tag,128,2,'EXPLICIT',32}]); + encode_restricted_string(element(2,Val), [<<24>>,<<162>>]); extNo -> - 'enc_KmeChangeExtNo'(element(2,Val), [{tag,128,3,'EXPLICIT',32}]); + 'enc_KmeChangeExtNo'(element(2,Val), [<<48>>,<<163>>]); name -> - 'enc_KmeChangeName'(element(2,Val), [{tag,128,4,'EXPLICIT',32}]); + 'enc_KmeChangeName'(element(2,Val), [<<48>>,<<164>>]); subdomainName -> - ?RT_BER:encode_restricted_string([], element(2,Val), 22, [{tag,128,5,'EXPLICIT',32}]); + encode_restricted_string(element(2,Val), [<<22>>,<<165>>]); tenantSpeedDial -> - 'enc_KmeTenantSpeedDial'(element(2,Val), [{tag,128,6,'EXPLICIT',32}]); + 'enc_KmeTenantSpeedDial'(element(2,Val), [<<48>>,<<166>>]); distributionMethod -> - 'enc_KmeDistributionMethod'(element(2,Val), [{tag,128,7,'EXPLICIT',32}]); + 'enc_KmeDistributionMethod'(element(2,Val), [<<48>>,<<167>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). - - -'dec_KmeSetSystemData_systemData'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of - -%% 'speedDial' - <<2:2,_:1,0:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeSpeedDial'(Bytes1, mandatory, [{tag,128,0,'EXPLICIT',32}]), - {{speedDial, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; - - -%% 'dayNightMode' - <<2:2,_:1,1:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeDayNightMode'(Bytes1, mandatory, [{tag,128,1,'EXPLICIT',32}]), - {{dayNightMode, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; - - -%% 'time' - <<2:2,_:1,2:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_generalized_time(Bytes1,[],[{tag,128,2,'EXPLICIT',32}], no_length, mandatory), - {{time, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; - - -%% 'extNo' - <<2:2,_:1,3:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeChangeExtNo'(Bytes1, mandatory, [{tag,128,3,'EXPLICIT',32}]), - {{extNo, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; - - -%% 'name' - <<2:2,_:1,4:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeChangeName'(Bytes1, mandatory, [{tag,128,4,'EXPLICIT',32}]), - {{name, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; +encode_tags(TagIn, EncBytes, EncLen). -%% 'subdomainName' - <<2:2,_:1,5:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_restricted_string(Bytes1,{0,20},22,[{tag,128,5,'EXPLICIT',32}], no_length, mandatory), - {{subdomainName, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; - - -%% 'tenantSpeedDial' - <<2:2,_:1,6:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeTenantSpeedDial'(Bytes1, mandatory, [{tag,128,6,'EXPLICIT',32}]), - {{tenantSpeedDial, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; - - -%% 'distributionMethod' - <<2:2,_:1,7:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeDistributionMethod'(Bytes1, mandatory, [{tag,128,7,'EXPLICIT',32}]), - {{distributionMethod, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; - - Else -> - case OptOrMand of - mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}}); - _ ->exit({error,{asn1,{no_optional_tag,Else}}}) - end - end. @@ -7698,349 +8268,395 @@ end, %% KmeSetSystemData_deviceData %%================================ 'enc_KmeSetSystemData_deviceData'(Val, TagIn) -> - + {_,Cindex1, Cindex2} = Val, + %%------------------------------------------------- -%% attribute number 1 External CSTA-device-identifiers:DeviceID +%% attribute device(1) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {EncBytes1,EncLen1} = 'CSTA-device-identifiers':'enc_DeviceID'(?RT_BER:cindex(2,Val,device), [{tag,128,1,'EXPLICIT',32}]), + {EncBytes1,EncLen1} = 'CSTA-device-identifiers':'enc_DeviceID'(Cindex1, [<<48>>,<<161>>]), %%------------------------------------------------- -%% attribute number 2 with type CHOICE +%% attribute sysData(2) with type CHOICE %%------------------------------------------------- - {EncBytes2,EncLen2} = 'enc_KmeSetSystemData_deviceData_sysData'(?RT_BER:cindex(3,Val,sysData), [{tag,128,2,'EXPLICIT',32}]), + {EncBytes2,EncLen2} = 'enc_KmeSetSystemData_deviceData_sysData'(Cindex2, [<<162>>]), BytesSoFar = [EncBytes1, EncBytes2], - LenSoFar = EncLen1 + EncLen2, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2, +encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% KmeSetSystemData_deviceData_sysData %%================================ - -'enc_KmeSetSystemData_deviceData_sysData'({'KmeSetSystemData_deviceData_sysData',Val}, TagIn) -> - 'enc_KmeSetSystemData_deviceData_sysData'(Val, TagIn); - 'enc_KmeSetSystemData_deviceData_sysData'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of wakeUp -> - 'enc_KmeWakeUpInfo'(element(2,Val), [{tag,128,0,'EXPLICIT',32}]); + 'enc_KmeWakeUpInfo'(element(2,Val), [<<48>>,<<160>>]); remoteLock -> - case (case element(2,Val) of {_,Enumval1}->Enumval1;_->element(2,Val) end) of -lock -> ?RT_BER:encode_enumerated(0,[{tag,128,1,'EXPLICIT',32}]); -unlock -> ?RT_BER:encode_enumerated(1,[{tag,128,1,'EXPLICIT',32}]); -Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) + case element(2,Val) of +lock -> encode_tags([<<10>>,<<161>>], [0], 1); +unlock -> encode_tags([<<10>>,<<161>>], [1], 1); +Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}}) end; forwardDnd -> - 'enc_KmeSetForwardInfo'(element(2,Val), [{tag,128,2,'EXPLICIT',32}]); + 'enc_KmeSetForwardInfo'(element(2,Val), [<<48>>,<<162>>]); absentMessage -> - 'enc_KmeAbsentMessage'(element(2,Val), [{tag,128,3,'EXPLICIT',32}]); + 'enc_KmeAbsentMessage'(element(2,Val), [<<163>>]); passwordClear -> - ?RT_BER:encode_null(element(2,Val), [{tag,128,4,'EXPLICIT',32}]); + encode_null(element(2,Val), [<<5>>,<<164>>]); extNumber -> - ?RT_BER:encode_restricted_string([], element(2,Val), 22, [{tag,128,5,'EXPLICIT',32}]); + encode_restricted_string(element(2,Val), [<<22>>,<<165>>]); extName -> - 'enc_KmeExtName'(element(2,Val), [{tag,128,6,'EXPLICIT',32}]); + 'enc_KmeExtName'(element(2,Val), [<<166>>]); cos -> - ?RT_BER:encode_integer([], element(2,Val), [{tag,128,7,'EXPLICIT',32}]); + encode_integer(element(2,Val), [<<2>>,<<167>>]); joinGroup -> - 'CSTA-device-identifiers':'enc_DeviceID'(element(2,Val), [{tag,128,8,'EXPLICIT',32}]); + 'CSTA-device-identifiers':'enc_DeviceID'(element(2,Val), [<<48>>,<<168>>]); leaveGroup -> - 'CSTA-device-identifiers':'enc_DeviceID'(element(2,Val), [{tag,128,9,'EXPLICIT',32}]); + 'CSTA-device-identifiers':'enc_DeviceID'(element(2,Val), [<<48>>,<<169>>]); inService -> - ?RT_BER:encode_boolean(element(2,Val), [{tag,128,10,'EXPLICIT',32}]); + encode_boolean(element(2,Val), [<<1>>,<<170>>]); fcoKey -> - 'enc_KmeFcoKeyList'(element(2,Val), [{tag,128,11,'EXPLICIT',32}]); + 'enc_KmeFcoKeyList'(element(2,Val), [<<48>>,<<171>>]); + Else -> + exit({error,{asn1,{invalid_choice_type,Else}}}) + end, + +encode_tags(TagIn, EncBytes, EncLen). + + + + + +%%================================ +%% KmeSetSystemData_acdQueue +%%================================ +'enc_KmeSetSystemData_acdQueue'(Val, TagIn) -> + {_,Cindex1, Cindex2} = Val, + +%%------------------------------------------------- +%% attribute device(1) External CSTA-device-identifiers:DeviceID +%%------------------------------------------------- + {EncBytes1,EncLen1} = 'CSTA-device-identifiers':'enc_DeviceID'(Cindex1, [<<48>>]), + +%%------------------------------------------------- +%% attribute attribute(2) with type CHOICE +%%------------------------------------------------- + {EncBytes2,EncLen2} = 'enc_KmeSetSystemData_acdQueue_attribute'(Cindex2, []), + + BytesSoFar = [EncBytes1, EncBytes2], +LenSoFar = EncLen1 + EncLen2, +encode_tags(TagIn, BytesSoFar, LenSoFar). + + + +%%================================ +%% KmeSetSystemData_acdQueue_attribute +%%================================ +'enc_KmeSetSystemData_acdQueue_attribute'(Val, TagIn) -> + {EncBytes,EncLen} = case element(1,Val) of + groupType -> + case element(2,Val) of +ucd -> encode_tags([<<10>>,<<161>>], [0], 1); +ring -> encode_tags([<<10>>,<<161>>], [1], 1); +hunt -> encode_tags([<<10>>,<<161>>], [2], 1); +Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}}) +end; + acdMode -> + encode_boolean(element(2,Val), [<<1>>]); + ctiWaitTime -> + encode_integer(element(2,Val), [<<2>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). +encode_tags(TagIn, EncBytes, EncLen). -'dec_KmeSetSystemData_deviceData_sysData'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of -%% 'wakeUp' - <<2:2,_:1,0:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeWakeUpInfo'(Bytes1, mandatory, [{tag,128,0,'EXPLICIT',32}]), - {{wakeUp, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; +'dec_KmeSetSystemData'(Tlv) -> + 'dec_KmeSetSystemData'(Tlv, []). -%% 'remoteLock' - <<2:2,_:1,1:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_enumerated(Bytes1,[],[{lock,0},{unlock,1}],[{tag,128,1,'EXPLICIT',32}], mandatory), - {{remoteLock, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; +'dec_KmeSetSystemData'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of +%% 'systemData' + {131072, V1} -> + {systemData, 'dec_KmeSetSystemData_systemData'(V1, [])}; -%% 'forwardDnd' - <<2:2,_:1,2:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeSetForwardInfo'(Bytes1, mandatory, [{tag,128,2,'EXPLICIT',32}]), - {{forwardDnd, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; +%% 'deviceData' + {131073, V1} -> + {deviceData, 'dec_KmeSetSystemData_deviceData'(V1, [16])}; -%% 'absentMessage' - <<2:2,_:1,3:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeAbsentMessage'(Bytes1, mandatory, [{tag,128,3,'EXPLICIT',32}]), - {{absentMessage, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; +%% 'acdQueue' + {131075, V1} -> + {acdQueue, 'dec_KmeSetSystemData_acdQueue'(V1, [16])}; -%% 'passwordClear' - <<2:2,_:1,4:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_null(Bytes1,[{tag,128,4,'EXPLICIT',32}], mandatory), - {{passwordClear, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + Else -> + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. +'dec_KmeSetSystemData_systemData'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of +%% 'speedDial' + {131072, V1} -> + {speedDial, 'dec_KmeSpeedDial'(V1, [16])}; -%% 'extNumber' - <<2:2,_:1,5:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_restricted_string(Bytes1,{1,5},22,[{tag,128,5,'EXPLICIT',32}], no_length, mandatory), - {{extNumber, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; +%% 'dayNightMode' + {131073, V1} -> + {dayNightMode, 'dec_KmeDayNightMode'(V1, [16])}; -%% 'extName' - <<2:2,_:1,6:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeExtName'(Bytes1, mandatory, [{tag,128,6,'EXPLICIT',32}]), - {{extName, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; +%% 'time' + {131074, V1} -> + {time, begin +binary_to_list(decode_restricted_string(V1, [24])) +end +}; -%% 'cos' - <<2:2,_:1,7:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_integer(Bytes1,[],[{tag,128,7,'EXPLICIT',32}], mandatory), - {{cos, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; +%% 'extNo' + {131075, V1} -> + {extNo, 'dec_KmeChangeExtNo'(V1, [16])}; -%% 'joinGroup' - <<2:2,_:1,8:5,_/binary>> -> - {Dec, Rest, RbCho} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes1, mandatory, [{tag,128,8,'EXPLICIT',32}]), - {{joinGroup, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; +%% 'name' + {131076, V1} -> + {name, 'dec_KmeChangeName'(V1, [16])}; -%% 'leaveGroup' - <<2:2,_:1,9:5,_/binary>> -> - {Dec, Rest, RbCho} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes1, mandatory, [{tag,128,9,'EXPLICIT',32}]), - {{leaveGroup, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; +%% 'subdomainName' + {131077, V1} -> + {subdomainName, begin +Val1 = decode_restricted_string(V1, [22]), +C1 = byte_size(Val1), +if 0 =< C1, C1 =< 20 -> +binary_to_list(Val1); +true -> +exit({error,{asn1,bad_range}}) +end +end}; -%% 'inService' - <<2:2,_:1,10:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_boolean(Bytes1,[{tag,128,10,'EXPLICIT',32}], mandatory), - {{inService, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; +%% 'tenantSpeedDial' + {131078, V1} -> + {tenantSpeedDial, 'dec_KmeTenantSpeedDial'(V1, [16])}; -%% 'fcoKey' - <<2:2,_:1,11:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeFcoKeyList'(Bytes1, mandatory, [{tag,128,11,'EXPLICIT',32}]), - {{fcoKey, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + +%% 'distributionMethod' + {131079, V1} -> + {distributionMethod, 'dec_KmeDistributionMethod'(V1, [16])}; Else -> - case OptOrMand of - mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}}); - _ ->exit({error,{asn1,{no_optional_tag,Else}}}) - end - end. -'dec_KmeSetSystemData_deviceData'(Bytes, OptOrMand, TagIn) -> + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. +'dec_KmeSetSystemData_deviceData'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 External CSTA-device-identifiers:DeviceID +%% attribute device(1) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {Term1,Bytes3,Rb2} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes2, mandatory, [{tag,128,1,'EXPLICIT',32}]), +[V1|Tlv2] = Tlv1, +Term1 = 'CSTA-device-identifiers':'dec_DeviceID'(V1, [131073,16]), %%------------------------------------------------- -%% attribute number 2 with type CHOICE +%% attribute sysData(2) with type CHOICE %%------------------------------------------------- - {Term2,Bytes4,Rb3} = 'dec_KmeSetSystemData_deviceData_sysData'(Bytes3, mandatory, [{tag,128,2,'EXPLICIT',32}]), +[V2|Tlv3] = Tlv2, +Term2 = 'dec_KmeSetSystemData_deviceData_sysData'(V2, [131074]), - {Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext), - {{'KmeSetSystemData_deviceData', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}. +case Tlv3 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed +end, + {'KmeSetSystemData_deviceData', Term1, Term2}. +'dec_KmeSetSystemData_deviceData_sysData'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of +%% 'wakeUp' + {131072, V1} -> + {wakeUp, 'dec_KmeWakeUpInfo'(V1, [16])}; -%%================================ -%% KmeSetSystemData_acdQueue -%%================================ -'enc_KmeSetSystemData_acdQueue'(Val, TagIn) -> - -%%------------------------------------------------- -%% attribute number 1 External CSTA-device-identifiers:DeviceID -%%------------------------------------------------- - {EncBytes1,EncLen1} = 'CSTA-device-identifiers':'enc_DeviceID'(?RT_BER:cindex(2,Val,device), []), -%%------------------------------------------------- -%% attribute number 2 with type CHOICE -%%------------------------------------------------- - {EncBytes2,EncLen2} = 'enc_KmeSetSystemData_acdQueue_attribute'(?RT_BER:cindex(3,Val,attribute), []), +%% 'remoteLock' + {131073, V1} -> + {remoteLock, case decode_integer(V1, [10]) of +0 -> lock; +1 -> unlock; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end}; - BytesSoFar = [EncBytes1, EncBytes2], - LenSoFar = EncLen1 + EncLen2, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +%% 'forwardDnd' + {131074, V1} -> + {forwardDnd, 'dec_KmeSetForwardInfo'(V1, [16])}; -%%================================ -%% KmeSetSystemData_acdQueue_attribute -%%================================ +%% 'absentMessage' + {131075, V1} -> + {absentMessage, 'dec_KmeAbsentMessage'(V1, [])}; -'enc_KmeSetSystemData_acdQueue_attribute'({'KmeSetSystemData_acdQueue_attribute',Val}, TagIn) -> - 'enc_KmeSetSystemData_acdQueue_attribute'(Val, TagIn); -'enc_KmeSetSystemData_acdQueue_attribute'(Val, TagIn) -> - {EncBytes,EncLen} = case element(1,Val) of - groupType -> - case (case element(2,Val) of {_,Enumval1}->Enumval1;_->element(2,Val) end) of -ucd -> ?RT_BER:encode_enumerated(0,[{tag,128,1,'EXPLICIT',32}]); -ring -> ?RT_BER:encode_enumerated(1,[{tag,128,1,'EXPLICIT',32}]); -hunt -> ?RT_BER:encode_enumerated(2,[{tag,128,1,'EXPLICIT',32}]); -Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) -end; - acdMode -> - ?RT_BER:encode_boolean(element(2,Val), []); - ctiWaitTime -> - ?RT_BER:encode_integer([], element(2,Val), []); - Else -> - exit({error,{asn1,{invalid_choice_type,Else}}}) - end, +%% 'passwordClear' + {131076, V1} -> + {passwordClear, decode_null(V1, [5])}; -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). +%% 'extNumber' + {131077, V1} -> + {extNumber, begin +Val1 = decode_restricted_string(V1, [22]), +C1 = byte_size(Val1), +if 1 =< C1, C1 =< 5 -> +binary_to_list(Val1); +true -> +exit({error,{asn1,bad_range}}) +end +end}; -'dec_KmeSetSystemData_acdQueue_attribute'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of -%% 'groupType' - <<2:2,_:1,1:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_enumerated(Bytes1,[],[{ucd,0},{ring,1},{hunt,2}],[{tag,128,1,'EXPLICIT',32}], mandatory), - {{groupType, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; +%% 'extName' + {131078, V1} -> + {extName, 'dec_KmeExtName'(V1, [])}; -%% 'acdMode' - <<0:2,_:1,1:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_boolean(Bytes1,[], mandatory), - {{acdMode, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; +%% 'cos' + {131079, V1} -> + {cos, decode_integer(V1, [2])}; -%% 'ctiWaitTime' - <<0:2,_:1,2:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_integer(Bytes1,[],[], mandatory), - {{ctiWaitTime, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; +%% 'joinGroup' + {131080, V1} -> + {joinGroup, 'CSTA-device-identifiers':'dec_DeviceID'(V1, [16])}; + + +%% 'leaveGroup' + {131081, V1} -> + {leaveGroup, 'CSTA-device-identifiers':'dec_DeviceID'(V1, [16])}; + + +%% 'inService' + {131082, V1} -> + {inService, decode_boolean(V1, [1])}; + + +%% 'fcoKey' + {131083, V1} -> + {fcoKey, 'dec_KmeFcoKeyList'(V1, [16])}; Else -> - case OptOrMand of - mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}}); - _ ->exit({error,{asn1,{no_optional_tag,Else}}}) - end - end. -'dec_KmeSetSystemData_acdQueue'(Bytes, OptOrMand, TagIn) -> + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. +'dec_KmeSetSystemData_acdQueue'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 External CSTA-device-identifiers:DeviceID +%% attribute device(1) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {Term1,Bytes3,Rb2} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes2, mandatory, []), +[V1|Tlv2] = Tlv1, +Term1 = 'CSTA-device-identifiers':'dec_DeviceID'(V1, [16]), %%------------------------------------------------- -%% attribute number 2 with type CHOICE +%% attribute attribute(2) with type CHOICE %%------------------------------------------------- - {Term2,Bytes4,Rb3} = 'dec_KmeSetSystemData_acdQueue_attribute'(Bytes3, mandatory, []), - - {Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext), - {{'KmeSetSystemData_acdQueue', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}. +[V2|Tlv3] = Tlv2, +Term2 = 'dec_KmeSetSystemData_acdQueue_attribute'(V2, []), +case Tlv3 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed +end, + {'KmeSetSystemData_acdQueue', Term1, Term2}. -'dec_KmeSetSystemData'(Bytes, OptOrMand) -> - 'dec_KmeSetSystemData'(Bytes, OptOrMand, []). - -'dec_KmeSetSystemData'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of +'dec_KmeSetSystemData_acdQueue_attribute'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of -%% 'systemData' - <<2:2,_:1,0:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeSetSystemData_systemData'(Bytes1, mandatory, [{tag,128,0,'EXPLICIT',32}]), - {{systemData, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; +%% 'groupType' + {131073, V1} -> + {groupType, case decode_integer(V1, [10]) of +0 -> ucd; +1 -> ring; +2 -> hunt; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end}; -%% 'deviceData' - <<2:2,_:1,1:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeSetSystemData_deviceData'(Bytes1, mandatory, [{tag,128,1,'EXPLICIT',32}]), - {{deviceData, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; +%% 'acdMode' + {1, V1} -> + {acdMode, decode_boolean(V1, [])}; -%% 'acdQueue' - <<2:2,_:1,3:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeSetSystemData_acdQueue'(Bytes1, mandatory, [{tag,128,3,'EXPLICIT',32}]), - {{acdQueue, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; +%% 'ctiWaitTime' + {2, V1} -> + {ctiWaitTime, decode_integer(V1, [])}; Else -> - case OptOrMand of - mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}}); - _ ->exit({error,{asn1,{no_optional_tag,Else}}}) - end - end. + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. %%================================ %% KmeSystemDataChanged %%================================ - -'enc_KmeSystemDataChanged'({'KmeSystemDataChanged',Val}, TagIn) -> - 'enc_KmeSystemDataChanged'(Val, TagIn); +'enc_KmeSystemDataChanged'(Val) -> + 'enc_KmeSystemDataChanged'(Val, []). 'enc_KmeSystemDataChanged'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of systemData -> - case (case element(2,Val) of {_,Enumval1}->Enumval1;_->element(2,Val) end) of -featureList -> ?RT_BER:encode_enumerated(1,[{tag,128,0,'EXPLICIT',32}]); -speedDial -> ?RT_BER:encode_enumerated(2,[{tag,128,0,'EXPLICIT',32}]); -trunkGroup -> ?RT_BER:encode_enumerated(3,[{tag,128,0,'EXPLICIT',32}]); -extGroup -> ?RT_BER:encode_enumerated(4,[{tag,128,0,'EXPLICIT',32}]); -pickGroup -> ?RT_BER:encode_enumerated(5,[{tag,128,0,'EXPLICIT',32}]); -pagingGroup -> ?RT_BER:encode_enumerated(6,[{tag,128,0,'EXPLICIT',32}]); -incomingGroup -> ?RT_BER:encode_enumerated(7,[{tag,128,0,'EXPLICIT',32}]); -dayNightMode -> ?RT_BER:encode_enumerated(8,[{tag,128,0,'EXPLICIT',32}]); -doorPhone -> ?RT_BER:encode_enumerated(9,[{tag,128,0,'EXPLICIT',32}]); -vmGroup -> ?RT_BER:encode_enumerated(10,[{tag,128,0,'EXPLICIT',32}]); -systemTime -> ?RT_BER:encode_enumerated(11,[{tag,128,0,'EXPLICIT',32}]); -psGroup -> ?RT_BER:encode_enumerated(12,[{tag,128,0,'EXPLICIT',32}]); -trunkGMembers -> ?RT_BER:encode_enumerated(13,[{tag,128,0,'EXPLICIT',32}]); -incomingGMembers -> ?RT_BER:encode_enumerated(14,[{tag,128,0,'EXPLICIT',32}]); -psGMembers -> ?RT_BER:encode_enumerated(15,[{tag,128,0,'EXPLICIT',32}]); -vmGMembers -> ?RT_BER:encode_enumerated(16,[{tag,128,0,'EXPLICIT',32}]); -broadcastGroup -> ?RT_BER:encode_enumerated(17,[{tag,128,0,'EXPLICIT',32}]); -broadcastGMembers -> ?RT_BER:encode_enumerated(18,[{tag,128,0,'EXPLICIT',32}]); -subdomainName -> ?RT_BER:encode_enumerated(19,[{tag,128,0,'EXPLICIT',32}]); -externalSensor -> ?RT_BER:encode_enumerated(20,[{tag,128,0,'EXPLICIT',32}]); -svm -> ?RT_BER:encode_enumerated(21,[{tag,128,0,'EXPLICIT',32}]); -Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) + case element(2,Val) of +featureList -> encode_tags([<<10>>,<<160>>], [1], 1); +speedDial -> encode_tags([<<10>>,<<160>>], [2], 1); +trunkGroup -> encode_tags([<<10>>,<<160>>], [3], 1); +extGroup -> encode_tags([<<10>>,<<160>>], [4], 1); +pickGroup -> encode_tags([<<10>>,<<160>>], [5], 1); +pagingGroup -> encode_tags([<<10>>,<<160>>], [6], 1); +incomingGroup -> encode_tags([<<10>>,<<160>>], [7], 1); +dayNightMode -> encode_tags([<<10>>,<<160>>], [8], 1); +doorPhone -> encode_tags([<<10>>,<<160>>], [9], 1); +vmGroup -> encode_tags([<<10>>,<<160>>], [10], 1); +systemTime -> encode_tags([<<10>>,<<160>>], [11], 1); +psGroup -> encode_tags([<<10>>,<<160>>], [12], 1); +trunkGMembers -> encode_tags([<<10>>,<<160>>], [13], 1); +incomingGMembers -> encode_tags([<<10>>,<<160>>], [14], 1); +psGMembers -> encode_tags([<<10>>,<<160>>], [15], 1); +vmGMembers -> encode_tags([<<10>>,<<160>>], [16], 1); +broadcastGroup -> encode_tags([<<10>>,<<160>>], [17], 1); +broadcastGMembers -> encode_tags([<<10>>,<<160>>], [18], 1); +subdomainName -> encode_tags([<<10>>,<<160>>], [19], 1); +externalSensor -> encode_tags([<<10>>,<<160>>], [20], 1); +svm -> encode_tags([<<10>>,<<160>>], [21], 1); +Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}}) end; deviceData -> - 'enc_KmeSystemDataChanged_deviceData'(element(2,Val), [{tag,128,1,'EXPLICIT',32}]); + 'enc_KmeSystemDataChanged_deviceData'(element(2,Val), [<<48>>,<<161>>]); deviceBasicInfo -> - 'CSTA-device-identifiers':'enc_DeviceID'(element(2,Val), [{tag,128,2,'EXPLICIT',32}]); + 'CSTA-device-identifiers':'enc_DeviceID'(element(2,Val), [<<48>>,<<162>>]); reconfiguration -> - ?RT_BER:encode_null(element(2,Val), [{tag,128,3,'EXPLICIT',32}]); + encode_null(element(2,Val), [<<5>>,<<163>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). +encode_tags(TagIn, EncBytes, EncLen). @@ -8050,222 +8666,268 @@ end; %% KmeSystemDataChanged_deviceData %%================================ 'enc_KmeSystemDataChanged_deviceData'(Val, TagIn) -> - + {_,Cindex1, Cindex2} = Val, + %%------------------------------------------------- -%% attribute number 1 External CSTA-device-identifiers:DeviceID +%% attribute device(1) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {EncBytes1,EncLen1} = 'CSTA-device-identifiers':'enc_DeviceID'(?RT_BER:cindex(2,Val,device), [{tag,128,0,'EXPLICIT',32}]), + {EncBytes1,EncLen1} = 'CSTA-device-identifiers':'enc_DeviceID'(Cindex1, [<<48>>,<<160>>]), %%------------------------------------------------- -%% attribute number 2 with type ENUMERATED +%% attribute sysData(2) with type ENUMERATED %%------------------------------------------------- - {EncBytes2,EncLen2} = case (case ?RT_BER:cindex(3,Val,sysData) of {_,Enumval1}->Enumval1;_->?RT_BER:cindex(3,Val,sysData) end) of -wakeUp -> ?RT_BER:encode_enumerated(0,[{tag,128,1,'EXPLICIT',32}]); -remoteStatationLock -> ?RT_BER:encode_enumerated(1,[{tag,128,1,'EXPLICIT',32}]); -callLogLock -> ?RT_BER:encode_enumerated(2,[{tag,128,1,'EXPLICIT',32}]); -absentMessage -> ?RT_BER:encode_enumerated(3,[{tag,128,1,'EXPLICIT',32}]); -forwardDnd -> ?RT_BER:encode_enumerated(4,[{tag,128,1,'EXPLICIT',32}]); -cos -> ?RT_BER:encode_enumerated(5,[{tag,128,1,'EXPLICIT',32}]); -extName -> ?RT_BER:encode_enumerated(6,[{tag,128,1,'EXPLICIT',32}]); -assocExtGroup -> ?RT_BER:encode_enumerated(7,[{tag,128,1,'EXPLICIT',32}]); -fcoKey -> ?RT_BER:encode_enumerated(8,[{tag,128,1,'EXPLICIT',32}]); -sxdpMaster -> ?RT_BER:encode_enumerated(9,[{tag,128,1,'EXPLICIT',32}]); -Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) + {EncBytes2,EncLen2} = case Cindex2 of +wakeUp -> encode_tags([<<10>>,<<161>>], [0], 1); +remoteStatationLock -> encode_tags([<<10>>,<<161>>], [1], 1); +callLogLock -> encode_tags([<<10>>,<<161>>], [2], 1); +absentMessage -> encode_tags([<<10>>,<<161>>], [3], 1); +forwardDnd -> encode_tags([<<10>>,<<161>>], [4], 1); +cos -> encode_tags([<<10>>,<<161>>], [5], 1); +extName -> encode_tags([<<10>>,<<161>>], [6], 1); +assocExtGroup -> encode_tags([<<10>>,<<161>>], [7], 1); +fcoKey -> encode_tags([<<10>>,<<161>>], [8], 1); +sxdpMaster -> encode_tags([<<10>>,<<161>>], [9], 1); +Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}}) end, BytesSoFar = [EncBytes1, EncBytes2], - LenSoFar = EncLen1 + EncLen2, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). -'dec_KmeSystemDataChanged_deviceData'(Bytes, OptOrMand, TagIn) -> - %%------------------------------------------------- - %% decode tag and length - %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), - -%%------------------------------------------------- -%% attribute number 1 External CSTA-device-identifiers:DeviceID -%%------------------------------------------------- - {Term1,Bytes3,Rb2} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes2, mandatory, [{tag,128,0,'EXPLICIT',32}]), - -%%------------------------------------------------- -%% attribute number 2 with type ENUMERATED -%%------------------------------------------------- - {Term2,Bytes4,Rb3} = ?RT_BER:decode_enumerated(Bytes3,[],[{wakeUp,0},{remoteStatationLock,1},{callLogLock,2},{absentMessage,3},{forwardDnd,4},{cos,5},{extName,6},{assocExtGroup,7},{fcoKey,8},{sxdpMaster,9}],[{tag,128,1,'EXPLICIT',32}], mandatory), +LenSoFar = EncLen1 + EncLen2, +encode_tags(TagIn, BytesSoFar, LenSoFar). - {Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext), - {{'KmeSystemDataChanged_deviceData', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}. +'dec_KmeSystemDataChanged'(Tlv) -> + 'dec_KmeSystemDataChanged'(Tlv, []). -'dec_KmeSystemDataChanged'(Bytes, OptOrMand) -> - 'dec_KmeSystemDataChanged'(Bytes, OptOrMand, []). - -'dec_KmeSystemDataChanged'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of +'dec_KmeSystemDataChanged'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of %% 'systemData' - <<2:2,_:1,0:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_enumerated(Bytes1,[],[{featureList,1},{speedDial,2},{trunkGroup,3},{extGroup,4},{pickGroup,5},{pagingGroup,6},{incomingGroup,7},{dayNightMode,8},{doorPhone,9},{vmGroup,10},{systemTime,11},{psGroup,12},{trunkGMembers,13},{incomingGMembers,14},{psGMembers,15},{vmGMembers,16},{broadcastGroup,17},{broadcastGMembers,18},{subdomainName,19},{externalSensor,20},{svm,21}],[{tag,128,0,'EXPLICIT',32}], mandatory), - {{systemData, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131072, V1} -> + {systemData, case decode_integer(V1, [10]) of +1 -> featureList; +2 -> speedDial; +3 -> trunkGroup; +4 -> extGroup; +5 -> pickGroup; +6 -> pagingGroup; +7 -> incomingGroup; +8 -> dayNightMode; +9 -> doorPhone; +10 -> vmGroup; +11 -> systemTime; +12 -> psGroup; +13 -> trunkGMembers; +14 -> incomingGMembers; +15 -> psGMembers; +16 -> vmGMembers; +17 -> broadcastGroup; +18 -> broadcastGMembers; +19 -> subdomainName; +20 -> externalSensor; +21 -> svm; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end}; %% 'deviceData' - <<2:2,_:1,1:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeSystemDataChanged_deviceData'(Bytes1, mandatory, [{tag,128,1,'EXPLICIT',32}]), - {{deviceData, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131073, V1} -> + {deviceData, 'dec_KmeSystemDataChanged_deviceData'(V1, [16])}; %% 'deviceBasicInfo' - <<2:2,_:1,2:5,_/binary>> -> - {Dec, Rest, RbCho} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes1, mandatory, [{tag,128,2,'EXPLICIT',32}]), - {{deviceBasicInfo, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131074, V1} -> + {deviceBasicInfo, 'CSTA-device-identifiers':'dec_DeviceID'(V1, [16])}; %% 'reconfiguration' - <<2:2,_:1,3:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_null(Bytes1,[{tag,128,3,'EXPLICIT',32}], mandatory), - {{reconfiguration, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131075, V1} -> + {reconfiguration, decode_null(V1, [5])}; Else -> - case OptOrMand of - mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}}); - _ ->exit({error,{asn1,{no_optional_tag,Else}}}) - end - end. + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. +'dec_KmeSystemDataChanged_deviceData'(Tlv, TagIn) -> + %%------------------------------------------------- + %% decode tag and length + %%------------------------------------------------- +Tlv1 = match_tags(Tlv, TagIn), + +%%------------------------------------------------- +%% attribute device(1) External CSTA-device-identifiers:DeviceID +%%------------------------------------------------- +[V1|Tlv2] = Tlv1, +Term1 = 'CSTA-device-identifiers':'dec_DeviceID'(V1, [131072,16]), + +%%------------------------------------------------- +%% attribute sysData(2) with type ENUMERATED +%%------------------------------------------------- +[V2|Tlv3] = Tlv2, +Term2 = case decode_integer(V2, [131073,10]) of +0 -> wakeUp; +1 -> remoteStatationLock; +2 -> callLogLock; +3 -> absentMessage; +4 -> forwardDnd; +5 -> cos; +6 -> extName; +7 -> assocExtGroup; +8 -> fcoKey; +9 -> sxdpMaster; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end, + +case Tlv3 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed +end, + {'KmeSystemDataChanged_deviceData', Term1, Term2}. + %%================================ %% KmeSystemDataLinkedReply %%================================ +'enc_KmeSystemDataLinkedReply'(Val) -> + 'enc_KmeSystemDataLinkedReply'(Val, [<<48>>]). + 'enc_KmeSystemDataLinkedReply'(Val, TagIn) -> +{_,Cindex1, Cindex2, Cindex3, Cindex4} = Val, %%------------------------------------------------- -%% attribute number 1 with type OCTET STRING +%% attribute crossRefID(1) with type OCTET STRING %%------------------------------------------------- - {EncBytes1,EncLen1} = ?RT_BER:encode_octet_string([], ?RT_BER:cindex(2,Val,crossRefID), [{tag,128,0,'EXPLICIT',32}]), + {EncBytes1,EncLen1} = encode_restricted_string(Cindex1, [<<4>>,<<160>>]), %%------------------------------------------------- -%% attribute number 2 with type INTEGER +%% attribute segmentID(2) with type INTEGER %%------------------------------------------------- - {EncBytes2,EncLen2} = ?RT_BER:encode_integer([], ?RT_BER:cindex(3,Val,segmentID), [{tag,128,1,'EXPLICIT',32}]), + {EncBytes2,EncLen2} = encode_integer(Cindex2, [<<2>>,<<161>>]), %%------------------------------------------------- -%% attribute number 3 with type BOOLEAN +%% attribute lastSegment(3) with type BOOLEAN %%------------------------------------------------- - {EncBytes3,EncLen3} = ?RT_BER:encode_boolean(?RT_BER:cindex(4,Val,lastSegment), [{tag,128,2,'EXPLICIT',32}]), + {EncBytes3,EncLen3} = encode_boolean(Cindex3, [<<1>>,<<162>>]), %%------------------------------------------------- -%% attribute number 4 External KME-specific-types:KmeGetSystemDataRsp OPTIONAL +%% attribute sysData(4) External KME-specific-types:KmeGetSystemDataRsp OPTIONAL %%------------------------------------------------- - {EncBytes4,EncLen4} = case ?RT_BER:cindex(5,Val,sysData) of + {EncBytes4,EncLen4} = case Cindex4 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_KmeGetSystemDataRsp'(?RT_BER:cindex(5,Val,sysData), [{tag,128,3,'EXPLICIT',32}]) + 'enc_KmeGetSystemDataRsp'(Cindex4, [<<48>>,<<163>>]) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4], - LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4, +encode_tags(TagIn, BytesSoFar, LenSoFar). -'dec_KmeSystemDataLinkedReply'(Bytes, OptOrMand) -> - 'dec_KmeSystemDataLinkedReply'(Bytes, OptOrMand, []). +'dec_KmeSystemDataLinkedReply'(Tlv) -> + 'dec_KmeSystemDataLinkedReply'(Tlv, [16]). -'dec_KmeSystemDataLinkedReply'(Bytes, OptOrMand, TagIn) -> +'dec_KmeSystemDataLinkedReply'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 with type OCTET STRING +%% attribute crossRefID(1) with type OCTET STRING %%------------------------------------------------- - {Term1,Bytes3,Rb2} = ?RT_BER:decode_octet_string(Bytes2,[],[{tag,128,0,'EXPLICIT',32}], no_length, mandatory), +[V1|Tlv2] = Tlv1, +Term1 = decode_octet_string(V1, [131072,4]), %%------------------------------------------------- -%% attribute number 2 with type INTEGER +%% attribute segmentID(2) with type INTEGER %%------------------------------------------------- - {Term2,Bytes4,Rb3} = ?RT_BER:decode_integer(Bytes3,[],[{tag,128,1,'EXPLICIT',32}], mandatory), +[V2|Tlv3] = Tlv2, +Term2 = decode_integer(V2, [131073,2]), %%------------------------------------------------- -%% attribute number 3 with type BOOLEAN +%% attribute lastSegment(3) with type BOOLEAN %%------------------------------------------------- - {Term3,Bytes5,Rb4} = ?RT_BER:decode_boolean(Bytes4,[{tag,128,2,'EXPLICIT',32}], mandatory), +[V3|Tlv4] = Tlv3, +Term3 = decode_boolean(V3, [131074,1]), %%------------------------------------------------- -%% attribute number 4 External KME-specific-types:KmeGetSystemDataRsp OPTIONAL +%% attribute sysData(4) External KME-specific-types:KmeGetSystemDataRsp OPTIONAL %%------------------------------------------------- - {Term4,Bytes6,Rb5} = case Bytes5 of -<<2:2,_:1,3:5,_/binary>> -> -'dec_KmeGetSystemDataRsp'(Bytes5, opt_or_default, [{tag,128,3,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes5, 0 } +{Term4,Tlv5} = case Tlv4 of +[{131075,V4}|TempTlv5] -> + {'dec_KmeGetSystemDataRsp'(V4, [16]), TempTlv5}; + _ -> + { asn1_NOVALUE, Tlv4} +end, + +case Tlv5 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv5}}}) % extra fields not allowed end, + {'KmeSystemDataLinkedReply', Term1, Term2, Term3, Term4}. - {Bytes7,Rb6} = ?RT_BER:restbytes2(RemBytes, Bytes6,noext), - {{'KmeSystemDataLinkedReply', Term1, Term2, Term3, Term4}, Bytes7, Rb1+Rb2+Rb3+Rb4+Rb5+Rb6}. %%================================ %% KmeGetSystemDataPosAck %%================================ - -'enc_KmeGetSystemDataPosAck'({'KmeGetSystemDataPosAck',Val}, TagIn) -> - 'enc_KmeGetSystemDataPosAck'(Val, TagIn); +'enc_KmeGetSystemDataPosAck'(Val) -> + 'enc_KmeGetSystemDataPosAck'(Val, [<<4>>]). 'enc_KmeGetSystemDataPosAck'(Val, TagIn) -> -?RT_BER:encode_octet_string([], Val, TagIn ++ []). +encode_restricted_string(Val, TagIn). -'dec_KmeGetSystemDataPosAck'(Bytes, OptOrMand) -> - 'dec_KmeGetSystemDataPosAck'(Bytes, OptOrMand, []). +'dec_KmeGetSystemDataPosAck'(Tlv) -> + 'dec_KmeGetSystemDataPosAck'(Tlv, [4]). -'dec_KmeGetSystemDataPosAck'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_octet_string(Bytes,[],TagIn++[], no_length, OptOrMand). +'dec_KmeGetSystemDataPosAck'(Tlv, TagIn) -> +decode_octet_string(Tlv, TagIn). %%================================ %% KmeSystemCrossRefID %%================================ - -'enc_KmeSystemCrossRefID'({'KmeSystemCrossRefID',Val}, TagIn) -> - 'enc_KmeSystemCrossRefID'(Val, TagIn); +'enc_KmeSystemCrossRefID'(Val) -> + 'enc_KmeSystemCrossRefID'(Val, [<<4>>]). 'enc_KmeSystemCrossRefID'(Val, TagIn) -> -?RT_BER:encode_octet_string([], Val, TagIn ++ []). +encode_restricted_string(Val, TagIn). -'dec_KmeSystemCrossRefID'(Bytes, OptOrMand) -> - 'dec_KmeSystemCrossRefID'(Bytes, OptOrMand, []). +'dec_KmeSystemCrossRefID'(Tlv) -> + 'dec_KmeSystemCrossRefID'(Tlv, [4]). -'dec_KmeSystemCrossRefID'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_octet_string(Bytes,4,TagIn++[], no_length, OptOrMand). +'dec_KmeSystemCrossRefID'(Tlv, TagIn) -> +begin +Val1 = decode_octet_string(Tlv, TagIn), +C1 = byte_size(Val1), +if C1 =:= 4 -> +Val1; +true -> +exit({error,{asn1,bad_range}}) +end +end. %%================================ %% KmeLockSystemData %%================================ - -'enc_KmeLockSystemData'({'KmeLockSystemData',Val}, TagIn) -> - 'enc_KmeLockSystemData'(Val, TagIn); +'enc_KmeLockSystemData'(Val) -> + 'enc_KmeLockSystemData'(Val, []). 'enc_KmeLockSystemData'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of request -> - 'enc_KmeLockSystemData_request'(element(2,Val), []); + 'enc_KmeLockSystemData_request'(element(2,Val), [<<48>>]); lockResult -> - ?RT_BER:encode_octet_string([], element(2,Val), []); + encode_restricted_string(element(2,Val), [<<4>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). +encode_tags(TagIn, EncBytes, EncLen). @@ -8275,2228 +8937,2668 @@ end, %% KmeLockSystemData_request %%================================ 'enc_KmeLockSystemData_request'(Val, TagIn) -> - + {_,Cindex1, Cindex2} = Val, + %%------------------------------------------------- -%% attribute number 1 with type BOOLEAN +%% attribute systemDataLock(1) with type BOOLEAN %%------------------------------------------------- - {EncBytes1,EncLen1} = ?RT_BER:encode_boolean(?RT_BER:cindex(2,Val,systemDataLock), []), + {EncBytes1,EncLen1} = encode_boolean(Cindex1, [<<1>>]), %%------------------------------------------------- -%% attribute number 2 with type CHOICE +%% attribute id(2) with type CHOICE %%------------------------------------------------- - {EncBytes2,EncLen2} = 'enc_KmeLockSystemData_request_id'(?RT_BER:cindex(3,Val,id), []), + {EncBytes2,EncLen2} = 'enc_KmeLockSystemData_request_id'(Cindex2, []), BytesSoFar = [EncBytes1, EncBytes2], - LenSoFar = EncLen1 + EncLen2, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2, +encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% KmeLockSystemData_request_id %%================================ - -'enc_KmeLockSystemData_request_id'({'KmeLockSystemData_request_id',Val}, TagIn) -> - 'enc_KmeLockSystemData_request_id'(Val, TagIn); - 'enc_KmeLockSystemData_request_id'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of lock -> - 'CSTA-device-identifiers':'enc_DeviceID'(element(2,Val), []); + 'CSTA-device-identifiers':'enc_DeviceID'(element(2,Val), [<<48>>]); unlock -> - ?RT_BER:encode_octet_string([], element(2,Val), []); + encode_restricted_string(element(2,Val), [<<4>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). +encode_tags(TagIn, EncBytes, EncLen). -'dec_KmeLockSystemData_request_id'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of -%% 'lock' - <<0:2,_:1,16:5,_/binary>> -> - {Dec, Rest, RbCho} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes1, mandatory, []), - {{lock, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; +'dec_KmeLockSystemData'(Tlv) -> + 'dec_KmeLockSystemData'(Tlv, []). -%% 'unlock' - <<0:2,_:1,4:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_octet_string(Bytes1,4,[], no_length, mandatory), - {{unlock, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; +'dec_KmeLockSystemData'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of + +%% 'request' + {16, V1} -> + {request, 'dec_KmeLockSystemData_request'(V1, [])}; + + +%% 'lockResult' + {4, V1} -> + {lockResult, begin +Val1 = decode_octet_string(V1, []), +C1 = byte_size(Val1), +if C1 =:= 4 -> +Val1; +true -> +exit({error,{asn1,bad_range}}) +end +end}; Else -> - case OptOrMand of - mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}}); - _ ->exit({error,{asn1,{no_optional_tag,Else}}}) - end - end. -'dec_KmeLockSystemData_request'(Bytes, OptOrMand, TagIn) -> + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. +'dec_KmeLockSystemData_request'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 with type BOOLEAN +%% attribute systemDataLock(1) with type BOOLEAN %%------------------------------------------------- - {Term1,Bytes3,Rb2} = ?RT_BER:decode_boolean(Bytes2,[], mandatory), +[V1|Tlv2] = Tlv1, +Term1 = decode_boolean(V1, [1]), %%------------------------------------------------- -%% attribute number 2 with type CHOICE +%% attribute id(2) with type CHOICE %%------------------------------------------------- - {Term2,Bytes4,Rb3} = 'dec_KmeLockSystemData_request_id'(Bytes3, mandatory, []), - - {Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext), - {{'KmeLockSystemData_request', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}. +[V2|Tlv3] = Tlv2, +Term2 = 'dec_KmeLockSystemData_request_id'(V2, []), +case Tlv3 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed +end, + {'KmeLockSystemData_request', Term1, Term2}. -'dec_KmeLockSystemData'(Bytes, OptOrMand) -> - 'dec_KmeLockSystemData'(Bytes, OptOrMand, []). - -'dec_KmeLockSystemData'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of +'dec_KmeLockSystemData_request_id'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of -%% 'request' - <<0:2,_:1,16:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeLockSystemData_request'(Bytes1, mandatory, []), - {{request, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; +%% 'lock' + {16, V1} -> + {lock, 'CSTA-device-identifiers':'dec_DeviceID'(V1, [])}; -%% 'lockResult' - <<0:2,_:1,4:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_octet_string(Bytes1,4,[], no_length, mandatory), - {{lockResult, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; +%% 'unlock' + {4, V1} -> + {unlock, begin +Val1 = decode_octet_string(V1, []), +C1 = byte_size(Val1), +if C1 =:= 4 -> +Val1; +true -> +exit({error,{asn1,bad_range}}) +end +end}; Else -> - case OptOrMand of - mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}}); - _ ->exit({error,{asn1,{no_optional_tag,Else}}}) - end - end. + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. %%================================ %% KmeSystemDataStatus %%================================ +'enc_KmeSystemDataStatus'(Val) -> + 'enc_KmeSystemDataStatus'(Val, [<<48>>]). + 'enc_KmeSystemDataStatus'(Val, TagIn) -> +{_,Cindex1, Cindex2} = Val, %%------------------------------------------------- -%% attribute number 1 with type BOOLEAN +%% attribute systemDataLock(1) with type BOOLEAN %%------------------------------------------------- - {EncBytes1,EncLen1} = ?RT_BER:encode_boolean(?RT_BER:cindex(2,Val,systemDataLock), []), + {EncBytes1,EncLen1} = encode_boolean(Cindex1, [<<1>>]), %%------------------------------------------------- -%% attribute number 2 External CSTA-device-identifiers:DeviceID OPTIONAL +%% attribute lockingDevice(2) External CSTA-device-identifiers:DeviceID OPTIONAL %%------------------------------------------------- - {EncBytes2,EncLen2} = case ?RT_BER:cindex(3,Val,lockingDevice) of + {EncBytes2,EncLen2} = case Cindex2 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'CSTA-device-identifiers':'enc_DeviceID'(?RT_BER:cindex(3,Val,lockingDevice), []) + 'CSTA-device-identifiers':'enc_DeviceID'(Cindex2, [<<48>>]) end, BytesSoFar = [EncBytes1, EncBytes2], - LenSoFar = EncLen1 + EncLen2, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2, +encode_tags(TagIn, BytesSoFar, LenSoFar). -'dec_KmeSystemDataStatus'(Bytes, OptOrMand) -> - 'dec_KmeSystemDataStatus'(Bytes, OptOrMand, []). +'dec_KmeSystemDataStatus'(Tlv) -> + 'dec_KmeSystemDataStatus'(Tlv, [16]). -'dec_KmeSystemDataStatus'(Bytes, OptOrMand, TagIn) -> +'dec_KmeSystemDataStatus'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 with type BOOLEAN +%% attribute systemDataLock(1) with type BOOLEAN %%------------------------------------------------- - {Term1,Bytes3,Rb2} = ?RT_BER:decode_boolean(Bytes2,[], mandatory), +[V1|Tlv2] = Tlv1, +Term1 = decode_boolean(V1, [1]), %%------------------------------------------------- -%% attribute number 2 External CSTA-device-identifiers:DeviceID OPTIONAL +%% attribute lockingDevice(2) External CSTA-device-identifiers:DeviceID OPTIONAL %%------------------------------------------------- - {Term2,Bytes4,Rb3} = case Bytes3 of -<<0:2,_:1,16:5,_/binary>> -> -'CSTA-device-identifiers':'dec_DeviceID'(Bytes3, opt_or_default, []); -_ -> -{ asn1_NOVALUE, Bytes3, 0 } +{Term2,Tlv3} = case Tlv2 of +[{16,V2}|TempTlv3] -> + {'CSTA-device-identifiers':'dec_DeviceID'(V2, []), TempTlv3}; + _ -> + { asn1_NOVALUE, Tlv2} +end, + +case Tlv3 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed end, + {'KmeSystemDataStatus', Term1, Term2}. - {Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext), - {{'KmeSystemDataStatus', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}. %%================================ %% KmeSystemDataRevision %%================================ - -'enc_KmeSystemDataRevision'({'KmeSystemDataRevision',Val}, TagIn) -> - 'enc_KmeSystemDataRevision'(Val, TagIn); +'enc_KmeSystemDataRevision'(Val) -> + 'enc_KmeSystemDataRevision'(Val, [<<4>>]). 'enc_KmeSystemDataRevision'(Val, TagIn) -> -?RT_BER:encode_octet_string([], Val, TagIn ++ []). +encode_restricted_string(Val, TagIn). -'dec_KmeSystemDataRevision'(Bytes, OptOrMand) -> - 'dec_KmeSystemDataRevision'(Bytes, OptOrMand, []). +'dec_KmeSystemDataRevision'(Tlv) -> + 'dec_KmeSystemDataRevision'(Tlv, [4]). -'dec_KmeSystemDataRevision'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_octet_string(Bytes,{0,128},TagIn++[], no_length, OptOrMand). +'dec_KmeSystemDataRevision'(Tlv, TagIn) -> +begin +Val1 = decode_octet_string(Tlv, TagIn), +C1 = byte_size(Val1), +if 0 =< C1, C1 =< 128 -> +Val1; +true -> +exit({error,{asn1,bad_range}}) +end +end. %%================================ %% KmeGetSystemDataRevision %%================================ - -'enc_KmeGetSystemDataRevision'({'KmeGetSystemDataRevision',Val}, TagIn) -> - 'enc_KmeGetSystemDataRevision'(Val, TagIn); +'enc_KmeGetSystemDataRevision'(Val) -> + 'enc_KmeGetSystemDataRevision'(Val, []). 'enc_KmeGetSystemDataRevision'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of request -> - case (case element(2,Val) of {_,Enumval1}->Enumval1;_->element(2,Val) end) of -systemDataRevision -> ?RT_BER:encode_enumerated(0,[]); -speedDialRevision -> ?RT_BER:encode_enumerated(1,[]); -Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) + case element(2,Val) of +systemDataRevision -> encode_tags([<<10>>], [0], 1); +speedDialRevision -> encode_tags([<<10>>], [1], 1); +Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}}) end; result -> - ?RT_BER:encode_octet_string([], element(2,Val), []); + encode_restricted_string(element(2,Val), [<<4>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). +encode_tags(TagIn, EncBytes, EncLen). -'dec_KmeGetSystemDataRevision'(Bytes, OptOrMand) -> - 'dec_KmeGetSystemDataRevision'(Bytes, OptOrMand, []). +'dec_KmeGetSystemDataRevision'(Tlv) -> + 'dec_KmeGetSystemDataRevision'(Tlv, []). -'dec_KmeGetSystemDataRevision'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of +'dec_KmeGetSystemDataRevision'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of %% 'request' - <<0:2,_:1,10:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_enumerated(Bytes1,[],[{systemDataRevision,0},{speedDialRevision,1}],[], mandatory), - {{request, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {10, V1} -> + {request, case decode_integer(V1, []) of +0 -> systemDataRevision; +1 -> speedDialRevision; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end}; %% 'result' - <<0:2,_:1,4:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_octet_string(Bytes1,{0,128},[], no_length, mandatory), - {{result, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {4, V1} -> + {result, begin +Val1 = decode_octet_string(V1, []), +C1 = byte_size(Val1), +if 0 =< C1, C1 =< 128 -> +Val1; +true -> +exit({error,{asn1,bad_range}}) +end +end}; Else -> - case OptOrMand of - mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}}); - _ ->exit({error,{asn1,{no_optional_tag,Else}}}) - end - end. + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. %%================================ %% KmeRevisionType %%================================ - -'enc_KmeRevisionType'({'KmeRevisionType',Val}, TagIn) -> - 'enc_KmeRevisionType'(Val, TagIn); +'enc_KmeRevisionType'(Val) -> + 'enc_KmeRevisionType'(Val, [<<10>>]). 'enc_KmeRevisionType'(Val, TagIn) -> -case (case Val of {_,Enumval1}->Enumval1;_->Val end) of -systemDataRevision -> ?RT_BER:encode_enumerated(0,TagIn ++ []); -speedDialRevision -> ?RT_BER:encode_enumerated(1,TagIn ++ []); -Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) +case Val of +systemDataRevision -> encode_tags(TagIn, [0], 1); +speedDialRevision -> encode_tags(TagIn, [1], 1); +Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}}) end. -'dec_KmeRevisionType'(Bytes, OptOrMand) -> - 'dec_KmeRevisionType'(Bytes, OptOrMand, []). +'dec_KmeRevisionType'(Tlv) -> + 'dec_KmeRevisionType'(Tlv, [10]). -'dec_KmeRevisionType'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_enumerated(Bytes,[],[{systemDataRevision,0},{speedDialRevision,1}],TagIn++[], OptOrMand). +'dec_KmeRevisionType'(Tlv, TagIn) -> +case decode_integer(Tlv, TagIn) of +0 -> systemDataRevision; +1 -> speedDialRevision; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end. %%================================ %% ProgrammingEventOn %%================================ - -'enc_ProgrammingEventOn'({'ProgrammingEventOn',Val}, TagIn) -> - 'enc_ProgrammingEventOn'(Val, TagIn); +'enc_ProgrammingEventOn'(Val) -> + 'enc_ProgrammingEventOn'(Val, [<<1>>]). 'enc_ProgrammingEventOn'(Val, TagIn) -> -?RT_BER:encode_boolean(Val, TagIn ++ []). +encode_boolean(Val, TagIn). -'dec_ProgrammingEventOn'(Bytes, OptOrMand) -> - 'dec_ProgrammingEventOn'(Bytes, OptOrMand, []). +'dec_ProgrammingEventOn'(Tlv) -> + 'dec_ProgrammingEventOn'(Tlv, [1]). -'dec_ProgrammingEventOn'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_boolean(Bytes,TagIn++[], OptOrMand). +'dec_ProgrammingEventOn'(Tlv, TagIn) -> +decode_boolean(Tlv, TagIn). %%================================ %% KmeSetProgrammingEventOn %%================================ - -'enc_KmeSetProgrammingEventOn'({'KmeSetProgrammingEventOn',Val}, TagIn) -> - 'enc_KmeSetProgrammingEventOn'(Val, TagIn); +'enc_KmeSetProgrammingEventOn'(Val) -> + 'enc_KmeSetProgrammingEventOn'(Val, []). 'enc_KmeSetProgrammingEventOn'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of request -> - ?RT_BER:encode_boolean(element(2,Val), []); + encode_boolean(element(2,Val), [<<1>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). +encode_tags(TagIn, EncBytes, EncLen). -'dec_KmeSetProgrammingEventOn'(Bytes, OptOrMand) -> - 'dec_KmeSetProgrammingEventOn'(Bytes, OptOrMand, []). +'dec_KmeSetProgrammingEventOn'(Tlv) -> + 'dec_KmeSetProgrammingEventOn'(Tlv, []). -'dec_KmeSetProgrammingEventOn'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of +'dec_KmeSetProgrammingEventOn'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of %% 'request' - <<0:2,_:1,1:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_boolean(Bytes1,[], mandatory), - {{request, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {1, V1} -> + {request, decode_boolean(V1, [])}; Else -> - case OptOrMand of - mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}}); - _ ->exit({error,{asn1,{no_optional_tag,Else}}}) - end - end. + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. %%================================ %% KmeLocalAlerm %%================================ - -'enc_KmeLocalAlerm'({'KmeLocalAlerm',Val}, TagIn) -> - 'enc_KmeLocalAlerm'(Val, TagIn); +'enc_KmeLocalAlerm'(Val) -> + 'enc_KmeLocalAlerm'(Val, []). 'enc_KmeLocalAlerm'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of singleMessage -> - ?RT_BER:encode_octet_string([], element(2,Val), [{tag,128,0,'EXPLICIT',32}]); + encode_restricted_string(element(2,Val), [<<4>>,<<160>>]); wideMessage -> - ?RT_BER:encode_octet_string([], element(2,Val), [{tag,128,1,'EXPLICIT',32}]); + encode_restricted_string(element(2,Val), [<<4>>,<<161>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). +encode_tags(TagIn, EncBytes, EncLen). -'dec_KmeLocalAlerm'(Bytes, OptOrMand) -> - 'dec_KmeLocalAlerm'(Bytes, OptOrMand, []). +'dec_KmeLocalAlerm'(Tlv) -> + 'dec_KmeLocalAlerm'(Tlv, []). -'dec_KmeLocalAlerm'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of +'dec_KmeLocalAlerm'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of %% 'singleMessage' - <<2:2,_:1,0:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_octet_string(Bytes1,{0,24},[{tag,128,0,'EXPLICIT',32}], no_length, mandatory), - {{singleMessage, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131072, V1} -> + {singleMessage, begin +Val1 = decode_octet_string(V1, [4]), +C1 = byte_size(Val1), +if 0 =< C1, C1 =< 24 -> +Val1; +true -> +exit({error,{asn1,bad_range}}) +end +end}; %% 'wideMessage' - <<2:2,_:1,1:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_octet_string(Bytes1,{0,48},[{tag,128,1,'EXPLICIT',32}], no_length, mandatory), - {{wideMessage, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131073, V1} -> + {wideMessage, begin +Val2 = decode_octet_string(V1, [4]), +C2 = byte_size(Val2), +if 0 =< C2, C2 =< 48 -> +Val2; +true -> +exit({error,{asn1,bad_range}}) +end +end}; Else -> - case OptOrMand of - mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}}); - _ ->exit({error,{asn1,{no_optional_tag,Else}}}) - end - end. + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. %%================================ %% KmeTrunkId %%================================ - -'enc_KmeTrunkId'({'KmeTrunkId',Val}, TagIn) -> - 'enc_KmeTrunkId'(Val, TagIn); +'enc_KmeTrunkId'(Val) -> + 'enc_KmeTrunkId'(Val, [<<48>>]). 'enc_KmeTrunkId'(Val, TagIn) -> - 'CSTA-device-identifiers':'enc_DeviceID'(Val, TagIn ++ []). + 'CSTA-device-identifiers':'enc_DeviceID'(Val, TagIn). -'dec_KmeTrunkId'(Bytes, OptOrMand) -> - 'dec_KmeTrunkId'(Bytes, OptOrMand, []). +'dec_KmeTrunkId'(Tlv) -> + 'dec_KmeTrunkId'(Tlv, [16]). -'dec_KmeTrunkId'(Bytes, OptOrMand, TagIn) -> -'CSTA-device-identifiers':'dec_DeviceID'(Bytes, OptOrMand, TagIn++[]). +'dec_KmeTrunkId'(Tlv, TagIn) -> +'CSTA-device-identifiers':'dec_DeviceID'(Tlv, TagIn). %%================================ %% KmeOtherDevice %%================================ - -'enc_KmeOtherDevice'({'KmeOtherDevice',Val}, TagIn) -> - 'enc_KmeOtherDevice'(Val, TagIn); +'enc_KmeOtherDevice'(Val) -> + 'enc_KmeOtherDevice'(Val, [<<10>>]). 'enc_KmeOtherDevice'(Val, TagIn) -> -case (case Val of {_,Enumval1}->Enumval1;_->Val end) of -vm -> ?RT_BER:encode_enumerated(0,TagIn ++ []); -doorPhone -> ?RT_BER:encode_enumerated(1,TagIn ++ []); -disa -> ?RT_BER:encode_enumerated(2,TagIn ++ []); -pagingGroup -> ?RT_BER:encode_enumerated(3,TagIn ++ []); -psGruop -> ?RT_BER:encode_enumerated(4,TagIn ++ []); -externalRinger -> ?RT_BER:encode_enumerated(5,TagIn ++ []); -externalSensor -> ?RT_BER:encode_enumerated(6,TagIn ++ []); -externalPager -> ?RT_BER:encode_enumerated(7,TagIn ++ []); -modem -> ?RT_BER:encode_enumerated(8,TagIn ++ []); -hdlc -> ?RT_BER:encode_enumerated(9,TagIn ++ []); -pbxSystem -> ?RT_BER:encode_enumerated(10,TagIn ++ []); -svm -> ?RT_BER:encode_enumerated(11,TagIn ++ []); -Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) +case Val of +vm -> encode_tags(TagIn, [0], 1); +doorPhone -> encode_tags(TagIn, [1], 1); +disa -> encode_tags(TagIn, [2], 1); +pagingGroup -> encode_tags(TagIn, [3], 1); +psGruop -> encode_tags(TagIn, [4], 1); +externalRinger -> encode_tags(TagIn, [5], 1); +externalSensor -> encode_tags(TagIn, [6], 1); +externalPager -> encode_tags(TagIn, [7], 1); +modem -> encode_tags(TagIn, [8], 1); +hdlc -> encode_tags(TagIn, [9], 1); +pbxSystem -> encode_tags(TagIn, [10], 1); +svm -> encode_tags(TagIn, [11], 1); +Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}}) end. -'dec_KmeOtherDevice'(Bytes, OptOrMand) -> - 'dec_KmeOtherDevice'(Bytes, OptOrMand, []). - -'dec_KmeOtherDevice'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_enumerated(Bytes,[],[{vm,0},{doorPhone,1},{disa,2},{pagingGroup,3},{psGruop,4},{externalRinger,5},{externalSensor,6},{externalPager,7},{modem,8},{hdlc,9},{pbxSystem,10},{svm,11}],TagIn++[], OptOrMand). +'dec_KmeOtherDevice'(Tlv) -> + 'dec_KmeOtherDevice'(Tlv, [10]). + +'dec_KmeOtherDevice'(Tlv, TagIn) -> +case decode_integer(Tlv, TagIn) of +0 -> vm; +1 -> doorPhone; +2 -> disa; +3 -> pagingGroup; +4 -> psGruop; +5 -> externalRinger; +6 -> externalSensor; +7 -> externalPager; +8 -> modem; +9 -> hdlc; +10 -> pbxSystem; +11 -> svm; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end. %%================================ %% KmeCdrConditionCode %%================================ - -'enc_KmeCdrConditionCode'({'KmeCdrConditionCode',Val}, TagIn) -> - 'enc_KmeCdrConditionCode'(Val, TagIn); +'enc_KmeCdrConditionCode'(Val) -> + 'enc_KmeCdrConditionCode'(Val, [<<10>>]). 'enc_KmeCdrConditionCode'(Val, TagIn) -> -case (case Val of {_,Enumval1}->Enumval1;_->Val end) of -cl -> ?RT_BER:encode_enumerated(0,TagIn ++ []); -tr -> ?RT_BER:encode_enumerated(1,TagIn ++ []); -fw -> ?RT_BER:encode_enumerated(2,TagIn ++ []); -d0 -> ?RT_BER:encode_enumerated(3,TagIn ++ []); -rm -> ?RT_BER:encode_enumerated(4,TagIn ++ []); -na -> ?RT_BER:encode_enumerated(5,TagIn ++ []); -Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) +case Val of +cl -> encode_tags(TagIn, [0], 1); +tr -> encode_tags(TagIn, [1], 1); +fw -> encode_tags(TagIn, [2], 1); +d0 -> encode_tags(TagIn, [3], 1); +rm -> encode_tags(TagIn, [4], 1); +na -> encode_tags(TagIn, [5], 1); +Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}}) end. -'dec_KmeCdrConditionCode'(Bytes, OptOrMand) -> - 'dec_KmeCdrConditionCode'(Bytes, OptOrMand, []). +'dec_KmeCdrConditionCode'(Tlv) -> + 'dec_KmeCdrConditionCode'(Tlv, [10]). -'dec_KmeCdrConditionCode'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_enumerated(Bytes,[],[{cl,0},{tr,1},{fw,2},{d0,3},{rm,4},{na,5}],TagIn++[], OptOrMand). +'dec_KmeCdrConditionCode'(Tlv, TagIn) -> +case decode_integer(Tlv, TagIn) of +0 -> cl; +1 -> tr; +2 -> fw; +3 -> d0; +4 -> rm; +5 -> na; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end. %%================================ %% KmeFeatureNumber %%================================ - -'enc_KmeFeatureNumber'({'KmeFeatureNumber',Val}, TagIn) -> - 'enc_KmeFeatureNumber'(Val, TagIn); +'enc_KmeFeatureNumber'(Val) -> + 'enc_KmeFeatureNumber'(Val, [<<2>>]). 'enc_KmeFeatureNumber'(Val, TagIn) -> -?RT_BER:encode_integer([], Val, TagIn ++ []). +encode_integer(Val, TagIn). -'dec_KmeFeatureNumber'(Bytes, OptOrMand) -> - 'dec_KmeFeatureNumber'(Bytes, OptOrMand, []). +'dec_KmeFeatureNumber'(Tlv) -> + 'dec_KmeFeatureNumber'(Tlv, [2]). -'dec_KmeFeatureNumber'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_integer(Bytes,[],TagIn++[], OptOrMand). +'dec_KmeFeatureNumber'(Tlv, TagIn) -> +decode_integer(Tlv, TagIn). %%================================ %% KmeProprietaryChars %%================================ - -'enc_KmeProprietaryChars'({'KmeProprietaryChars',Val}, TagIn) -> - 'enc_KmeProprietaryChars'(Val, TagIn); +'enc_KmeProprietaryChars'(Val) -> + 'enc_KmeProprietaryChars'(Val, [<<4>>]). 'enc_KmeProprietaryChars'(Val, TagIn) -> -?RT_BER:encode_octet_string([], Val, TagIn ++ []). +encode_restricted_string(Val, TagIn). -'dec_KmeProprietaryChars'(Bytes, OptOrMand) -> - 'dec_KmeProprietaryChars'(Bytes, OptOrMand, []). +'dec_KmeProprietaryChars'(Tlv) -> + 'dec_KmeProprietaryChars'(Tlv, [4]). -'dec_KmeProprietaryChars'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_octet_string(Bytes,{0,144},TagIn++[], no_length, OptOrMand). +'dec_KmeProprietaryChars'(Tlv, TagIn) -> +begin +Val1 = decode_octet_string(Tlv, TagIn), +C1 = byte_size(Val1), +if 0 =< C1, C1 =< 144 -> +Val1; +true -> +exit({error,{asn1,bad_range}}) +end +end. %%================================ %% KmeHoldType %%================================ - -'enc_KmeHoldType'({'KmeHoldType',Val}, TagIn) -> - 'enc_KmeHoldType'(Val, TagIn); +'enc_KmeHoldType'(Val) -> + 'enc_KmeHoldType'(Val, [<<10>>]). 'enc_KmeHoldType'(Val, TagIn) -> -case (case Val of {_,Enumval1}->Enumval1;_->Val end) of -consultation -> ?RT_BER:encode_enumerated(0,TagIn ++ []); -normal -> ?RT_BER:encode_enumerated(1,TagIn ++ []); -exclusive -> ?RT_BER:encode_enumerated(2,TagIn ++ []); -Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) +case Val of +consultation -> encode_tags(TagIn, [0], 1); +normal -> encode_tags(TagIn, [1], 1); +exclusive -> encode_tags(TagIn, [2], 1); +Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}}) end. -'dec_KmeHoldType'(Bytes, OptOrMand) -> - 'dec_KmeHoldType'(Bytes, OptOrMand, []). +'dec_KmeHoldType'(Tlv) -> + 'dec_KmeHoldType'(Tlv, [10]). -'dec_KmeHoldType'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_enumerated(Bytes,[],[{consultation,0},{normal,1},{exclusive,2}],TagIn++[], OptOrMand). +'dec_KmeHoldType'(Tlv, TagIn) -> +case decode_integer(Tlv, TagIn) of +0 -> consultation; +1 -> normal; +2 -> exclusive; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end. %%================================ %% KmeForcedAlerting %%================================ - -'enc_KmeForcedAlerting'({'KmeForcedAlerting',Val}, TagIn) -> - 'enc_KmeForcedAlerting'(Val, TagIn); +'enc_KmeForcedAlerting'(Val) -> + 'enc_KmeForcedAlerting'(Val, [<<3>>]). 'enc_KmeForcedAlerting'(Val, TagIn) -> -?RT_BER:encode_bit_string([], Val, [{fwdDnd,0},{timer,1}], TagIn ++ []). +encode_named_bit_string(Val, [{fwdDnd,0},{timer,1}], TagIn). -'dec_KmeForcedAlerting'(Bytes, OptOrMand) -> - 'dec_KmeForcedAlerting'(Bytes, OptOrMand, []). +'dec_KmeForcedAlerting'(Tlv) -> + 'dec_KmeForcedAlerting'(Tlv, [3]). -'dec_KmeForcedAlerting'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_bit_string(Bytes,[],[{fwdDnd,0},{timer,1}],TagIn++[], no_length, OptOrMand). +'dec_KmeForcedAlerting'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{fwdDnd,0},{timer,1}], TagIn). %%================================ %% KmeDigitsReport %%================================ +'enc_KmeDigitsReport'(Val) -> + 'enc_KmeDigitsReport'(Val, [<<48>>]). + 'enc_KmeDigitsReport'(Val, TagIn) -> +{_,Cindex1, Cindex2} = Val, %%------------------------------------------------- -%% attribute number 1 External CSTA-call-connection-identifiers:ConnectionID +%% attribute connection(1) External CSTA-call-connection-identifiers:ConnectionID %%------------------------------------------------- - {EncBytes1,EncLen1} = 'CSTA-call-connection-identifiers':'enc_ConnectionID'(?RT_BER:cindex(2,Val,connection), []), + {EncBytes1,EncLen1} = 'CSTA-call-connection-identifiers':'enc_ConnectionID'(Cindex1, [<<107>>]), %%------------------------------------------------- -%% attribute number 2 with type IA5String +%% attribute digits(2) with type IA5String %%------------------------------------------------- - {EncBytes2,EncLen2} = ?RT_BER:encode_restricted_string([], ?RT_BER:cindex(3,Val,digits), 22, []), + {EncBytes2,EncLen2} = encode_restricted_string(Cindex2, [<<22>>]), BytesSoFar = [EncBytes1, EncBytes2], - LenSoFar = EncLen1 + EncLen2, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2, +encode_tags(TagIn, BytesSoFar, LenSoFar). -'dec_KmeDigitsReport'(Bytes, OptOrMand) -> - 'dec_KmeDigitsReport'(Bytes, OptOrMand, []). +'dec_KmeDigitsReport'(Tlv) -> + 'dec_KmeDigitsReport'(Tlv, [16]). -'dec_KmeDigitsReport'(Bytes, OptOrMand, TagIn) -> +'dec_KmeDigitsReport'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 External CSTA-call-connection-identifiers:ConnectionID +%% attribute connection(1) External CSTA-call-connection-identifiers:ConnectionID %%------------------------------------------------- - {Term1,Bytes3,Rb2} = 'CSTA-call-connection-identifiers':'dec_ConnectionID'(Bytes2, mandatory, []), +[V1|Tlv2] = Tlv1, +Term1 = 'CSTA-call-connection-identifiers':'dec_ConnectionID'(V1, [65547]), %%------------------------------------------------- -%% attribute number 2 with type IA5String +%% attribute digits(2) with type IA5String %%------------------------------------------------- - {Term2,Bytes4,Rb3} = ?RT_BER:decode_restricted_string(Bytes3,{0,64},22,[], no_length, mandatory), +[V2|Tlv3] = Tlv2, +Term2 = begin +Val1 = decode_restricted_string(V2, [22]), +C1 = byte_size(Val1), +if 0 =< C1, C1 =< 64 -> +binary_to_list(Val1); +true -> +exit({error,{asn1,bad_range}}) +end +end, + +case Tlv3 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed +end, + {'KmeDigitsReport', Term1, Term2}. - {Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext), - {{'KmeDigitsReport', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}. %%================================ %% KmeOgmStatus %%================================ +'enc_KmeOgmStatus'(Val) -> + 'enc_KmeOgmStatus'(Val, [<<48>>]). + 'enc_KmeOgmStatus'(Val, TagIn) -> +{_,Cindex1, Cindex2, Cindex3, Cindex4} = Val, %%------------------------------------------------- -%% attribute number 1 External CSTA-call-connection-identifiers:ConnectionID +%% attribute connection(1) External CSTA-call-connection-identifiers:ConnectionID %%------------------------------------------------- - {EncBytes1,EncLen1} = 'CSTA-call-connection-identifiers':'enc_ConnectionID'(?RT_BER:cindex(2,Val,connection), []), + {EncBytes1,EncLen1} = 'CSTA-call-connection-identifiers':'enc_ConnectionID'(Cindex1, [<<107>>]), %%------------------------------------------------- -%% attribute number 2 with type ENUMERATED +%% attribute state(2) with type ENUMERATED %%------------------------------------------------- - {EncBytes2,EncLen2} = case (case ?RT_BER:cindex(3,Val,state) of {_,Enumval1}->Enumval1;_->?RT_BER:cindex(3,Val,state) end) of -started -> ?RT_BER:encode_enumerated(0,[]); -ended -> ?RT_BER:encode_enumerated(1,[]); -Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) + {EncBytes2,EncLen2} = case Cindex2 of +started -> encode_tags([<<10>>], [0], 1); +ended -> encode_tags([<<10>>], [1], 1); +Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}}) end, %%------------------------------------------------- -%% attribute number 3 with type INTEGER +%% attribute ogmId(3) with type INTEGER %%------------------------------------------------- - {EncBytes3,EncLen3} = ?RT_BER:encode_integer([], ?RT_BER:cindex(4,Val,ogmId), []), + {EncBytes3,EncLen3} = encode_integer(Cindex3, [<<2>>]), %%------------------------------------------------- -%% attribute number 4 External CSTA-device-identifiers:DeviceID +%% attribute ogmPortNumber(4) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {EncBytes4,EncLen4} = 'CSTA-device-identifiers':'enc_DeviceID'(?RT_BER:cindex(5,Val,ogmPortNumber), []), + {EncBytes4,EncLen4} = 'CSTA-device-identifiers':'enc_DeviceID'(Cindex4, [<<48>>]), BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4], - LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4, +encode_tags(TagIn, BytesSoFar, LenSoFar). -'dec_KmeOgmStatus'(Bytes, OptOrMand) -> - 'dec_KmeOgmStatus'(Bytes, OptOrMand, []). +'dec_KmeOgmStatus'(Tlv) -> + 'dec_KmeOgmStatus'(Tlv, [16]). -'dec_KmeOgmStatus'(Bytes, OptOrMand, TagIn) -> +'dec_KmeOgmStatus'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 External CSTA-call-connection-identifiers:ConnectionID +%% attribute connection(1) External CSTA-call-connection-identifiers:ConnectionID %%------------------------------------------------- - {Term1,Bytes3,Rb2} = 'CSTA-call-connection-identifiers':'dec_ConnectionID'(Bytes2, mandatory, []), +[V1|Tlv2] = Tlv1, +Term1 = 'CSTA-call-connection-identifiers':'dec_ConnectionID'(V1, [65547]), %%------------------------------------------------- -%% attribute number 2 with type ENUMERATED +%% attribute state(2) with type ENUMERATED %%------------------------------------------------- - {Term2,Bytes4,Rb3} = ?RT_BER:decode_enumerated(Bytes3,[],[{started,0},{ended,1}],[], mandatory), +[V2|Tlv3] = Tlv2, +Term2 = case decode_integer(V2, [10]) of +0 -> started; +1 -> ended; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end, %%------------------------------------------------- -%% attribute number 3 with type INTEGER +%% attribute ogmId(3) with type INTEGER %%------------------------------------------------- - {Term3,Bytes5,Rb4} = ?RT_BER:decode_integer(Bytes4,[],[], mandatory), +[V3|Tlv4] = Tlv3, +Term3 = decode_integer(V3, [2]), %%------------------------------------------------- -%% attribute number 4 External CSTA-device-identifiers:DeviceID +%% attribute ogmPortNumber(4) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {Term4,Bytes6,Rb5} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes5, mandatory, []), +[V4|Tlv5] = Tlv4, +Term4 = 'CSTA-device-identifiers':'dec_DeviceID'(V4, [16]), + +case Tlv5 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv5}}}) % extra fields not allowed +end, + {'KmeOgmStatus', Term1, Term2, Term3, Term4}. - {Bytes7,Rb6} = ?RT_BER:restbytes2(RemBytes, Bytes6,noext), - {{'KmeOgmStatus', Term1, Term2, Term3, Term4}, Bytes7, Rb1+Rb2+Rb3+Rb4+Rb5+Rb6}. %%================================ %% KmeWakeupResult %%================================ +'enc_KmeWakeupResult'(Val) -> + 'enc_KmeWakeupResult'(Val, [<<48>>]). + 'enc_KmeWakeupResult'(Val, TagIn) -> +{_,Cindex1, Cindex2, Cindex3, Cindex4, Cindex5} = Val, %%------------------------------------------------- -%% attribute number 1 External CSTA-device-identifiers:DeviceID +%% attribute device(1) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {EncBytes1,EncLen1} = 'CSTA-device-identifiers':'enc_DeviceID'(?RT_BER:cindex(2,Val,device), []), + {EncBytes1,EncLen1} = 'CSTA-device-identifiers':'enc_DeviceID'(Cindex1, [<<48>>]), %%------------------------------------------------- -%% attribute number 2 with type ENUMERATED +%% attribute state(2) with type ENUMERATED %%------------------------------------------------- - {EncBytes2,EncLen2} = case (case ?RT_BER:cindex(3,Val,state) of {_,Enumval1}->Enumval1;_->?RT_BER:cindex(3,Val,state) end) of -answered -> ?RT_BER:encode_enumerated(0,[]); -noAnswer -> ?RT_BER:encode_enumerated(1,[]); -Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) + {EncBytes2,EncLen2} = case Cindex2 of +answered -> encode_tags([<<10>>], [0], 1); +noAnswer -> encode_tags([<<10>>], [1], 1); +Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}}) end, %%------------------------------------------------- -%% attribute number 3 External KME-specific-types:KmeWakeUpTime +%% attribute wakeupTime(3) External KME-specific-types:KmeWakeUpTime %%------------------------------------------------- - {EncBytes3,EncLen3} = 'enc_KmeWakeUpTime'(?RT_BER:cindex(4,Val,wakeupTime), []), + {EncBytes3,EncLen3} = 'enc_KmeWakeUpTime'(Cindex3, [<<48>>]), %%------------------------------------------------- -%% attribute number 4 with type GeneralizedTime +%% attribute invokeTime(4) with type GeneralizedTime %%------------------------------------------------- - {EncBytes4,EncLen4} = ?RT_BER:encode_generalized_time([], ?RT_BER:cindex(5,Val,invokeTime), []), + {EncBytes4,EncLen4} = encode_restricted_string(Cindex4, [<<24>>]), %%------------------------------------------------- -%% attribute number 5 with type INTEGER OPTIONAL +%% attribute restOfRetry(5) with type INTEGER OPTIONAL %%------------------------------------------------- - {EncBytes5,EncLen5} = case ?RT_BER:cindex(6,Val,restOfRetry) of + {EncBytes5,EncLen5} = case Cindex5 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_integer([], ?RT_BER:cindex(6,Val,restOfRetry), []) + encode_integer(Cindex5, [<<2>>]) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4, EncBytes5], - LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5, +encode_tags(TagIn, BytesSoFar, LenSoFar). -'dec_KmeWakeupResult'(Bytes, OptOrMand) -> - 'dec_KmeWakeupResult'(Bytes, OptOrMand, []). +'dec_KmeWakeupResult'(Tlv) -> + 'dec_KmeWakeupResult'(Tlv, [16]). -'dec_KmeWakeupResult'(Bytes, OptOrMand, TagIn) -> +'dec_KmeWakeupResult'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 External CSTA-device-identifiers:DeviceID +%% attribute device(1) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {Term1,Bytes3,Rb2} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes2, mandatory, []), +[V1|Tlv2] = Tlv1, +Term1 = 'CSTA-device-identifiers':'dec_DeviceID'(V1, [16]), %%------------------------------------------------- -%% attribute number 2 with type ENUMERATED +%% attribute state(2) with type ENUMERATED %%------------------------------------------------- - {Term2,Bytes4,Rb3} = ?RT_BER:decode_enumerated(Bytes3,[],[{answered,0},{noAnswer,1}],[], mandatory), +[V2|Tlv3] = Tlv2, +Term2 = case decode_integer(V2, [10]) of +0 -> answered; +1 -> noAnswer; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end, %%------------------------------------------------- -%% attribute number 3 External KME-specific-types:KmeWakeUpTime +%% attribute wakeupTime(3) External KME-specific-types:KmeWakeUpTime %%------------------------------------------------- - {Term3,Bytes5,Rb4} = 'dec_KmeWakeUpTime'(Bytes4, mandatory, []), +[V3|Tlv4] = Tlv3, +Term3 = 'dec_KmeWakeUpTime'(V3, [16]), %%------------------------------------------------- -%% attribute number 4 with type GeneralizedTime +%% attribute invokeTime(4) with type GeneralizedTime %%------------------------------------------------- - {Term4,Bytes6,Rb5} = ?RT_BER:decode_generalized_time(Bytes5,[],[], no_length, mandatory), +[V4|Tlv5] = Tlv4, +Term4 = begin +binary_to_list(decode_restricted_string(V4, [24])) +end +, %%------------------------------------------------- -%% attribute number 5 with type INTEGER OPTIONAL +%% attribute restOfRetry(5) with type INTEGER OPTIONAL %%------------------------------------------------- - {Term5,Bytes7,Rb6} = case Bytes6 of -<<0:2,_:1,2:5,_/binary>> -> -?RT_BER:decode_integer(Bytes6,[],[], mandatory); -_ -> -{ asn1_NOVALUE, Bytes6, 0 } +{Term5,Tlv6} = case Tlv5 of +[{2,V5}|TempTlv6] -> + {decode_integer(V5, []), TempTlv6}; + _ -> + { asn1_NOVALUE, Tlv5} end, - {Bytes8,Rb7} = ?RT_BER:restbytes2(RemBytes, Bytes7,noext), - {{'KmeWakeupResult', Term1, Term2, Term3, Term4, Term5}, Bytes8, Rb1+Rb2+Rb3+Rb4+Rb5+Rb6+Rb7}. +case Tlv6 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv6}}}) % extra fields not allowed +end, + {'KmeWakeupResult', Term1, Term2, Term3, Term4, Term5}. + %%================================ %% KmeUnconferenced %%================================ +'enc_KmeUnconferenced'(Val) -> + 'enc_KmeUnconferenced'(Val, [<<48>>]). + 'enc_KmeUnconferenced'(Val, TagIn) -> +{_,Cindex1, Cindex2, Cindex3, Cindex4, Cindex5, Cindex6, Cindex7} = Val, %%------------------------------------------------- -%% attribute number 1 External CSTA-device-identifiers:DeviceID +%% attribute unconferencingDevice(1) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {EncBytes1,EncLen1} = 'CSTA-device-identifiers':'enc_DeviceID'(?RT_BER:cindex(2,Val,unconferencingDevice), []), + {EncBytes1,EncLen1} = 'CSTA-device-identifiers':'enc_DeviceID'(Cindex1, [<<48>>]), %%------------------------------------------------- -%% attribute number 2 External CSTA-call-connection-identifiers:ConnectionID +%% attribute primaryCall(2) External CSTA-call-connection-identifiers:ConnectionID %%------------------------------------------------- - {EncBytes2,EncLen2} = 'CSTA-call-connection-identifiers':'enc_ConnectionID'(?RT_BER:cindex(3,Val,primaryCall), []), + {EncBytes2,EncLen2} = 'CSTA-call-connection-identifiers':'enc_ConnectionID'(Cindex2, [<<107>>]), %%------------------------------------------------- -%% attribute number 3 External CSTA-call-connection-identifiers:ConnectionID OPTIONAL +%% attribute secodaryCall(3) External CSTA-call-connection-identifiers:ConnectionID OPTIONAL %%------------------------------------------------- - {EncBytes3,EncLen3} = case ?RT_BER:cindex(4,Val,secodaryCall) of + {EncBytes3,EncLen3} = case Cindex3 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'CSTA-call-connection-identifiers':'enc_ConnectionID'(?RT_BER:cindex(4,Val,secodaryCall), []) + 'CSTA-call-connection-identifiers':'enc_ConnectionID'(Cindex3, [<<107>>]) end, %%------------------------------------------------- -%% attribute number 4 External CSTA-device-identifiers:DeviceID OPTIONAL +%% attribute primaryNID(4) External CSTA-device-identifiers:DeviceID OPTIONAL %%------------------------------------------------- - {EncBytes4,EncLen4} = case ?RT_BER:cindex(5,Val,primaryNID) of + {EncBytes4,EncLen4} = case Cindex4 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'CSTA-device-identifiers':'enc_DeviceID'(?RT_BER:cindex(5,Val,primaryNID), [{tag,128,1,'EXPLICIT',32}]) + 'CSTA-device-identifiers':'enc_DeviceID'(Cindex4, [<<48>>,<<161>>]) end, %%------------------------------------------------- -%% attribute number 5 External CSTA-device-identifiers:DeviceID OPTIONAL +%% attribute secondaryNID(5) External CSTA-device-identifiers:DeviceID OPTIONAL %%------------------------------------------------- - {EncBytes5,EncLen5} = case ?RT_BER:cindex(6,Val,secondaryNID) of + {EncBytes5,EncLen5} = case Cindex5 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'CSTA-device-identifiers':'enc_DeviceID'(?RT_BER:cindex(6,Val,secondaryNID), [{tag,128,2,'EXPLICIT',32}]) + 'CSTA-device-identifiers':'enc_DeviceID'(Cindex5, [<<48>>,<<162>>]) end, %%------------------------------------------------- -%% attribute number 6 with type ENUMERATED +%% attribute primaryConnectionInfo(6) with type ENUMERATED %%------------------------------------------------- - {EncBytes6,EncLen6} = case (case ?RT_BER:cindex(7,Val,primaryConnectionInfo) of {_,Enumval1}->Enumval1;_->?RT_BER:cindex(7,Val,primaryConnectionInfo) end) of -null -> ?RT_BER:encode_enumerated(0,[{tag,64,14,'IMPLICIT',32}]); -initiated -> ?RT_BER:encode_enumerated(1,[{tag,64,14,'IMPLICIT',32}]); -alerting -> ?RT_BER:encode_enumerated(2,[{tag,64,14,'IMPLICIT',32}]); -connected -> ?RT_BER:encode_enumerated(3,[{tag,64,14,'IMPLICIT',32}]); -hold -> ?RT_BER:encode_enumerated(4,[{tag,64,14,'IMPLICIT',32}]); -queued -> ?RT_BER:encode_enumerated(5,[{tag,64,14,'IMPLICIT',32}]); -fail -> ?RT_BER:encode_enumerated(6,[{tag,64,14,'IMPLICIT',32}]); -Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) + {EncBytes6,EncLen6} = case Cindex6 of +null -> encode_tags([<<78>>], [0], 1); +initiated -> encode_tags([<<78>>], [1], 1); +alerting -> encode_tags([<<78>>], [2], 1); +connected -> encode_tags([<<78>>], [3], 1); +hold -> encode_tags([<<78>>], [4], 1); +queued -> encode_tags([<<78>>], [5], 1); +fail -> encode_tags([<<78>>], [6], 1); +Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}}) end, %%------------------------------------------------- -%% attribute number 7 with type ENUMERATED OPTIONAL +%% attribute secondaryConnectionInfo(7) with type ENUMERATED OPTIONAL %%------------------------------------------------- - {EncBytes7,EncLen7} = case ?RT_BER:cindex(8,Val,secondaryConnectionInfo) of + {EncBytes7,EncLen7} = case Cindex7 of asn1_NOVALUE -> {<<>>,0}; _ -> - case (case ?RT_BER:cindex(8,Val,secondaryConnectionInfo) of {_,Enumval3}->Enumval3;_->?RT_BER:cindex(8,Val,secondaryConnectionInfo) end) of -null -> ?RT_BER:encode_enumerated(0,[{tag,64,14,'IMPLICIT',32}]); -initiated -> ?RT_BER:encode_enumerated(1,[{tag,64,14,'IMPLICIT',32}]); -alerting -> ?RT_BER:encode_enumerated(2,[{tag,64,14,'IMPLICIT',32}]); -connected -> ?RT_BER:encode_enumerated(3,[{tag,64,14,'IMPLICIT',32}]); -hold -> ?RT_BER:encode_enumerated(4,[{tag,64,14,'IMPLICIT',32}]); -queued -> ?RT_BER:encode_enumerated(5,[{tag,64,14,'IMPLICIT',32}]); -fail -> ?RT_BER:encode_enumerated(6,[{tag,64,14,'IMPLICIT',32}]); -Enumval4 -> exit({error,{asn1, {enumerated_not_in_range,Enumval4}}}) + case Cindex7 of +null -> encode_tags([<<78>>], [0], 1); +initiated -> encode_tags([<<78>>], [1], 1); +alerting -> encode_tags([<<78>>], [2], 1); +connected -> encode_tags([<<78>>], [3], 1); +hold -> encode_tags([<<78>>], [4], 1); +queued -> encode_tags([<<78>>], [5], 1); +fail -> encode_tags([<<78>>], [6], 1); +Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) end end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4, EncBytes5, EncBytes6, EncBytes7], - LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5 + EncLen6 + EncLen7, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5 + EncLen6 + EncLen7, +encode_tags(TagIn, BytesSoFar, LenSoFar). -'dec_KmeUnconferenced'(Bytes, OptOrMand) -> - 'dec_KmeUnconferenced'(Bytes, OptOrMand, []). +'dec_KmeUnconferenced'(Tlv) -> + 'dec_KmeUnconferenced'(Tlv, [16]). -'dec_KmeUnconferenced'(Bytes, OptOrMand, TagIn) -> +'dec_KmeUnconferenced'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 External CSTA-device-identifiers:DeviceID +%% attribute unconferencingDevice(1) External CSTA-device-identifiers:DeviceID %%------------------------------------------------- - {Term1,Bytes3,Rb2} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes2, mandatory, []), +[V1|Tlv2] = Tlv1, +Term1 = 'CSTA-device-identifiers':'dec_DeviceID'(V1, [16]), %%------------------------------------------------- -%% attribute number 2 External CSTA-call-connection-identifiers:ConnectionID +%% attribute primaryCall(2) External CSTA-call-connection-identifiers:ConnectionID %%------------------------------------------------- - {Term2,Bytes4,Rb3} = 'CSTA-call-connection-identifiers':'dec_ConnectionID'(Bytes3, mandatory, []), +[V2|Tlv3] = Tlv2, +Term2 = 'CSTA-call-connection-identifiers':'dec_ConnectionID'(V2, [65547]), %%------------------------------------------------- -%% attribute number 3 External CSTA-call-connection-identifiers:ConnectionID OPTIONAL +%% attribute secodaryCall(3) External CSTA-call-connection-identifiers:ConnectionID OPTIONAL %%------------------------------------------------- - {Term3,Bytes5,Rb4} = case Bytes4 of -<<1:2,_:1,11:5,_/binary>> -> -'CSTA-call-connection-identifiers':'dec_ConnectionID'(Bytes4, opt_or_default, []); -_ -> -{ asn1_NOVALUE, Bytes4, 0 } +{Term3,Tlv4} = case Tlv3 of +[{65547,V3}|TempTlv4] -> + {'CSTA-call-connection-identifiers':'dec_ConnectionID'(V3, []), TempTlv4}; + _ -> + { asn1_NOVALUE, Tlv3} end, %%------------------------------------------------- -%% attribute number 4 External CSTA-device-identifiers:DeviceID OPTIONAL +%% attribute primaryNID(4) External CSTA-device-identifiers:DeviceID OPTIONAL %%------------------------------------------------- - {Term4,Bytes6,Rb5} = case Bytes5 of -<<2:2,_:1,1:5,_/binary>> -> -'CSTA-device-identifiers':'dec_DeviceID'(Bytes5, opt_or_default, [{tag,128,1,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes5, 0 } +{Term4,Tlv5} = case Tlv4 of +[{131073,V4}|TempTlv5] -> + {'CSTA-device-identifiers':'dec_DeviceID'(V4, [16]), TempTlv5}; + _ -> + { asn1_NOVALUE, Tlv4} end, %%------------------------------------------------- -%% attribute number 5 External CSTA-device-identifiers:DeviceID OPTIONAL +%% attribute secondaryNID(5) External CSTA-device-identifiers:DeviceID OPTIONAL %%------------------------------------------------- - {Term5,Bytes7,Rb6} = case Bytes6 of -<<2:2,_:1,2:5,_/binary>> -> -'CSTA-device-identifiers':'dec_DeviceID'(Bytes6, opt_or_default, [{tag,128,2,'EXPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes6, 0 } +{Term5,Tlv6} = case Tlv5 of +[{131074,V5}|TempTlv6] -> + {'CSTA-device-identifiers':'dec_DeviceID'(V5, [16]), TempTlv6}; + _ -> + { asn1_NOVALUE, Tlv5} end, %%------------------------------------------------- -%% attribute number 6 with type ENUMERATED +%% attribute primaryConnectionInfo(6) with type ENUMERATED %%------------------------------------------------- - {Term6,Bytes8,Rb7} = ?RT_BER:decode_enumerated(Bytes7,[],[{null,0},{initiated,1},{alerting,2},{connected,3},{hold,4},{queued,5},{fail,6}],[{tag,64,14,'IMPLICIT',32}], mandatory), +[V6|Tlv7] = Tlv6, +Term6 = case decode_integer(V6, [65550]) of +0 -> null; +1 -> initiated; +2 -> alerting; +3 -> connected; +4 -> hold; +5 -> queued; +6 -> fail; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end, %%------------------------------------------------- -%% attribute number 7 with type ENUMERATED OPTIONAL -%%------------------------------------------------- - {Term7,Bytes9,Rb8} = case Bytes8 of -<<1:2,_:1,14:5,_/binary>> -> -?RT_BER:decode_enumerated(Bytes8,[],[{null,0},{initiated,1},{alerting,2},{connected,3},{hold,4},{queued,5},{fail,6}],[{tag,64,14,'IMPLICIT',32}], mandatory); -_ -> -{ asn1_NOVALUE, Bytes8, 0 } +%% attribute secondaryConnectionInfo(7) with type ENUMERATED OPTIONAL +%%------------------------------------------------- +{Term7,Tlv8} = case Tlv7 of +[{65550,V7}|TempTlv8] -> + {case decode_integer(V7, []) of +0 -> null; +1 -> initiated; +2 -> alerting; +3 -> connected; +4 -> hold; +5 -> queued; +6 -> fail; +Default2 -> exit({error,{asn1,{illegal_enumerated,Default2}}}) +end, TempTlv8}; + _ -> + { asn1_NOVALUE, Tlv7} +end, + +case Tlv8 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv8}}}) % extra fields not allowed end, + {'KmeUnconferenced', Term1, Term2, Term3, Term4, Term5, Term6, Term7}. - {Bytes10,Rb9} = ?RT_BER:restbytes2(RemBytes, Bytes9,noext), - {{'KmeUnconferenced', Term1, Term2, Term3, Term4, Term5, Term6, Term7}, Bytes10, Rb1+Rb2+Rb3+Rb4+Rb5+Rb6+Rb7+Rb8+Rb9}. %%================================ %% KmeTamEnded %%================================ - -'enc_KmeTamEnded'({'KmeTamEnded',Val}, TagIn) -> - 'enc_KmeTamEnded'(Val, TagIn); +'enc_KmeTamEnded'(Val) -> + 'enc_KmeTamEnded'(Val, [<<107>>]). 'enc_KmeTamEnded'(Val, TagIn) -> - 'CSTA-call-connection-identifiers':'enc_ConnectionID'(Val, TagIn ++ []). + 'CSTA-call-connection-identifiers':'enc_ConnectionID'(Val, TagIn). -'dec_KmeTamEnded'(Bytes, OptOrMand) -> - 'dec_KmeTamEnded'(Bytes, OptOrMand, []). +'dec_KmeTamEnded'(Tlv) -> + 'dec_KmeTamEnded'(Tlv, [65547]). -'dec_KmeTamEnded'(Bytes, OptOrMand, TagIn) -> -'CSTA-call-connection-identifiers':'dec_ConnectionID'(Bytes, OptOrMand, TagIn++[]). +'dec_KmeTamEnded'(Tlv, TagIn) -> +'CSTA-call-connection-identifiers':'dec_ConnectionID'(Tlv, TagIn). %%================================ %% KmePcRecEnded %%================================ - -'enc_KmePcRecEnded'({'KmePcRecEnded',Val}, TagIn) -> - 'enc_KmePcRecEnded'(Val, TagIn); +'enc_KmePcRecEnded'(Val) -> + 'enc_KmePcRecEnded'(Val, [<<107>>]). 'enc_KmePcRecEnded'(Val, TagIn) -> - 'CSTA-call-connection-identifiers':'enc_ConnectionID'(Val, TagIn ++ []). + 'CSTA-call-connection-identifiers':'enc_ConnectionID'(Val, TagIn). -'dec_KmePcRecEnded'(Bytes, OptOrMand) -> - 'dec_KmePcRecEnded'(Bytes, OptOrMand, []). +'dec_KmePcRecEnded'(Tlv) -> + 'dec_KmePcRecEnded'(Tlv, [65547]). -'dec_KmePcRecEnded'(Bytes, OptOrMand, TagIn) -> -'CSTA-call-connection-identifiers':'dec_ConnectionID'(Bytes, OptOrMand, TagIn++[]). +'dec_KmePcRecEnded'(Tlv, TagIn) -> +'CSTA-call-connection-identifiers':'dec_ConnectionID'(Tlv, TagIn). %%================================ %% KmeSwitchChannel %%================================ - -'enc_KmeSwitchChannel'({'KmeSwitchChannel',Val}, TagIn) -> - 'enc_KmeSwitchChannel'(Val, TagIn); +'enc_KmeSwitchChannel'(Val) -> + 'enc_KmeSwitchChannel'(Val, [<<107>>]). 'enc_KmeSwitchChannel'(Val, TagIn) -> - 'CSTA-call-connection-identifiers':'enc_ConnectionID'(Val, TagIn ++ []). + 'CSTA-call-connection-identifiers':'enc_ConnectionID'(Val, TagIn). -'dec_KmeSwitchChannel'(Bytes, OptOrMand) -> - 'dec_KmeSwitchChannel'(Bytes, OptOrMand, []). +'dec_KmeSwitchChannel'(Tlv) -> + 'dec_KmeSwitchChannel'(Tlv, [65547]). -'dec_KmeSwitchChannel'(Bytes, OptOrMand, TagIn) -> -'CSTA-call-connection-identifiers':'dec_ConnectionID'(Bytes, OptOrMand, TagIn++[]). +'dec_KmeSwitchChannel'(Tlv, TagIn) -> +'CSTA-call-connection-identifiers':'dec_ConnectionID'(Tlv, TagIn). %%================================ %% KmeFreeOgmPort %%================================ - -'enc_KmeFreeOgmPort'({'KmeFreeOgmPort',Val}, TagIn) -> - 'enc_KmeFreeOgmPort'(Val, TagIn); +'enc_KmeFreeOgmPort'(Val) -> + 'enc_KmeFreeOgmPort'(Val, [<<2>>]). 'enc_KmeFreeOgmPort'(Val, TagIn) -> -?RT_BER:encode_integer([], Val, TagIn ++ []). +encode_integer(Val, TagIn). -'dec_KmeFreeOgmPort'(Bytes, OptOrMand) -> - 'dec_KmeFreeOgmPort'(Bytes, OptOrMand, []). +'dec_KmeFreeOgmPort'(Tlv) -> + 'dec_KmeFreeOgmPort'(Tlv, [2]). -'dec_KmeFreeOgmPort'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_integer(Bytes,[],TagIn++[], OptOrMand). +'dec_KmeFreeOgmPort'(Tlv, TagIn) -> +decode_integer(Tlv, TagIn). %%================================ %% KmeCallControlSrvEvt %%================================ - -'enc_KmeCallControlSrvEvt'({'KmeCallControlSrvEvt',Val}, TagIn) -> - 'enc_KmeCallControlSrvEvt'(Val, TagIn); +'enc_KmeCallControlSrvEvt'(Val) -> + 'enc_KmeCallControlSrvEvt'(Val, []). 'enc_KmeCallControlSrvEvt'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of dndOverride -> - 'enc_KmeDndOverride'(element(2,Val), [{tag,128,0,'EXPLICIT',32}]); + 'enc_KmeDndOverride'(element(2,Val), [<<107>>,<<160>>]); interuptCall -> - 'enc_KmeInteruptCall'(element(2,Val), [{tag,128,1,'EXPLICIT',32}]); + 'enc_KmeInteruptCall'(element(2,Val), [<<107>>,<<161>>]); eFA -> - 'enc_KmeExternalFeatureAccess'(element(2,Val), [{tag,128,2,'EXPLICIT',32}]); + 'enc_KmeExternalFeatureAccess'(element(2,Val), [<<107>>,<<162>>]); tempTollChange -> - 'enc_KmeTempTollChange'(element(2,Val), [{tag,128,3,'EXPLICIT',32}]); + 'enc_KmeTempTollChange'(element(2,Val), [<<48>>,<<163>>]); doorOpen -> - 'enc_KmeDoorOpen'(element(2,Val), [{tag,128,4,'EXPLICIT',32}]); + 'enc_KmeDoorOpen'(element(2,Val), [<<107>>,<<164>>]); twoWayRec -> - 'enc_KmeTwoWayRec'(element(2,Val), [{tag,128,5,'EXPLICIT',32}]); + 'enc_KmeTwoWayRec'(element(2,Val), [<<48>>,<<165>>]); callBackInvoke -> - 'enc_KmeCallBackInvoke'(element(2,Val), [{tag,128,6,'EXPLICIT',32}]); + 'enc_KmeCallBackInvoke'(element(2,Val), [<<166>>]); pcRec -> - 'enc_KmePcRec'(element(2,Val), [{tag,128,7,'EXPLICIT',32}]); + 'enc_KmePcRec'(element(2,Val), [<<48>>,<<167>>]); switchChannel -> - 'enc_KmeSwitchChannel'(element(2,Val), [{tag,128,8,'EXPLICIT',32}]); + 'enc_KmeSwitchChannel'(element(2,Val), [<<107>>,<<168>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). +encode_tags(TagIn, EncBytes, EncLen). -'dec_KmeCallControlSrvEvt'(Bytes, OptOrMand) -> - 'dec_KmeCallControlSrvEvt'(Bytes, OptOrMand, []). +'dec_KmeCallControlSrvEvt'(Tlv) -> + 'dec_KmeCallControlSrvEvt'(Tlv, []). -'dec_KmeCallControlSrvEvt'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of +'dec_KmeCallControlSrvEvt'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of %% 'dndOverride' - <<2:2,_:1,0:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeDndOverride'(Bytes1, mandatory, [{tag,128,0,'EXPLICIT',32}]), - {{dndOverride, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131072, V1} -> + {dndOverride, 'dec_KmeDndOverride'(V1, [65547])}; %% 'interuptCall' - <<2:2,_:1,1:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeInteruptCall'(Bytes1, mandatory, [{tag,128,1,'EXPLICIT',32}]), - {{interuptCall, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131073, V1} -> + {interuptCall, 'dec_KmeInteruptCall'(V1, [65547])}; %% 'eFA' - <<2:2,_:1,2:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeExternalFeatureAccess'(Bytes1, mandatory, [{tag,128,2,'EXPLICIT',32}]), - {{eFA, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131074, V1} -> + {eFA, 'dec_KmeExternalFeatureAccess'(V1, [65547])}; %% 'tempTollChange' - <<2:2,_:1,3:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeTempTollChange'(Bytes1, mandatory, [{tag,128,3,'EXPLICIT',32}]), - {{tempTollChange, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131075, V1} -> + {tempTollChange, 'dec_KmeTempTollChange'(V1, [16])}; %% 'doorOpen' - <<2:2,_:1,4:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeDoorOpen'(Bytes1, mandatory, [{tag,128,4,'EXPLICIT',32}]), - {{doorOpen, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131076, V1} -> + {doorOpen, 'dec_KmeDoorOpen'(V1, [65547])}; %% 'twoWayRec' - <<2:2,_:1,5:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeTwoWayRec'(Bytes1, mandatory, [{tag,128,5,'EXPLICIT',32}]), - {{twoWayRec, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131077, V1} -> + {twoWayRec, 'dec_KmeTwoWayRec'(V1, [16])}; %% 'callBackInvoke' - <<2:2,_:1,6:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeCallBackInvoke'(Bytes1, mandatory, [{tag,128,6,'EXPLICIT',32}]), - {{callBackInvoke, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131078, V1} -> + {callBackInvoke, 'dec_KmeCallBackInvoke'(V1, [])}; %% 'pcRec' - <<2:2,_:1,7:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmePcRec'(Bytes1, mandatory, [{tag,128,7,'EXPLICIT',32}]), - {{pcRec, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131079, V1} -> + {pcRec, 'dec_KmePcRec'(V1, [16])}; %% 'switchChannel' - <<2:2,_:1,8:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeSwitchChannel'(Bytes1, mandatory, [{tag,128,8,'EXPLICIT',32}]), - {{switchChannel, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131080, V1} -> + {switchChannel, 'dec_KmeSwitchChannel'(V1, [65547])}; Else -> - case OptOrMand of - mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}}); - _ ->exit({error,{asn1,{no_optional_tag,Else}}}) - end - end. + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. %%================================ %% KmeDeviceStatus %%================================ - -'enc_KmeDeviceStatus'({'KmeDeviceStatus',Val}, TagIn) -> - 'enc_KmeDeviceStatus'(Val, TagIn); +'enc_KmeDeviceStatus'(Val) -> + 'enc_KmeDeviceStatus'(Val, []). 'enc_KmeDeviceStatus'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of agentStatus -> - 'enc_KmeDeviceAgentStatus'(element(2,Val), [{tag,128,0,'EXPLICIT',32}]); + 'enc_KmeDeviceAgentStatus'(element(2,Val), [<<48>>,<<160>>]); callStatus -> - 'enc_KmeDeviceCallStatus'(element(2,Val), [{tag,128,1,'EXPLICIT',32}]); + 'enc_KmeDeviceCallStatus'(element(2,Val), [<<48>>,<<161>>]); serviceStatus -> - 'enc_KmeDeviceServiceStatus'(element(2,Val), [{tag,128,2,'EXPLICIT',32}]); + 'enc_KmeDeviceServiceStatus'(element(2,Val), [<<48>>,<<162>>]); lineStatus -> - 'enc_KmeLineStatus'(element(2,Val), [{tag,128,3,'EXPLICIT',32}]); + 'enc_KmeLineStatus'(element(2,Val), [<<48>>,<<163>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). +encode_tags(TagIn, EncBytes, EncLen). -'dec_KmeDeviceStatus'(Bytes, OptOrMand) -> - 'dec_KmeDeviceStatus'(Bytes, OptOrMand, []). +'dec_KmeDeviceStatus'(Tlv) -> + 'dec_KmeDeviceStatus'(Tlv, []). -'dec_KmeDeviceStatus'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of +'dec_KmeDeviceStatus'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of %% 'agentStatus' - <<2:2,_:1,0:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeDeviceAgentStatus'(Bytes1, mandatory, [{tag,128,0,'EXPLICIT',32}]), - {{agentStatus, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131072, V1} -> + {agentStatus, 'dec_KmeDeviceAgentStatus'(V1, [16])}; %% 'callStatus' - <<2:2,_:1,1:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeDeviceCallStatus'(Bytes1, mandatory, [{tag,128,1,'EXPLICIT',32}]), - {{callStatus, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131073, V1} -> + {callStatus, 'dec_KmeDeviceCallStatus'(V1, [16])}; %% 'serviceStatus' - <<2:2,_:1,2:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeDeviceServiceStatus'(Bytes1, mandatory, [{tag,128,2,'EXPLICIT',32}]), - {{serviceStatus, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131074, V1} -> + {serviceStatus, 'dec_KmeDeviceServiceStatus'(V1, [16])}; %% 'lineStatus' - <<2:2,_:1,3:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeLineStatus'(Bytes1, mandatory, [{tag,128,3,'EXPLICIT',32}]), - {{lineStatus, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131075, V1} -> + {lineStatus, 'dec_KmeLineStatus'(V1, [16])}; Else -> - case OptOrMand of - mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}}); - _ ->exit({error,{asn1,{no_optional_tag,Else}}}) - end - end. + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. %%================================ %% KmeDeviceMonitor %%================================ - -'enc_KmeDeviceMonitor'({'KmeDeviceMonitor',Val}, TagIn) -> - 'enc_KmeDeviceMonitor'(Val, TagIn); +'enc_KmeDeviceMonitor'(Val) -> + 'enc_KmeDeviceMonitor'(Val, []). 'enc_KmeDeviceMonitor'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of startDeviceMonitor -> - 'enc_KmeStartDeviceMonitor'(element(2,Val), [{tag,128,0,'EXPLICIT',32}]); + 'enc_KmeStartDeviceMonitor'(element(2,Val), [<<160>>]); stopDeviceMonitor -> - ?RT_BER:encode_null(element(2,Val), [{tag,128,1,'EXPLICIT',32}]); + encode_null(element(2,Val), [<<5>>,<<161>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). +encode_tags(TagIn, EncBytes, EncLen). -'dec_KmeDeviceMonitor'(Bytes, OptOrMand) -> - 'dec_KmeDeviceMonitor'(Bytes, OptOrMand, []). +'dec_KmeDeviceMonitor'(Tlv) -> + 'dec_KmeDeviceMonitor'(Tlv, []). -'dec_KmeDeviceMonitor'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of +'dec_KmeDeviceMonitor'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of %% 'startDeviceMonitor' - <<2:2,_:1,0:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeStartDeviceMonitor'(Bytes1, mandatory, [{tag,128,0,'EXPLICIT',32}]), - {{startDeviceMonitor, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131072, V1} -> + {startDeviceMonitor, 'dec_KmeStartDeviceMonitor'(V1, [])}; %% 'stopDeviceMonitor' - <<2:2,_:1,1:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_null(Bytes1,[{tag,128,1,'EXPLICIT',32}], mandatory), - {{stopDeviceMonitor, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131073, V1} -> + {stopDeviceMonitor, decode_null(V1, [5])}; Else -> - case OptOrMand of - mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}}); - _ ->exit({error,{asn1,{no_optional_tag,Else}}}) - end - end. + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. %%================================ %% KmeSystemData %%================================ - -'enc_KmeSystemData'({'KmeSystemData',Val}, TagIn) -> - 'enc_KmeSystemData'(Val, TagIn); +'enc_KmeSystemData'(Val) -> + 'enc_KmeSystemData'(Val, []). 'enc_KmeSystemData'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of getSystemData -> - 'enc_KmeGetSystemData'(element(2,Val), [{tag,128,0,'EXPLICIT',32}]); + 'enc_KmeGetSystemData'(element(2,Val), [<<160>>]); setSystemData -> - 'enc_KmeSetSystemData'(element(2,Val), [{tag,128,1,'EXPLICIT',32}]); + 'enc_KmeSetSystemData'(element(2,Val), [<<161>>]); systemDataChanged -> - 'enc_KmeSystemDataChanged'(element(2,Val), [{tag,128,2,'EXPLICIT',32}]); + 'enc_KmeSystemDataChanged'(element(2,Val), [<<162>>]); systemDataLinkedReply -> - 'enc_KmeSystemDataLinkedReply'(element(2,Val), [{tag,128,3,'EXPLICIT',32}]); + 'enc_KmeSystemDataLinkedReply'(element(2,Val), [<<48>>,<<163>>]); getSystemDataPosAck -> - ?RT_BER:encode_octet_string([], element(2,Val), [{tag,128,4,'EXPLICIT',32}]); + encode_restricted_string(element(2,Val), [<<4>>,<<164>>]); lockSystemData -> - 'enc_KmeLockSystemData'(element(2,Val), [{tag,128,5,'EXPLICIT',32}]); + 'enc_KmeLockSystemData'(element(2,Val), [<<165>>]); systemDataStatus -> - 'enc_KmeSystemDataStatus'(element(2,Val), [{tag,128,6,'EXPLICIT',32}]); + 'enc_KmeSystemDataStatus'(element(2,Val), [<<48>>,<<166>>]); dataRevisionRecord -> - ?RT_BER:encode_octet_string([], element(2,Val), [{tag,128,7,'EXPLICIT',32}]); + encode_restricted_string(element(2,Val), [<<4>>,<<167>>]); getDataRevisionRecord -> - 'enc_KmeGetSystemDataRevision'(element(2,Val), [{tag,128,8,'EXPLICIT',32}]); + 'enc_KmeGetSystemDataRevision'(element(2,Val), [<<168>>]); setprogrammingEventOn -> - 'enc_KmeSetProgrammingEventOn'(element(2,Val), [{tag,128,9,'EXPLICIT',32}]); + 'enc_KmeSetProgrammingEventOn'(element(2,Val), [<<169>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). +encode_tags(TagIn, EncBytes, EncLen). -'dec_KmeSystemData'(Bytes, OptOrMand) -> - 'dec_KmeSystemData'(Bytes, OptOrMand, []). +'dec_KmeSystemData'(Tlv) -> + 'dec_KmeSystemData'(Tlv, []). -'dec_KmeSystemData'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of +'dec_KmeSystemData'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of %% 'getSystemData' - <<2:2,_:1,0:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeGetSystemData'(Bytes1, mandatory, [{tag,128,0,'EXPLICIT',32}]), - {{getSystemData, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131072, V1} -> + {getSystemData, 'dec_KmeGetSystemData'(V1, [])}; %% 'setSystemData' - <<2:2,_:1,1:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeSetSystemData'(Bytes1, mandatory, [{tag,128,1,'EXPLICIT',32}]), - {{setSystemData, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131073, V1} -> + {setSystemData, 'dec_KmeSetSystemData'(V1, [])}; %% 'systemDataChanged' - <<2:2,_:1,2:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeSystemDataChanged'(Bytes1, mandatory, [{tag,128,2,'EXPLICIT',32}]), - {{systemDataChanged, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131074, V1} -> + {systemDataChanged, 'dec_KmeSystemDataChanged'(V1, [])}; %% 'systemDataLinkedReply' - <<2:2,_:1,3:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeSystemDataLinkedReply'(Bytes1, mandatory, [{tag,128,3,'EXPLICIT',32}]), - {{systemDataLinkedReply, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131075, V1} -> + {systemDataLinkedReply, 'dec_KmeSystemDataLinkedReply'(V1, [16])}; %% 'getSystemDataPosAck' - <<2:2,_:1,4:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_octet_string(Bytes1,[],[{tag,128,4,'EXPLICIT',32}], no_length, mandatory), - {{getSystemDataPosAck, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131076, V1} -> + {getSystemDataPosAck, decode_octet_string(V1, [4])}; %% 'lockSystemData' - <<2:2,_:1,5:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeLockSystemData'(Bytes1, mandatory, [{tag,128,5,'EXPLICIT',32}]), - {{lockSystemData, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131077, V1} -> + {lockSystemData, 'dec_KmeLockSystemData'(V1, [])}; %% 'systemDataStatus' - <<2:2,_:1,6:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeSystemDataStatus'(Bytes1, mandatory, [{tag,128,6,'EXPLICIT',32}]), - {{systemDataStatus, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131078, V1} -> + {systemDataStatus, 'dec_KmeSystemDataStatus'(V1, [16])}; %% 'dataRevisionRecord' - <<2:2,_:1,7:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_octet_string(Bytes1,{0,128},[{tag,128,7,'EXPLICIT',32}], no_length, mandatory), - {{dataRevisionRecord, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131079, V1} -> + {dataRevisionRecord, begin +Val1 = decode_octet_string(V1, [4]), +C1 = byte_size(Val1), +if 0 =< C1, C1 =< 128 -> +Val1; +true -> +exit({error,{asn1,bad_range}}) +end +end}; %% 'getDataRevisionRecord' - <<2:2,_:1,8:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeGetSystemDataRevision'(Bytes1, mandatory, [{tag,128,8,'EXPLICIT',32}]), - {{getDataRevisionRecord, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131080, V1} -> + {getDataRevisionRecord, 'dec_KmeGetSystemDataRevision'(V1, [])}; %% 'setprogrammingEventOn' - <<2:2,_:1,9:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeSetProgrammingEventOn'(Bytes1, mandatory, [{tag,128,9,'EXPLICIT',32}]), - {{setprogrammingEventOn, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131081, V1} -> + {setprogrammingEventOn, 'dec_KmeSetProgrammingEventOn'(V1, [])}; Else -> - case OptOrMand of - mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}}); - _ ->exit({error,{asn1,{no_optional_tag,Else}}}) - end - end. + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. %%================================ %% KmeAdditionalData %%================================ - -'enc_KmeAdditionalData'({'KmeAdditionalData',Val}, TagIn) -> - 'enc_KmeAdditionalData'(Val, TagIn); +'enc_KmeAdditionalData'(Val) -> + 'enc_KmeAdditionalData'(Val, []). 'enc_KmeAdditionalData'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of fowardType -> - case (case element(2,Val) of {_,Enumval1}->Enumval1;_->element(2,Val) end) of -forwardImmediate -> ?RT_BER:encode_enumerated(0,[{tag,128,1,'EXPLICIT',32}]); -forwardBusy -> ?RT_BER:encode_enumerated(1,[{tag,128,1,'EXPLICIT',32}]); -forwardNoAns -> ?RT_BER:encode_enumerated(2,[{tag,128,1,'EXPLICIT',32}]); -forwardBusyInt -> ?RT_BER:encode_enumerated(3,[{tag,128,1,'EXPLICIT',32}]); -forwardBusyExt -> ?RT_BER:encode_enumerated(4,[{tag,128,1,'EXPLICIT',32}]); -forwardNoAnsInt -> ?RT_BER:encode_enumerated(5,[{tag,128,1,'EXPLICIT',32}]); -forwardNoAnsExt -> ?RT_BER:encode_enumerated(6,[{tag,128,1,'EXPLICIT',32}]); -forwardImmInt -> ?RT_BER:encode_enumerated(7,[{tag,128,1,'EXPLICIT',32}]); -forwardImmExt -> ?RT_BER:encode_enumerated(8,[{tag,128,1,'EXPLICIT',32}]); -forwardDND -> ?RT_BER:encode_enumerated(9,[{tag,128,1,'EXPLICIT',32}]); -forwardDNDInt -> ?RT_BER:encode_enumerated(10,[{tag,128,1,'EXPLICIT',32}]); -forwardDNDExt -> ?RT_BER:encode_enumerated(11,[{tag,128,1,'EXPLICIT',32}]); -forwardBusyNoAnswer -> ?RT_BER:encode_enumerated(12,[{tag,128,1,'EXPLICIT',32}]); -forwardBusyNoAnswerInt -> ?RT_BER:encode_enumerated(13,[{tag,128,1,'EXPLICIT',32}]); -forwardBusyNoAnswerExt -> ?RT_BER:encode_enumerated(14,[{tag,128,1,'EXPLICIT',32}]); -Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) + case element(2,Val) of +forwardImmediate -> encode_tags([<<10>>,<<161>>], [0], 1); +forwardBusy -> encode_tags([<<10>>,<<161>>], [1], 1); +forwardNoAns -> encode_tags([<<10>>,<<161>>], [2], 1); +forwardBusyInt -> encode_tags([<<10>>,<<161>>], [3], 1); +forwardBusyExt -> encode_tags([<<10>>,<<161>>], [4], 1); +forwardNoAnsInt -> encode_tags([<<10>>,<<161>>], [5], 1); +forwardNoAnsExt -> encode_tags([<<10>>,<<161>>], [6], 1); +forwardImmInt -> encode_tags([<<10>>,<<161>>], [7], 1); +forwardImmExt -> encode_tags([<<10>>,<<161>>], [8], 1); +forwardDND -> encode_tags([<<10>>,<<161>>], [9], 1); +forwardDNDInt -> encode_tags([<<10>>,<<161>>], [10], 1); +forwardDNDExt -> encode_tags([<<10>>,<<161>>], [11], 1); +forwardBusyNoAnswer -> encode_tags([<<10>>,<<161>>], [12], 1); +forwardBusyNoAnswerInt -> encode_tags([<<10>>,<<161>>], [13], 1); +forwardBusyNoAnswerExt -> encode_tags([<<10>>,<<161>>], [14], 1); +Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}}) end; trunkId -> - 'enc_KmeTrunkId'(element(2,Val), [{tag,128,2,'EXPLICIT',32}]); + 'enc_KmeTrunkId'(element(2,Val), [<<48>>,<<162>>]); otherDevice -> - case (case element(2,Val) of {_,Enumval3}->Enumval3;_->element(2,Val) end) of -vm -> ?RT_BER:encode_enumerated(0,[{tag,128,3,'EXPLICIT',32}]); -doorPhone -> ?RT_BER:encode_enumerated(1,[{tag,128,3,'EXPLICIT',32}]); -disa -> ?RT_BER:encode_enumerated(2,[{tag,128,3,'EXPLICIT',32}]); -pagingGroup -> ?RT_BER:encode_enumerated(3,[{tag,128,3,'EXPLICIT',32}]); -psGruop -> ?RT_BER:encode_enumerated(4,[{tag,128,3,'EXPLICIT',32}]); -externalRinger -> ?RT_BER:encode_enumerated(5,[{tag,128,3,'EXPLICIT',32}]); -externalSensor -> ?RT_BER:encode_enumerated(6,[{tag,128,3,'EXPLICIT',32}]); -externalPager -> ?RT_BER:encode_enumerated(7,[{tag,128,3,'EXPLICIT',32}]); -modem -> ?RT_BER:encode_enumerated(8,[{tag,128,3,'EXPLICIT',32}]); -hdlc -> ?RT_BER:encode_enumerated(9,[{tag,128,3,'EXPLICIT',32}]); -pbxSystem -> ?RT_BER:encode_enumerated(10,[{tag,128,3,'EXPLICIT',32}]); -svm -> ?RT_BER:encode_enumerated(11,[{tag,128,3,'EXPLICIT',32}]); -Enumval4 -> exit({error,{asn1, {enumerated_not_in_range,Enumval4}}}) + case element(2,Val) of +vm -> encode_tags([<<10>>,<<163>>], [0], 1); +doorPhone -> encode_tags([<<10>>,<<163>>], [1], 1); +disa -> encode_tags([<<10>>,<<163>>], [2], 1); +pagingGroup -> encode_tags([<<10>>,<<163>>], [3], 1); +psGruop -> encode_tags([<<10>>,<<163>>], [4], 1); +externalRinger -> encode_tags([<<10>>,<<163>>], [5], 1); +externalSensor -> encode_tags([<<10>>,<<163>>], [6], 1); +externalPager -> encode_tags([<<10>>,<<163>>], [7], 1); +modem -> encode_tags([<<10>>,<<163>>], [8], 1); +hdlc -> encode_tags([<<10>>,<<163>>], [9], 1); +pbxSystem -> encode_tags([<<10>>,<<163>>], [10], 1); +svm -> encode_tags([<<10>>,<<163>>], [11], 1); +Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) end; vmRecExtNo -> - ?RT_BER:encode_restricted_string([], element(2,Val), 22, [{tag,128,4,'EXPLICIT',32}]); + encode_restricted_string(element(2,Val), [<<22>>,<<164>>]); deviceCategory -> - 'enc_KmeChangedDeviceCategory'(element(2,Val), [{tag,128,5,'EXPLICIT',32}]); + 'enc_KmeChangedDeviceCategory'(element(2,Val), [<<165>>]); device -> - 'CSTA-device-identifiers':'enc_DeviceID'(element(2,Val), [{tag,128,6,'EXPLICIT',32}]); + 'CSTA-device-identifiers':'enc_DeviceID'(element(2,Val), [<<48>>,<<166>>]); featureNumber -> - ?RT_BER:encode_integer([], element(2,Val), [{tag,128,7,'EXPLICIT',32}]); + encode_integer(element(2,Val), [<<2>>,<<167>>]); proprietaryContents -> - ?RT_BER:encode_octet_string([], element(2,Val), [{tag,128,8,'EXPLICIT',32}]); + encode_restricted_string(element(2,Val), [<<4>>,<<168>>]); holdType -> - case (case element(2,Val) of {_,Enumval8}->Enumval8;_->element(2,Val) end) of -consultation -> ?RT_BER:encode_enumerated(0,[{tag,128,9,'EXPLICIT',32}]); -normal -> ?RT_BER:encode_enumerated(1,[{tag,128,9,'EXPLICIT',32}]); -exclusive -> ?RT_BER:encode_enumerated(2,[{tag,128,9,'EXPLICIT',32}]); -Enumval9 -> exit({error,{asn1, {enumerated_not_in_range,Enumval9}}}) + case element(2,Val) of +consultation -> encode_tags([<<10>>,<<169>>], [0], 1); +normal -> encode_tags([<<10>>,<<169>>], [1], 1); +exclusive -> encode_tags([<<10>>,<<169>>], [2], 1); +Enumval6 -> exit({error,{asn1, {enumerated_not_in_range,Enumval6}}}) end; conditionCode -> - case (case element(2,Val) of {_,Enumval10}->Enumval10;_->element(2,Val) end) of -cl -> ?RT_BER:encode_enumerated(0,[{tag,128,10,'EXPLICIT',32}]); -tr -> ?RT_BER:encode_enumerated(1,[{tag,128,10,'EXPLICIT',32}]); -fw -> ?RT_BER:encode_enumerated(2,[{tag,128,10,'EXPLICIT',32}]); -d0 -> ?RT_BER:encode_enumerated(3,[{tag,128,10,'EXPLICIT',32}]); -rm -> ?RT_BER:encode_enumerated(4,[{tag,128,10,'EXPLICIT',32}]); -na -> ?RT_BER:encode_enumerated(5,[{tag,128,10,'EXPLICIT',32}]); -Enumval11 -> exit({error,{asn1, {enumerated_not_in_range,Enumval11}}}) + case element(2,Val) of +cl -> encode_tags([<<10>>,<<170>>], [0], 1); +tr -> encode_tags([<<10>>,<<170>>], [1], 1); +fw -> encode_tags([<<10>>,<<170>>], [2], 1); +d0 -> encode_tags([<<10>>,<<170>>], [3], 1); +rm -> encode_tags([<<10>>,<<170>>], [4], 1); +na -> encode_tags([<<10>>,<<170>>], [5], 1); +Enumval7 -> exit({error,{asn1, {enumerated_not_in_range,Enumval7}}}) end; lockDisplay -> - ?RT_BER:encode_boolean(element(2,Val), [{tag,128,11,'EXPLICIT',32}]); + encode_boolean(element(2,Val), [<<1>>,<<171>>]); forcedAlerting -> - ?RT_BER:encode_bit_string([], element(2,Val), [{fwdDnd,0},{timer,1}], [{tag,128,12,'EXPLICIT',32}]); + encode_named_bit_string(element(2,Val), [{fwdDnd,0},{timer,1}], [<<3>>,<<172>>]); callID -> - ?RT_BER:encode_octet_string([], element(2,Val), [{tag,128,13,'EXPLICIT',32}]); + encode_restricted_string(element(2,Val), [<<4>>,<<173>>]); ogmContinuation -> - ?RT_BER:encode_boolean(element(2,Val), [{tag,128,14,'EXPLICIT',32}]); + encode_boolean(element(2,Val), [<<1>>,<<174>>]); broadcastGroupNo -> - ?RT_BER:encode_integer([], element(2,Val), [{tag,128,15,'EXPLICIT',32}]); + encode_integer(element(2,Val), [<<2>>,<<175>>]); ringPattern -> - ?RT_BER:encode_integer([], element(2,Val), [{tag,128,16,'EXPLICIT',32}]); + encode_integer(element(2,Val), [<<2>>,<<176>>]); didNo -> - 'CSTA-device-identifiers':'enc_DeviceID'(element(2,Val), [{tag,128,17,'EXPLICIT',32}]); + 'CSTA-device-identifiers':'enc_DeviceID'(element(2,Val), [<<48>>,<<177>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). +encode_tags(TagIn, EncBytes, EncLen). -'dec_KmeAdditionalData'(Bytes, OptOrMand) -> - 'dec_KmeAdditionalData'(Bytes, OptOrMand, []). +'dec_KmeAdditionalData'(Tlv) -> + 'dec_KmeAdditionalData'(Tlv, []). -'dec_KmeAdditionalData'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of +'dec_KmeAdditionalData'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of %% 'fowardType' - <<2:2,_:1,1:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_enumerated(Bytes1,[],[{forwardImmediate,0},{forwardBusy,1},{forwardNoAns,2},{forwardBusyInt,3},{forwardBusyExt,4},{forwardNoAnsInt,5},{forwardNoAnsExt,6},{forwardImmInt,7},{forwardImmExt,8},{forwardDND,9},{forwardDNDInt,10},{forwardDNDExt,11},{forwardBusyNoAnswer,12},{forwardBusyNoAnswerInt,13},{forwardBusyNoAnswerExt,14}],[{tag,128,1,'EXPLICIT',32}], mandatory), - {{fowardType, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131073, V1} -> + {fowardType, case decode_integer(V1, [10]) of +0 -> forwardImmediate; +1 -> forwardBusy; +2 -> forwardNoAns; +3 -> forwardBusyInt; +4 -> forwardBusyExt; +5 -> forwardNoAnsInt; +6 -> forwardNoAnsExt; +7 -> forwardImmInt; +8 -> forwardImmExt; +9 -> forwardDND; +10 -> forwardDNDInt; +11 -> forwardDNDExt; +12 -> forwardBusyNoAnswer; +13 -> forwardBusyNoAnswerInt; +14 -> forwardBusyNoAnswerExt; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end}; %% 'trunkId' - <<2:2,_:1,2:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeTrunkId'(Bytes1, mandatory, [{tag,128,2,'EXPLICIT',32}]), - {{trunkId, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131074, V1} -> + {trunkId, 'dec_KmeTrunkId'(V1, [16])}; %% 'otherDevice' - <<2:2,_:1,3:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_enumerated(Bytes1,[],[{vm,0},{doorPhone,1},{disa,2},{pagingGroup,3},{psGruop,4},{externalRinger,5},{externalSensor,6},{externalPager,7},{modem,8},{hdlc,9},{pbxSystem,10},{svm,11}],[{tag,128,3,'EXPLICIT',32}], mandatory), - {{otherDevice, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131075, V1} -> + {otherDevice, case decode_integer(V1, [10]) of +0 -> vm; +1 -> doorPhone; +2 -> disa; +3 -> pagingGroup; +4 -> psGruop; +5 -> externalRinger; +6 -> externalSensor; +7 -> externalPager; +8 -> modem; +9 -> hdlc; +10 -> pbxSystem; +11 -> svm; +Default2 -> exit({error,{asn1,{illegal_enumerated,Default2}}}) +end}; %% 'vmRecExtNo' - <<2:2,_:1,4:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_restricted_string(Bytes1,{1,5},22,[{tag,128,4,'EXPLICIT',32}], no_length, mandatory), - {{vmRecExtNo, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131076, V1} -> + {vmRecExtNo, begin +Val1 = decode_restricted_string(V1, [22]), +C1 = byte_size(Val1), +if 1 =< C1, C1 =< 5 -> +binary_to_list(Val1); +true -> +exit({error,{asn1,bad_range}}) +end +end}; %% 'deviceCategory' - <<2:2,_:1,5:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeChangedDeviceCategory'(Bytes1, mandatory, [{tag,128,5,'EXPLICIT',32}]), - {{deviceCategory, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131077, V1} -> + {deviceCategory, 'dec_KmeChangedDeviceCategory'(V1, [])}; %% 'device' - <<2:2,_:1,6:5,_/binary>> -> - {Dec, Rest, RbCho} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes1, mandatory, [{tag,128,6,'EXPLICIT',32}]), - {{device, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131078, V1} -> + {device, 'CSTA-device-identifiers':'dec_DeviceID'(V1, [16])}; %% 'featureNumber' - <<2:2,_:1,7:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_integer(Bytes1,[],[{tag,128,7,'EXPLICIT',32}], mandatory), - {{featureNumber, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131079, V1} -> + {featureNumber, decode_integer(V1, [2])}; %% 'proprietaryContents' - <<2:2,_:1,8:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_octet_string(Bytes1,{0,144},[{tag,128,8,'EXPLICIT',32}], no_length, mandatory), - {{proprietaryContents, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131080, V1} -> + {proprietaryContents, begin +Val2 = decode_octet_string(V1, [4]), +C2 = byte_size(Val2), +if 0 =< C2, C2 =< 144 -> +Val2; +true -> +exit({error,{asn1,bad_range}}) +end +end}; %% 'holdType' - <<2:2,_:1,9:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_enumerated(Bytes1,[],[{consultation,0},{normal,1},{exclusive,2}],[{tag,128,9,'EXPLICIT',32}], mandatory), - {{holdType, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131081, V1} -> + {holdType, case decode_integer(V1, [10]) of +0 -> consultation; +1 -> normal; +2 -> exclusive; +Default3 -> exit({error,{asn1,{illegal_enumerated,Default3}}}) +end}; %% 'conditionCode' - <<2:2,_:1,10:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_enumerated(Bytes1,[],[{cl,0},{tr,1},{fw,2},{d0,3},{rm,4},{na,5}],[{tag,128,10,'EXPLICIT',32}], mandatory), - {{conditionCode, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131082, V1} -> + {conditionCode, case decode_integer(V1, [10]) of +0 -> cl; +1 -> tr; +2 -> fw; +3 -> d0; +4 -> rm; +5 -> na; +Default4 -> exit({error,{asn1,{illegal_enumerated,Default4}}}) +end}; %% 'lockDisplay' - <<2:2,_:1,11:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_boolean(Bytes1,[{tag,128,11,'EXPLICIT',32}], mandatory), - {{lockDisplay, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131083, V1} -> + {lockDisplay, decode_boolean(V1, [1])}; %% 'forcedAlerting' - <<2:2,_:1,12:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_bit_string(Bytes1,[],[{fwdDnd,0},{timer,1}],[{tag,128,12,'EXPLICIT',32}], no_length, mandatory), - {{forcedAlerting, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131084, V1} -> + {forcedAlerting, decode_named_bit_string(V1, [{fwdDnd,0},{timer,1}], [3])}; %% 'callID' - <<2:2,_:1,13:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_octet_string(Bytes1,[],[{tag,128,13,'EXPLICIT',32}], no_length, mandatory), - {{callID, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131085, V1} -> + {callID, decode_octet_string(V1, [4])}; %% 'ogmContinuation' - <<2:2,_:1,14:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_boolean(Bytes1,[{tag,128,14,'EXPLICIT',32}], mandatory), - {{ogmContinuation, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131086, V1} -> + {ogmContinuation, decode_boolean(V1, [1])}; %% 'broadcastGroupNo' - <<2:2,_:1,15:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_integer(Bytes1,[],[{tag,128,15,'EXPLICIT',32}], mandatory), - {{broadcastGroupNo, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131087, V1} -> + {broadcastGroupNo, decode_integer(V1, [2])}; %% 'ringPattern' - <<2:2,_:1,16:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_integer(Bytes1,[],[{tag,128,16,'EXPLICIT',32}], mandatory), - {{ringPattern, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131088, V1} -> + {ringPattern, decode_integer(V1, [2])}; %% 'didNo' - <<2:2,_:1,17:5,_/binary>> -> - {Dec, Rest, RbCho} = 'CSTA-device-identifiers':'dec_DeviceID'(Bytes1, mandatory, [{tag,128,17,'EXPLICIT',32}]), - {{didNo, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131089, V1} -> + {didNo, 'CSTA-device-identifiers':'dec_DeviceID'(V1, [16])}; Else -> - case OptOrMand of - mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}}); - _ ->exit({error,{asn1,{no_optional_tag,Else}}}) - end - end. + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. %%================================ %% KmePrivateEvent %%================================ - -'enc_KmePrivateEvent'({'KmePrivateEvent',Val}, TagIn) -> - 'enc_KmePrivateEvent'(Val, TagIn); +'enc_KmePrivateEvent'(Val) -> + 'enc_KmePrivateEvent'(Val, []). 'enc_KmePrivateEvent'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of digitsReport -> - 'enc_KmeDigitsReport'(element(2,Val), [{tag,128,1,'EXPLICIT',32}]); + 'enc_KmeDigitsReport'(element(2,Val), [<<48>>,<<161>>]); ogmStatus -> - 'enc_KmeOgmStatus'(element(2,Val), [{tag,128,2,'EXPLICIT',32}]); + 'enc_KmeOgmStatus'(element(2,Val), [<<48>>,<<162>>]); wakeupResult -> - 'enc_KmeWakeupResult'(element(2,Val), [{tag,128,3,'EXPLICIT',32}]); + 'enc_KmeWakeupResult'(element(2,Val), [<<48>>,<<163>>]); unconferenced -> - 'enc_KmeUnconferenced'(element(2,Val), [{tag,128,4,'EXPLICIT',32}]); + 'enc_KmeUnconferenced'(element(2,Val), [<<48>>,<<164>>]); tamEnded -> - 'enc_KmeTamEnded'(element(2,Val), [{tag,128,5,'EXPLICIT',32}]); + 'enc_KmeTamEnded'(element(2,Val), [<<107>>,<<165>>]); pcRecEnded -> - 'enc_KmePcRecEnded'(element(2,Val), [{tag,128,6,'EXPLICIT',32}]); + 'enc_KmePcRecEnded'(element(2,Val), [<<107>>,<<166>>]); callbackNotification -> - 'enc_CallBackNotification'(element(2,Val), [{tag,128,7,'EXPLICIT',32}]); + 'enc_CallBackNotification'(element(2,Val), [<<48>>,<<167>>]); freeOgmPort -> - ?RT_BER:encode_integer([], element(2,Val), [{tag,128,8,'EXPLICIT',32}]); + encode_integer(element(2,Val), [<<2>>,<<168>>]); pDFStatus -> - 'enc_KmePDFStatus'(element(2,Val), [{tag,128,9,'EXPLICIT',32}]); + 'enc_KmePDFStatus'(element(2,Val), [<<48>>,<<169>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). +encode_tags(TagIn, EncBytes, EncLen). -'dec_KmePrivateEvent'(Bytes, OptOrMand) -> - 'dec_KmePrivateEvent'(Bytes, OptOrMand, []). +'dec_KmePrivateEvent'(Tlv) -> + 'dec_KmePrivateEvent'(Tlv, []). -'dec_KmePrivateEvent'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of +'dec_KmePrivateEvent'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of %% 'digitsReport' - <<2:2,_:1,1:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeDigitsReport'(Bytes1, mandatory, [{tag,128,1,'EXPLICIT',32}]), - {{digitsReport, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131073, V1} -> + {digitsReport, 'dec_KmeDigitsReport'(V1, [16])}; %% 'ogmStatus' - <<2:2,_:1,2:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeOgmStatus'(Bytes1, mandatory, [{tag,128,2,'EXPLICIT',32}]), - {{ogmStatus, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131074, V1} -> + {ogmStatus, 'dec_KmeOgmStatus'(V1, [16])}; %% 'wakeupResult' - <<2:2,_:1,3:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeWakeupResult'(Bytes1, mandatory, [{tag,128,3,'EXPLICIT',32}]), - {{wakeupResult, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131075, V1} -> + {wakeupResult, 'dec_KmeWakeupResult'(V1, [16])}; %% 'unconferenced' - <<2:2,_:1,4:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeUnconferenced'(Bytes1, mandatory, [{tag,128,4,'EXPLICIT',32}]), - {{unconferenced, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131076, V1} -> + {unconferenced, 'dec_KmeUnconferenced'(V1, [16])}; %% 'tamEnded' - <<2:2,_:1,5:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeTamEnded'(Bytes1, mandatory, [{tag,128,5,'EXPLICIT',32}]), - {{tamEnded, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131077, V1} -> + {tamEnded, 'dec_KmeTamEnded'(V1, [65547])}; %% 'pcRecEnded' - <<2:2,_:1,6:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmePcRecEnded'(Bytes1, mandatory, [{tag,128,6,'EXPLICIT',32}]), - {{pcRecEnded, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131078, V1} -> + {pcRecEnded, 'dec_KmePcRecEnded'(V1, [65547])}; %% 'callbackNotification' - <<2:2,_:1,7:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_CallBackNotification'(Bytes1, mandatory, [{tag,128,7,'EXPLICIT',32}]), - {{callbackNotification, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131079, V1} -> + {callbackNotification, 'dec_CallBackNotification'(V1, [16])}; %% 'freeOgmPort' - <<2:2,_:1,8:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_integer(Bytes1,[],[{tag,128,8,'EXPLICIT',32}], mandatory), - {{freeOgmPort, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131080, V1} -> + {freeOgmPort, decode_integer(V1, [2])}; %% 'pDFStatus' - <<2:2,_:1,9:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmePDFStatus'(Bytes1, mandatory, [{tag,128,9,'EXPLICIT',32}]), - {{pDFStatus, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131081, V1} -> + {pDFStatus, 'dec_KmePDFStatus'(V1, [16])}; Else -> - case OptOrMand of - mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}}); - _ ->exit({error,{asn1,{no_optional_tag,Else}}}) - end - end. + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. %%================================ %% KmeResourceControl %%================================ - -'enc_KmeResourceControl'({'KmeResourceControl',Val}, TagIn) -> - 'enc_KmeResourceControl'(Val, TagIn); +'enc_KmeResourceControl'(Val) -> + 'enc_KmeResourceControl'(Val, []). 'enc_KmeResourceControl'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of ogmStart -> - 'enc_KmeOgmStart'(element(2,Val), [{tag,128,0,'EXPLICIT',32}]); + 'enc_KmeOgmStart'(element(2,Val), [<<48>>,<<160>>]); ogmStop -> - 'enc_KmeOgmStop'(element(2,Val), [{tag,128,1,'EXPLICIT',32}]); + 'enc_KmeOgmStop'(element(2,Val), [<<107>>,<<161>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). +encode_tags(TagIn, EncBytes, EncLen). -'dec_KmeResourceControl'(Bytes, OptOrMand) -> - 'dec_KmeResourceControl'(Bytes, OptOrMand, []). +'dec_KmeResourceControl'(Tlv) -> + 'dec_KmeResourceControl'(Tlv, []). -'dec_KmeResourceControl'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of +'dec_KmeResourceControl'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of %% 'ogmStart' - <<2:2,_:1,0:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeOgmStart'(Bytes1, mandatory, [{tag,128,0,'EXPLICIT',32}]), - {{ogmStart, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131072, V1} -> + {ogmStart, 'dec_KmeOgmStart'(V1, [16])}; %% 'ogmStop' - <<2:2,_:1,1:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeOgmStop'(Bytes1, mandatory, [{tag,128,1,'EXPLICIT',32}]), - {{ogmStop, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131073, V1} -> + {ogmStop, 'dec_KmeOgmStop'(V1, [65547])}; Else -> - case OptOrMand of - mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}}); - _ ->exit({error,{asn1,{no_optional_tag,Else}}}) - end - end. + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. %%================================ %% KmeOgmStart %%================================ +'enc_KmeOgmStart'(Val) -> + 'enc_KmeOgmStart'(Val, [<<48>>]). + 'enc_KmeOgmStart'(Val, TagIn) -> +{_,Cindex1, Cindex2} = Val, %%------------------------------------------------- -%% attribute number 1 External CSTA-call-connection-identifiers:ConnectionID +%% attribute connection(1) External CSTA-call-connection-identifiers:ConnectionID %%------------------------------------------------- - {EncBytes1,EncLen1} = 'CSTA-call-connection-identifiers':'enc_ConnectionID'(?RT_BER:cindex(2,Val,connection), []), + {EncBytes1,EncLen1} = 'CSTA-call-connection-identifiers':'enc_ConnectionID'(Cindex1, [<<107>>]), %%------------------------------------------------- -%% attribute number 2 with type INTEGER +%% attribute ogmId(2) with type INTEGER %%------------------------------------------------- - {EncBytes2,EncLen2} = ?RT_BER:encode_integer([], ?RT_BER:cindex(3,Val,ogmId), []), + {EncBytes2,EncLen2} = encode_integer(Cindex2, [<<2>>]), BytesSoFar = [EncBytes1, EncBytes2], - LenSoFar = EncLen1 + EncLen2, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2, +encode_tags(TagIn, BytesSoFar, LenSoFar). -'dec_KmeOgmStart'(Bytes, OptOrMand) -> - 'dec_KmeOgmStart'(Bytes, OptOrMand, []). +'dec_KmeOgmStart'(Tlv) -> + 'dec_KmeOgmStart'(Tlv, [16]). -'dec_KmeOgmStart'(Bytes, OptOrMand, TagIn) -> +'dec_KmeOgmStart'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 External CSTA-call-connection-identifiers:ConnectionID +%% attribute connection(1) External CSTA-call-connection-identifiers:ConnectionID %%------------------------------------------------- - {Term1,Bytes3,Rb2} = 'CSTA-call-connection-identifiers':'dec_ConnectionID'(Bytes2, mandatory, []), +[V1|Tlv2] = Tlv1, +Term1 = 'CSTA-call-connection-identifiers':'dec_ConnectionID'(V1, [65547]), %%------------------------------------------------- -%% attribute number 2 with type INTEGER +%% attribute ogmId(2) with type INTEGER %%------------------------------------------------- - {Term2,Bytes4,Rb3} = ?RT_BER:decode_integer(Bytes3,[],[], mandatory), +[V2|Tlv3] = Tlv2, +Term2 = decode_integer(V2, [2]), + +case Tlv3 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed +end, + {'KmeOgmStart', Term1, Term2}. - {Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext), - {{'KmeOgmStart', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}. %%================================ %% KmeOgmStop %%================================ - -'enc_KmeOgmStop'({'KmeOgmStop',Val}, TagIn) -> - 'enc_KmeOgmStop'(Val, TagIn); +'enc_KmeOgmStop'(Val) -> + 'enc_KmeOgmStop'(Val, [<<107>>]). 'enc_KmeOgmStop'(Val, TagIn) -> - 'CSTA-call-connection-identifiers':'enc_ConnectionID'(Val, TagIn ++ []). + 'CSTA-call-connection-identifiers':'enc_ConnectionID'(Val, TagIn). -'dec_KmeOgmStop'(Bytes, OptOrMand) -> - 'dec_KmeOgmStop'(Bytes, OptOrMand, []). +'dec_KmeOgmStop'(Tlv) -> + 'dec_KmeOgmStop'(Tlv, [65547]). -'dec_KmeOgmStop'(Bytes, OptOrMand, TagIn) -> -'CSTA-call-connection-identifiers':'dec_ConnectionID'(Bytes, OptOrMand, TagIn++[]). +'dec_KmeOgmStop'(Tlv, TagIn) -> +'CSTA-call-connection-identifiers':'dec_ConnectionID'(Tlv, TagIn). %%================================ %% KmeGenericSrvEvt %%================================ - -'enc_KmeGenericSrvEvt'({'KmeGenericSrvEvt',Val}, TagIn) -> - 'enc_KmeGenericSrvEvt'(Val, TagIn); +'enc_KmeGenericSrvEvt'(Val) -> + 'enc_KmeGenericSrvEvt'(Val, []). 'enc_KmeGenericSrvEvt'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of serviceRequest -> - 'enc_KmeGenericServiceReq'(element(2,Val), [{tag,128,0,'EXPLICIT',32}]); + 'enc_KmeGenericServiceReq'(element(2,Val), [<<48>>,<<160>>]); serviceResult -> - 'enc_KmeGenericServiceRsp'(element(2,Val), [{tag,128,1,'EXPLICIT',32}]); + 'enc_KmeGenericServiceRsp'(element(2,Val), [<<48>>,<<161>>]); event -> - 'enc_KmeGenericEvent'(element(2,Val), [{tag,128,2,'EXPLICIT',32}]); + 'enc_KmeGenericEvent'(element(2,Val), [<<48>>,<<162>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). +encode_tags(TagIn, EncBytes, EncLen). -'dec_KmeGenericSrvEvt'(Bytes, OptOrMand) -> - 'dec_KmeGenericSrvEvt'(Bytes, OptOrMand, []). +'dec_KmeGenericSrvEvt'(Tlv) -> + 'dec_KmeGenericSrvEvt'(Tlv, []). -'dec_KmeGenericSrvEvt'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of +'dec_KmeGenericSrvEvt'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of %% 'serviceRequest' - <<2:2,_:1,0:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeGenericServiceReq'(Bytes1, mandatory, [{tag,128,0,'EXPLICIT',32}]), - {{serviceRequest, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131072, V1} -> + {serviceRequest, 'dec_KmeGenericServiceReq'(V1, [16])}; %% 'serviceResult' - <<2:2,_:1,1:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeGenericServiceRsp'(Bytes1, mandatory, [{tag,128,1,'EXPLICIT',32}]), - {{serviceResult, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131073, V1} -> + {serviceResult, 'dec_KmeGenericServiceRsp'(V1, [16])}; %% 'event' - <<2:2,_:1,2:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeGenericEvent'(Bytes1, mandatory, [{tag,128,2,'EXPLICIT',32}]), - {{event, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131074, V1} -> + {event, 'dec_KmeGenericEvent'(V1, [16])}; Else -> - case OptOrMand of - mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}}); - _ ->exit({error,{asn1,{no_optional_tag,Else}}}) - end - end. + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. %%================================ %% KmeGenericServiceReq %%================================ +'enc_KmeGenericServiceReq'(Val) -> + 'enc_KmeGenericServiceReq'(Val, [<<48>>]). + 'enc_KmeGenericServiceReq'(Val, TagIn) -> +{_,Cindex1, Cindex2, Cindex3, Cindex4, Cindex5} = Val, %%------------------------------------------------- -%% attribute number 1 with type INTEGER +%% attribute serviceNo(1) with type INTEGER %%------------------------------------------------- - {EncBytes1,EncLen1} = ?RT_BER:encode_integer([], ?RT_BER:cindex(2,Val,serviceNo), []), + {EncBytes1,EncLen1} = encode_integer(Cindex1, [<<2>>]), %%------------------------------------------------- -%% attribute number 2 External CSTA-device-identifiers:DeviceID OPTIONAL +%% attribute device(2) External CSTA-device-identifiers:DeviceID OPTIONAL %%------------------------------------------------- - {EncBytes2,EncLen2} = case ?RT_BER:cindex(3,Val,device) of + {EncBytes2,EncLen2} = case Cindex2 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'CSTA-device-identifiers':'enc_DeviceID'(?RT_BER:cindex(3,Val,device), []) + 'CSTA-device-identifiers':'enc_DeviceID'(Cindex2, [<<48>>]) end, %%------------------------------------------------- -%% attribute number 3 External CSTA-call-connection-identifiers:ConnectionID OPTIONAL +%% attribute connection(3) External CSTA-call-connection-identifiers:ConnectionID OPTIONAL %%------------------------------------------------- - {EncBytes3,EncLen3} = case ?RT_BER:cindex(4,Val,connection) of + {EncBytes3,EncLen3} = case Cindex3 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'CSTA-call-connection-identifiers':'enc_ConnectionID'(?RT_BER:cindex(4,Val,connection), []) + 'CSTA-call-connection-identifiers':'enc_ConnectionID'(Cindex3, [<<107>>]) end, %%------------------------------------------------- -%% attribute number 4 with type INTEGER OPTIONAL +%% attribute number(4) with type INTEGER OPTIONAL %%------------------------------------------------- - {EncBytes4,EncLen4} = case ?RT_BER:cindex(5,Val,number) of + {EncBytes4,EncLen4} = case Cindex4 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_integer([], ?RT_BER:cindex(5,Val,number), []) + encode_integer(Cindex4, [<<2>>]) end, %%------------------------------------------------- -%% attribute number 5 with type IA5String OPTIONAL +%% attribute string(5) with type IA5String OPTIONAL %%------------------------------------------------- - {EncBytes5,EncLen5} = case ?RT_BER:cindex(6,Val,string) of + {EncBytes5,EncLen5} = case Cindex5 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_restricted_string([], ?RT_BER:cindex(6,Val,string), 22, []) + encode_restricted_string(Cindex5, [<<22>>]) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4, EncBytes5], - LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5, +encode_tags(TagIn, BytesSoFar, LenSoFar). -'dec_KmeGenericServiceReq'(Bytes, OptOrMand) -> - 'dec_KmeGenericServiceReq'(Bytes, OptOrMand, []). +'dec_KmeGenericServiceReq'(Tlv) -> + 'dec_KmeGenericServiceReq'(Tlv, [16]). -'dec_KmeGenericServiceReq'(Bytes, OptOrMand, TagIn) -> +'dec_KmeGenericServiceReq'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 with type INTEGER +%% attribute serviceNo(1) with type INTEGER %%------------------------------------------------- - {Term1,Bytes3,Rb2} = ?RT_BER:decode_integer(Bytes2,[],[], mandatory), +[V1|Tlv2] = Tlv1, +Term1 = decode_integer(V1, [2]), %%------------------------------------------------- -%% attribute number 2 External CSTA-device-identifiers:DeviceID OPTIONAL +%% attribute device(2) External CSTA-device-identifiers:DeviceID OPTIONAL %%------------------------------------------------- - {Term2,Bytes4,Rb3} = case Bytes3 of -<<0:2,_:1,16:5,_/binary>> -> -'CSTA-device-identifiers':'dec_DeviceID'(Bytes3, opt_or_default, []); -_ -> -{ asn1_NOVALUE, Bytes3, 0 } +{Term2,Tlv3} = case Tlv2 of +[{16,V2}|TempTlv3] -> + {'CSTA-device-identifiers':'dec_DeviceID'(V2, []), TempTlv3}; + _ -> + { asn1_NOVALUE, Tlv2} end, %%------------------------------------------------- -%% attribute number 3 External CSTA-call-connection-identifiers:ConnectionID OPTIONAL +%% attribute connection(3) External CSTA-call-connection-identifiers:ConnectionID OPTIONAL %%------------------------------------------------- - {Term3,Bytes5,Rb4} = case Bytes4 of -<<1:2,_:1,11:5,_/binary>> -> -'CSTA-call-connection-identifiers':'dec_ConnectionID'(Bytes4, opt_or_default, []); -_ -> -{ asn1_NOVALUE, Bytes4, 0 } +{Term3,Tlv4} = case Tlv3 of +[{65547,V3}|TempTlv4] -> + {'CSTA-call-connection-identifiers':'dec_ConnectionID'(V3, []), TempTlv4}; + _ -> + { asn1_NOVALUE, Tlv3} end, %%------------------------------------------------- -%% attribute number 4 with type INTEGER OPTIONAL +%% attribute number(4) with type INTEGER OPTIONAL %%------------------------------------------------- - {Term4,Bytes6,Rb5} = case Bytes5 of -<<0:2,_:1,2:5,_/binary>> -> -?RT_BER:decode_integer(Bytes5,[],[], mandatory); -_ -> -{ asn1_NOVALUE, Bytes5, 0 } +{Term4,Tlv5} = case Tlv4 of +[{2,V4}|TempTlv5] -> + {decode_integer(V4, []), TempTlv5}; + _ -> + { asn1_NOVALUE, Tlv4} end, %%------------------------------------------------- -%% attribute number 5 with type IA5String OPTIONAL +%% attribute string(5) with type IA5String OPTIONAL %%------------------------------------------------- - {Term5,Bytes7,Rb6} = case Bytes6 of -<<0:2,_:1,22:5,_/binary>> -> -?RT_BER:decode_restricted_string(Bytes6,{0,128},22,[], no_length, mandatory); -_ -> -{ asn1_NOVALUE, Bytes6, 0 } +{Term5,Tlv6} = case Tlv5 of +[{22,V5}|TempTlv6] -> + {begin +Val1 = decode_restricted_string(V5, []), +C1 = byte_size(Val1), +if 0 =< C1, C1 =< 128 -> +binary_to_list(Val1); +true -> +exit({error,{asn1,bad_range}}) +end +end, TempTlv6}; + _ -> + { asn1_NOVALUE, Tlv5} end, - {Bytes8,Rb7} = ?RT_BER:restbytes2(RemBytes, Bytes7,noext), - {{'KmeGenericServiceReq', Term1, Term2, Term3, Term4, Term5}, Bytes8, Rb1+Rb2+Rb3+Rb4+Rb5+Rb6+Rb7}. +case Tlv6 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv6}}}) % extra fields not allowed +end, + {'KmeGenericServiceReq', Term1, Term2, Term3, Term4, Term5}. + %%================================ %% KmeGenericServiceRsp %%================================ +'enc_KmeGenericServiceRsp'(Val) -> + 'enc_KmeGenericServiceRsp'(Val, [<<48>>]). + 'enc_KmeGenericServiceRsp'(Val, TagIn) -> +{_,Cindex1, Cindex2} = Val, %%------------------------------------------------- -%% attribute number 1 with type INTEGER OPTIONAL +%% attribute number(1) with type INTEGER OPTIONAL %%------------------------------------------------- - {EncBytes1,EncLen1} = case ?RT_BER:cindex(2,Val,number) of + {EncBytes1,EncLen1} = case Cindex1 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_integer([], ?RT_BER:cindex(2,Val,number), []) + encode_integer(Cindex1, [<<2>>]) end, %%------------------------------------------------- -%% attribute number 2 with type IA5String OPTIONAL +%% attribute string(2) with type IA5String OPTIONAL %%------------------------------------------------- - {EncBytes2,EncLen2} = case ?RT_BER:cindex(3,Val,string) of + {EncBytes2,EncLen2} = case Cindex2 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_restricted_string([], ?RT_BER:cindex(3,Val,string), 22, []) + encode_restricted_string(Cindex2, [<<22>>]) end, BytesSoFar = [EncBytes1, EncBytes2], - LenSoFar = EncLen1 + EncLen2, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2, +encode_tags(TagIn, BytesSoFar, LenSoFar). -'dec_KmeGenericServiceRsp'(Bytes, OptOrMand) -> - 'dec_KmeGenericServiceRsp'(Bytes, OptOrMand, []). +'dec_KmeGenericServiceRsp'(Tlv) -> + 'dec_KmeGenericServiceRsp'(Tlv, [16]). -'dec_KmeGenericServiceRsp'(Bytes, OptOrMand, TagIn) -> +'dec_KmeGenericServiceRsp'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 with type INTEGER OPTIONAL +%% attribute number(1) with type INTEGER OPTIONAL %%------------------------------------------------- - {Term1,Bytes3,Rb2} = case Bytes2 of -<<0:2,_:1,2:5,_/binary>> -> -?RT_BER:decode_integer(Bytes2,[],[], mandatory); -_ -> -{ asn1_NOVALUE, Bytes2, 0 } +{Term1,Tlv2} = case Tlv1 of +[{2,V1}|TempTlv2] -> + {decode_integer(V1, []), TempTlv2}; + _ -> + { asn1_NOVALUE, Tlv1} end, %%------------------------------------------------- -%% attribute number 2 with type IA5String OPTIONAL +%% attribute string(2) with type IA5String OPTIONAL %%------------------------------------------------- - {Term2,Bytes4,Rb3} = case Bytes3 of -<<0:2,_:1,22:5,_/binary>> -> -?RT_BER:decode_restricted_string(Bytes3,{0,128},22,[], no_length, mandatory); -_ -> -{ asn1_NOVALUE, Bytes3, 0 } +{Term2,Tlv3} = case Tlv2 of +[{22,V2}|TempTlv3] -> + {begin +Val1 = decode_restricted_string(V2, []), +C1 = byte_size(Val1), +if 0 =< C1, C1 =< 128 -> +binary_to_list(Val1); +true -> +exit({error,{asn1,bad_range}}) +end +end, TempTlv3}; + _ -> + { asn1_NOVALUE, Tlv2} end, - {Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext), - {{'KmeGenericServiceRsp', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}. +case Tlv3 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed +end, + {'KmeGenericServiceRsp', Term1, Term2}. + %%================================ %% KmeGenericEvent %%================================ +'enc_KmeGenericEvent'(Val) -> + 'enc_KmeGenericEvent'(Val, [<<48>>]). + 'enc_KmeGenericEvent'(Val, TagIn) -> +{_,Cindex1, Cindex2, Cindex3, Cindex4, Cindex5, Cindex6} = Val, %%------------------------------------------------- -%% attribute number 1 with type INTEGER +%% attribute eventNo(1) with type INTEGER %%------------------------------------------------- - {EncBytes1,EncLen1} = ?RT_BER:encode_integer([], ?RT_BER:cindex(2,Val,eventNo), []), + {EncBytes1,EncLen1} = encode_integer(Cindex1, [<<2>>]), %%------------------------------------------------- -%% attribute number 2 External CSTA-device-identifiers:DeviceID OPTIONAL +%% attribute device(2) External CSTA-device-identifiers:DeviceID OPTIONAL %%------------------------------------------------- - {EncBytes2,EncLen2} = case ?RT_BER:cindex(3,Val,device) of + {EncBytes2,EncLen2} = case Cindex2 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'CSTA-device-identifiers':'enc_DeviceID'(?RT_BER:cindex(3,Val,device), []) + 'CSTA-device-identifiers':'enc_DeviceID'(Cindex2, [<<48>>]) end, %%------------------------------------------------- -%% attribute number 3 External CSTA-call-connection-identifiers:ConnectionID OPTIONAL +%% attribute connection(3) External CSTA-call-connection-identifiers:ConnectionID OPTIONAL %%------------------------------------------------- - {EncBytes3,EncLen3} = case ?RT_BER:cindex(4,Val,connection) of + {EncBytes3,EncLen3} = case Cindex3 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'CSTA-call-connection-identifiers':'enc_ConnectionID'(?RT_BER:cindex(4,Val,connection), []) + 'CSTA-call-connection-identifiers':'enc_ConnectionID'(Cindex3, [<<107>>]) end, %%------------------------------------------------- -%% attribute number 4 with type ENUMERATED OPTIONAL +%% attribute state(4) with type ENUMERATED OPTIONAL %%------------------------------------------------- - {EncBytes4,EncLen4} = case ?RT_BER:cindex(5,Val,state) of + {EncBytes4,EncLen4} = case Cindex4 of asn1_NOVALUE -> {<<>>,0}; _ -> - case (case ?RT_BER:cindex(5,Val,state) of {_,Enumval2}->Enumval2;_->?RT_BER:cindex(5,Val,state) end) of -null -> ?RT_BER:encode_enumerated(0,[{tag,64,14,'IMPLICIT',32}]); -initiated -> ?RT_BER:encode_enumerated(1,[{tag,64,14,'IMPLICIT',32}]); -alerting -> ?RT_BER:encode_enumerated(2,[{tag,64,14,'IMPLICIT',32}]); -connected -> ?RT_BER:encode_enumerated(3,[{tag,64,14,'IMPLICIT',32}]); -hold -> ?RT_BER:encode_enumerated(4,[{tag,64,14,'IMPLICIT',32}]); -queued -> ?RT_BER:encode_enumerated(5,[{tag,64,14,'IMPLICIT',32}]); -fail -> ?RT_BER:encode_enumerated(6,[{tag,64,14,'IMPLICIT',32}]); -Enumval3 -> exit({error,{asn1, {enumerated_not_in_range,Enumval3}}}) + case Cindex4 of +null -> encode_tags([<<78>>], [0], 1); +initiated -> encode_tags([<<78>>], [1], 1); +alerting -> encode_tags([<<78>>], [2], 1); +connected -> encode_tags([<<78>>], [3], 1); +hold -> encode_tags([<<78>>], [4], 1); +queued -> encode_tags([<<78>>], [5], 1); +fail -> encode_tags([<<78>>], [6], 1); +Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) end end, %%------------------------------------------------- -%% attribute number 5 with type INTEGER OPTIONAL +%% attribute cause(5) with type INTEGER OPTIONAL %%------------------------------------------------- - {EncBytes5,EncLen5} = case ?RT_BER:cindex(6,Val,cause) of + {EncBytes5,EncLen5} = case Cindex5 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_integer([], ?RT_BER:cindex(6,Val,cause), []) + encode_integer(Cindex5, [<<2>>]) end, %%------------------------------------------------- -%% attribute number 6 with type IA5String OPTIONAL +%% attribute message(6) with type IA5String OPTIONAL %%------------------------------------------------- - {EncBytes6,EncLen6} = case ?RT_BER:cindex(7,Val,message) of + {EncBytes6,EncLen6} = case Cindex6 of asn1_NOVALUE -> {<<>>,0}; _ -> - ?RT_BER:encode_restricted_string([], ?RT_BER:cindex(7,Val,message), 22, []) + encode_restricted_string(Cindex6, [<<22>>]) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4, EncBytes5, EncBytes6], - LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5 + EncLen6, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5 + EncLen6, +encode_tags(TagIn, BytesSoFar, LenSoFar). -'dec_KmeGenericEvent'(Bytes, OptOrMand) -> - 'dec_KmeGenericEvent'(Bytes, OptOrMand, []). +'dec_KmeGenericEvent'(Tlv) -> + 'dec_KmeGenericEvent'(Tlv, [16]). -'dec_KmeGenericEvent'(Bytes, OptOrMand, TagIn) -> +'dec_KmeGenericEvent'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 with type INTEGER +%% attribute eventNo(1) with type INTEGER %%------------------------------------------------- - {Term1,Bytes3,Rb2} = ?RT_BER:decode_integer(Bytes2,[],[], mandatory), +[V1|Tlv2] = Tlv1, +Term1 = decode_integer(V1, [2]), %%------------------------------------------------- -%% attribute number 2 External CSTA-device-identifiers:DeviceID OPTIONAL +%% attribute device(2) External CSTA-device-identifiers:DeviceID OPTIONAL %%------------------------------------------------- - {Term2,Bytes4,Rb3} = case Bytes3 of -<<0:2,_:1,16:5,_/binary>> -> -'CSTA-device-identifiers':'dec_DeviceID'(Bytes3, opt_or_default, []); -_ -> -{ asn1_NOVALUE, Bytes3, 0 } +{Term2,Tlv3} = case Tlv2 of +[{16,V2}|TempTlv3] -> + {'CSTA-device-identifiers':'dec_DeviceID'(V2, []), TempTlv3}; + _ -> + { asn1_NOVALUE, Tlv2} end, %%------------------------------------------------- -%% attribute number 3 External CSTA-call-connection-identifiers:ConnectionID OPTIONAL +%% attribute connection(3) External CSTA-call-connection-identifiers:ConnectionID OPTIONAL %%------------------------------------------------- - {Term3,Bytes5,Rb4} = case Bytes4 of -<<1:2,_:1,11:5,_/binary>> -> -'CSTA-call-connection-identifiers':'dec_ConnectionID'(Bytes4, opt_or_default, []); -_ -> -{ asn1_NOVALUE, Bytes4, 0 } +{Term3,Tlv4} = case Tlv3 of +[{65547,V3}|TempTlv4] -> + {'CSTA-call-connection-identifiers':'dec_ConnectionID'(V3, []), TempTlv4}; + _ -> + { asn1_NOVALUE, Tlv3} end, %%------------------------------------------------- -%% attribute number 4 with type ENUMERATED OPTIONAL -%%------------------------------------------------- - {Term4,Bytes6,Rb5} = case Bytes5 of -<<1:2,_:1,14:5,_/binary>> -> -?RT_BER:decode_enumerated(Bytes5,[],[{null,0},{initiated,1},{alerting,2},{connected,3},{hold,4},{queued,5},{fail,6}],[{tag,64,14,'IMPLICIT',32}], mandatory); -_ -> -{ asn1_NOVALUE, Bytes5, 0 } +%% attribute state(4) with type ENUMERATED OPTIONAL +%%------------------------------------------------- +{Term4,Tlv5} = case Tlv4 of +[{65550,V4}|TempTlv5] -> + {case decode_integer(V4, []) of +0 -> null; +1 -> initiated; +2 -> alerting; +3 -> connected; +4 -> hold; +5 -> queued; +6 -> fail; +Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) +end, TempTlv5}; + _ -> + { asn1_NOVALUE, Tlv4} end, %%------------------------------------------------- -%% attribute number 5 with type INTEGER OPTIONAL +%% attribute cause(5) with type INTEGER OPTIONAL %%------------------------------------------------- - {Term5,Bytes7,Rb6} = case Bytes6 of -<<0:2,_:1,2:5,_/binary>> -> -?RT_BER:decode_integer(Bytes6,[],[], mandatory); -_ -> -{ asn1_NOVALUE, Bytes6, 0 } +{Term5,Tlv6} = case Tlv5 of +[{2,V5}|TempTlv6] -> + {decode_integer(V5, []), TempTlv6}; + _ -> + { asn1_NOVALUE, Tlv5} end, %%------------------------------------------------- -%% attribute number 6 with type IA5String OPTIONAL +%% attribute message(6) with type IA5String OPTIONAL %%------------------------------------------------- - {Term6,Bytes8,Rb7} = case Bytes7 of -<<0:2,_:1,22:5,_/binary>> -> -?RT_BER:decode_restricted_string(Bytes7,{1,128},22,[], no_length, mandatory); -_ -> -{ asn1_NOVALUE, Bytes7, 0 } +{Term6,Tlv7} = case Tlv6 of +[{22,V6}|TempTlv7] -> + {begin +Val1 = decode_restricted_string(V6, []), +C1 = byte_size(Val1), +if 1 =< C1, C1 =< 128 -> +binary_to_list(Val1); +true -> +exit({error,{asn1,bad_range}}) +end +end, TempTlv7}; + _ -> + { asn1_NOVALUE, Tlv6} +end, + +case Tlv7 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv7}}}) % extra fields not allowed end, + {'KmeGenericEvent', Term1, Term2, Term3, Term4, Term5, Term6}. - {Bytes9,Rb8} = ?RT_BER:restbytes2(RemBytes, Bytes8,noext), - {{'KmeGenericEvent', Term1, Term2, Term3, Term4, Term5, Term6}, Bytes9, Rb1+Rb2+Rb3+Rb4+Rb5+Rb6+Rb7+Rb8}. %%================================ %% KMESpecificPrivateData %%================================ - -'enc_KMESpecificPrivateData'({'KMESpecificPrivateData',Val}, TagIn) -> - 'enc_KMESpecificPrivateData'(Val, TagIn); +'enc_KMESpecificPrivateData'(Val) -> + 'enc_KMESpecificPrivateData'(Val, []). 'enc_KMESpecificPrivateData'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of kmeCallControl -> - 'enc_KmeCallControlSrvEvt'(element(2,Val), [{tag,128,1,'EXPLICIT',32}]); + 'enc_KmeCallControlSrvEvt'(element(2,Val), [<<161>>]); kmeDeviceStatus -> - 'enc_KmeDeviceStatus'(element(2,Val), [{tag,128,2,'EXPLICIT',32}]); + 'enc_KmeDeviceStatus'(element(2,Val), [<<162>>]); kmeDeviceMonitor -> - 'enc_KmeDeviceMonitor'(element(2,Val), [{tag,128,3,'EXPLICIT',32}]); + 'enc_KmeDeviceMonitor'(element(2,Val), [<<163>>]); kmeSystemData -> - 'enc_KmeSystemData'(element(2,Val), [{tag,128,4,'EXPLICIT',32}]); + 'enc_KmeSystemData'(element(2,Val), [<<164>>]); kmeLocalAlerm -> - 'enc_KmeLocalAlerm'(element(2,Val), [{tag,128,5,'EXPLICIT',32}]); + 'enc_KmeLocalAlerm'(element(2,Val), [<<165>>]); kmeAdditionalData -> - 'enc_KmeAdditionalData'(element(2,Val), [{tag,128,6,'EXPLICIT',32}]); + 'enc_KmeAdditionalData'(element(2,Val), [<<166>>]); kmePrivateEvent -> - 'enc_KmePrivateEvent'(element(2,Val), [{tag,128,7,'EXPLICIT',32}]); + 'enc_KmePrivateEvent'(element(2,Val), [<<167>>]); kmeResourceControl -> - 'enc_KmeResourceControl'(element(2,Val), [{tag,128,8,'EXPLICIT',32}]); + 'enc_KmeResourceControl'(element(2,Val), [<<168>>]); kmeGeneric -> - 'enc_KmeGenericSrvEvt'(element(2,Val), [{tag,128,9,'EXPLICIT',32}]); + 'enc_KmeGenericSrvEvt'(element(2,Val), [<<169>>]); kmeExtendedDataAccess -> - ?RT_BER:encode_octet_string([], element(2,Val), [{tag,128,10,'EXPLICIT',32}]); + encode_restricted_string(element(2,Val), [<<4>>,<<170>>]); kmePDFControl -> - 'enc_KmePDFSrvEvt'(element(2,Val), [{tag,128,11,'EXPLICIT',32}]); + 'enc_KmePDFSrvEvt'(element(2,Val), [<<171>>]); kmeAlterIf -> - 'enc_KmeAlterIfSrvEvt'(element(2,Val), [{tag,128,12,'EXPLICIT',32}]); + 'enc_KmeAlterIfSrvEvt'(element(2,Val), [<<172>>]); kmeHotelControl -> - 'enc_KmeHotelSrvEvt'(element(2,Val), [{tag,128,13,'EXPLICIT',32}]); + 'enc_KmeHotelSrvEvt'(element(2,Val), [<<173>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). +encode_tags(TagIn, EncBytes, EncLen). -'dec_KMESpecificPrivateData'(Bytes, OptOrMand) -> - 'dec_KMESpecificPrivateData'(Bytes, OptOrMand, []). +'dec_KMESpecificPrivateData'(Tlv) -> + 'dec_KMESpecificPrivateData'(Tlv, []). -'dec_KMESpecificPrivateData'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of +'dec_KMESpecificPrivateData'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of %% 'kmeCallControl' - <<2:2,_:1,1:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeCallControlSrvEvt'(Bytes1, mandatory, [{tag,128,1,'EXPLICIT',32}]), - {{kmeCallControl, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131073, V1} -> + {kmeCallControl, 'dec_KmeCallControlSrvEvt'(V1, [])}; %% 'kmeDeviceStatus' - <<2:2,_:1,2:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeDeviceStatus'(Bytes1, mandatory, [{tag,128,2,'EXPLICIT',32}]), - {{kmeDeviceStatus, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131074, V1} -> + {kmeDeviceStatus, 'dec_KmeDeviceStatus'(V1, [])}; %% 'kmeDeviceMonitor' - <<2:2,_:1,3:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeDeviceMonitor'(Bytes1, mandatory, [{tag,128,3,'EXPLICIT',32}]), - {{kmeDeviceMonitor, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131075, V1} -> + {kmeDeviceMonitor, 'dec_KmeDeviceMonitor'(V1, [])}; %% 'kmeSystemData' - <<2:2,_:1,4:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeSystemData'(Bytes1, mandatory, [{tag,128,4,'EXPLICIT',32}]), - {{kmeSystemData, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131076, V1} -> + {kmeSystemData, 'dec_KmeSystemData'(V1, [])}; %% 'kmeLocalAlerm' - <<2:2,_:1,5:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeLocalAlerm'(Bytes1, mandatory, [{tag,128,5,'EXPLICIT',32}]), - {{kmeLocalAlerm, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131077, V1} -> + {kmeLocalAlerm, 'dec_KmeLocalAlerm'(V1, [])}; %% 'kmeAdditionalData' - <<2:2,_:1,6:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeAdditionalData'(Bytes1, mandatory, [{tag,128,6,'EXPLICIT',32}]), - {{kmeAdditionalData, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131078, V1} -> + {kmeAdditionalData, 'dec_KmeAdditionalData'(V1, [])}; %% 'kmePrivateEvent' - <<2:2,_:1,7:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmePrivateEvent'(Bytes1, mandatory, [{tag,128,7,'EXPLICIT',32}]), - {{kmePrivateEvent, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131079, V1} -> + {kmePrivateEvent, 'dec_KmePrivateEvent'(V1, [])}; %% 'kmeResourceControl' - <<2:2,_:1,8:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeResourceControl'(Bytes1, mandatory, [{tag,128,8,'EXPLICIT',32}]), - {{kmeResourceControl, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131080, V1} -> + {kmeResourceControl, 'dec_KmeResourceControl'(V1, [])}; %% 'kmeGeneric' - <<2:2,_:1,9:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeGenericSrvEvt'(Bytes1, mandatory, [{tag,128,9,'EXPLICIT',32}]), - {{kmeGeneric, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131081, V1} -> + {kmeGeneric, 'dec_KmeGenericSrvEvt'(V1, [])}; %% 'kmeExtendedDataAccess' - <<2:2,_:1,10:5,_/binary>> -> - {Dec, Rest, RbCho} = ?RT_BER:decode_octet_string(Bytes1,{0,200},[{tag,128,10,'EXPLICIT',32}], no_length, mandatory), - {{kmeExtendedDataAccess, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131082, V1} -> + {kmeExtendedDataAccess, begin +Val1 = decode_octet_string(V1, [4]), +C1 = byte_size(Val1), +if 0 =< C1, C1 =< 200 -> +Val1; +true -> +exit({error,{asn1,bad_range}}) +end +end}; %% 'kmePDFControl' - <<2:2,_:1,11:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmePDFSrvEvt'(Bytes1, mandatory, [{tag,128,11,'EXPLICIT',32}]), - {{kmePDFControl, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131083, V1} -> + {kmePDFControl, 'dec_KmePDFSrvEvt'(V1, [])}; %% 'kmeAlterIf' - <<2:2,_:1,12:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeAlterIfSrvEvt'(Bytes1, mandatory, [{tag,128,12,'EXPLICIT',32}]), - {{kmeAlterIf, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131084, V1} -> + {kmeAlterIf, 'dec_KmeAlterIfSrvEvt'(V1, [])}; %% 'kmeHotelControl' - <<2:2,_:1,13:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_KmeHotelSrvEvt'(Bytes1, mandatory, [{tag,128,13,'EXPLICIT',32}]), - {{kmeHotelControl, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131085, V1} -> + {kmeHotelControl, 'dec_KmeHotelSrvEvt'(V1, [])}; Else -> - case OptOrMand of - mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}}); - _ ->exit({error,{asn1,{no_optional_tag,Else}}}) - end - end. + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. + +%%% +%%% Run-time functions. +%%% + +'dialyzer-suppressions'(Arg) -> + ok. + +ber_decode_nif(B) -> + asn1rt_nif:decode_ber_tlv(B). + +collect_parts(TlvList) -> + collect_parts(TlvList, []). + +collect_parts([{_,L}|Rest], Acc) when is_list(L) -> + collect_parts(Rest, [collect_parts(L)|Acc]); +collect_parts([{3,<>}|Rest], _Acc) -> + collect_parts_bit(Rest, [Bits], Unused); +collect_parts([{_T,V}|Rest], Acc) -> + collect_parts(Rest, [V|Acc]); +collect_parts([], Acc) -> + list_to_binary(lists:reverse(Acc)). + +collect_parts_bit([{3,<>}|Rest], Acc, Uacc) -> + collect_parts_bit(Rest, [Bits|Acc], Unused + Uacc); +collect_parts_bit([], Acc, Uacc) -> + list_to_binary([Uacc|lists:reverse(Acc)]). + +decode_bitstring2(1, + Unused, + <>) -> + lists:sublist([B7,B6,B5,B4,B3,B2,B1,B0], 8 - Unused); +decode_bitstring2(Len, + Unused, + <>) -> + [B7,B6,B5,B4,B3,B2,B1,B0|decode_bitstring2(Len - 1, Unused, Buffer)]. + +decode_bitstring_NNL(BitList, NamedNumberList) -> + decode_bitstring_NNL(BitList, NamedNumberList, 0, []). + +decode_bitstring_NNL([], _, _No, Result) -> + lists:reverse(Result); +decode_bitstring_NNL([B|BitList], + [{Name,No}|NamedNumberList], + No, + Result) -> + if + B =:= 0 -> + decode_bitstring_NNL(BitList, + NamedNumberList, + No + 1, + Result); + true -> + decode_bitstring_NNL(BitList, + NamedNumberList, + No + 1, + [Name|Result]) + end; +decode_bitstring_NNL([1|BitList], NamedNumberList, No, Result) -> + decode_bitstring_NNL(BitList, + NamedNumberList, + No + 1, + [{bit,No}|Result]); +decode_bitstring_NNL([0|BitList], NamedNumberList, No, Result) -> + decode_bitstring_NNL(BitList, NamedNumberList, No + 1, Result). + +decode_boolean(Tlv, TagIn) -> + Val = match_tags(Tlv, TagIn), + case Val of + <<0:8>> -> + false; + <<_:8>> -> + true; + _ -> + exit({error,{asn1,{decode_boolean,Val}}}) + end. + +decode_integer(Tlv, TagIn) -> + Bin = match_tags(Tlv, TagIn), + Len = byte_size(Bin), + <> = Bin, + Int. + +decode_named_bit_string(Buffer, NamedNumberList, Tags) -> + case match_and_collect(Buffer, Tags) of + <<0>> -> + []; + <> -> + BitString = decode_bitstring2(byte_size(Bits), Unused, Bits), + decode_bitstring_NNL(BitString, NamedNumberList) + end. + +decode_null(Tlv, Tags) -> + Val = match_tags(Tlv, Tags), + case Val of + <<>> -> + 'NULL'; + _ -> + exit({error,{asn1,{decode_null,Val}}}) + end. + +decode_octet_string(Tlv, TagsIn) -> + Bin = match_and_collect(Tlv, TagsIn), + binary:copy(Bin). + +decode_restricted_string(Tlv, TagsIn) -> + match_and_collect(Tlv, TagsIn). + +do_encode_named_bit_string([FirstVal|RestVal], NamedBitList, TagIn) -> + ToSetPos = get_all_bitposes([FirstVal|RestVal], NamedBitList, []), + Size = lists:max(ToSetPos) + 1, + BitList = make_and_set_list(Size, ToSetPos, 0), + {Len,Unused,OctetList} = encode_bitstring(BitList), + encode_tags(TagIn, [Unused|OctetList], Len + 1). + +encode_bitstring([B8,B7,B6,B5,B4,B3,B2,B1|Rest]) -> + Val = + B8 bsl 7 bor (B7 bsl 6) bor (B6 bsl 5) bor (B5 bsl 4) + bor + (B4 bsl 3) + bor + (B3 bsl 2) + bor + (B2 bsl 1) + bor + B1, + encode_bitstring(Rest, [Val], 1); +encode_bitstring(Val) -> + {Unused,Octet} = unused_bitlist(Val, 7, 0), + {1,Unused,[Octet]}. + +encode_bitstring([B8,B7,B6,B5,B4,B3,B2,B1|Rest], Ack, Len) -> + Val = + B8 bsl 7 bor (B7 bsl 6) bor (B6 bsl 5) bor (B5 bsl 4) + bor + (B4 bsl 3) + bor + (B3 bsl 2) + bor + (B2 bsl 1) + bor + B1, + encode_bitstring(Rest, [Ack,Val], Len + 1); +encode_bitstring([], Ack, Len) -> + {Len,0,Ack}; +encode_bitstring(Rest, Ack, Len) -> + {Unused,Val} = unused_bitlist(Rest, 7, 0), + {Len + 1,Unused,[Ack,Val]}. + +encode_boolean(true, TagIn) -> + encode_tags(TagIn, [255], 1); +encode_boolean(false, TagIn) -> + encode_tags(TagIn, [0], 1); +encode_boolean(X, _) -> + exit({error,{asn1,{encode_boolean,X}}}). + +encode_integer(Val) -> + Bytes = + if + Val >= 0 -> + encode_integer_pos(Val, []); + true -> + encode_integer_neg(Val, []) + end, + {Bytes,length(Bytes)}. + +encode_integer(Val, Tag) when is_integer(Val) -> + encode_tags(Tag, encode_integer(Val)); +encode_integer(Val, _Tag) -> + exit({error,{asn1,{encode_integer,Val}}}). + +encode_integer_neg(- 1, [B1|_T] = L) when B1 > 127 -> + L; +encode_integer_neg(N, Acc) -> + encode_integer_neg(N bsr 8, [N band 255|Acc]). + +encode_integer_pos(0, [B|_Acc] = L) when B < 128 -> + L; +encode_integer_pos(N, Acc) -> + encode_integer_pos(N bsr 8, [N band 255|Acc]). + +encode_length(L) when L =< 127 -> + {[L],1}; +encode_length(L) -> + Oct = minimum_octets(L), + Len = length(Oct), + if + Len =< 126 -> + {[128 bor Len|Oct],Len + 1}; + true -> + exit({error,{asn1,too_long_length_oct,Len}}) + end. + +encode_named_bit_string([H|_] = Bits, NamedBitList, TagIn) + when is_atom(H) -> + do_encode_named_bit_string(Bits, NamedBitList, TagIn); +encode_named_bit_string([{bit,_}|_] = Bits, NamedBitList, TagIn) -> + do_encode_named_bit_string(Bits, NamedBitList, TagIn); +encode_named_bit_string(Bits, _NamedBitList, TagIn) + when is_bitstring(Bits) -> + encode_unnamed_bit_string(Bits, TagIn). + +encode_null(_Val, TagIn) -> + encode_tags(TagIn, [], 0). + +encode_restricted_string(OctetList, TagIn) when is_binary(OctetList) -> + encode_tags(TagIn, OctetList, byte_size(OctetList)); +encode_restricted_string(OctetList, TagIn) when is_list(OctetList) -> + encode_tags(TagIn, OctetList, length(OctetList)). + +encode_tags(TagIn, {BytesSoFar,LenSoFar}) -> + encode_tags(TagIn, BytesSoFar, LenSoFar). + +encode_tags([Tag|Trest], BytesSoFar, LenSoFar) -> + {Bytes2,L2} = encode_length(LenSoFar), + encode_tags(Trest, + [Tag,Bytes2|BytesSoFar], + LenSoFar + byte_size(Tag) + L2); +encode_tags([], BytesSoFar, LenSoFar) -> + {BytesSoFar,LenSoFar}. + +encode_unnamed_bit_string(Bits, TagIn) -> + Unused = (8 - bit_size(Bits) band 7) band 7, + Bin = <>, + encode_tags(TagIn, Bin, byte_size(Bin)). + +get_all_bitposes([{bit,ValPos}|Rest], NamedBitList, Ack) -> + get_all_bitposes(Rest, NamedBitList, [ValPos|Ack]); +get_all_bitposes([Val|Rest], NamedBitList, Ack) when is_atom(Val) -> + case lists:keyfind(Val, 1, NamedBitList) of + {_ValName,ValPos} -> + get_all_bitposes(Rest, NamedBitList, [ValPos|Ack]); + _ -> + exit({error,{asn1,{bitstring_namedbit,Val}}}) + end; +get_all_bitposes([], _NamedBitList, Ack) -> + lists:sort(Ack). + +make_and_set_list(0, [], _) -> + []; +make_and_set_list(0, _, _) -> + exit({error,{asn1,bitstring_sizeconstraint}}); +make_and_set_list(Len, [XPos|SetPos], XPos) -> + [1|make_and_set_list(Len - 1, SetPos, XPos + 1)]; +make_and_set_list(Len, [Pos|SetPos], XPos) -> + [0|make_and_set_list(Len - 1, [Pos|SetPos], XPos + 1)]; +make_and_set_list(Len, [], XPos) -> + [0|make_and_set_list(Len - 1, [], XPos + 1)]. + +match_and_collect(Tlv, TagsIn) -> + Val = match_tags(Tlv, TagsIn), + case Val of + [_|_] = PartList -> + collect_parts(PartList); + Bin when is_binary(Bin) -> + Bin + end. + +match_tags({T,V}, [T]) -> + V; +match_tags({T,V}, [T|Tt]) -> + match_tags(V, Tt); +match_tags([{T,V}], [T|Tt]) -> + match_tags(V, Tt); +match_tags([{T,_V}|_] = Vlist, [T]) -> + Vlist; +match_tags(Tlv, []) -> + Tlv; +match_tags({Tag,_V} = Tlv, [T|_Tt]) -> + exit({error,{asn1,{wrong_tag,{{expected,T},{got,Tag,Tlv}}}}}). + +minimum_octets(0, Acc) -> + Acc; +minimum_octets(Val, Acc) -> + minimum_octets(Val bsr 8, [Val band 255|Acc]). + +minimum_octets(Val) -> + minimum_octets(Val, []). + +unused_bitlist([], Trail, Ack) -> + {Trail + 1,Ack}; +unused_bitlist([Bit|Rest], Trail, Ack) -> + unused_bitlist(Rest, Trail - 1, Bit bsl Trail bor Ack). diff --git a/KME-specific-types.hrl b/KME-specific-types.hrl index 69a0da1..b017dfc 100644 --- a/KME-specific-types.hrl +++ b/KME-specific-types.hrl @@ -1,10 +1,13 @@ -%% Generated by the Erlang ASN.1 compiler version:1.7 +%% Generated by the Erlang ASN.1 compiler version:4.0 %% Purpose: Erlang record definitions for each named and unnamed %% SEQUENCE and SET, and macro definitions for each value %% definition,in module KME-specific-types +-ifndef(_KME_SPECIFIC_TYPES_HRL_). +-define(_KME_SPECIFIC_TYPES_HRL_, true). + -record('KmeSpeedDialRequest',{ startSerialNo, number, tenantNo = asn1_NOVALUE}). @@ -203,3 +206,4 @@ number = asn1_NOVALUE, string = asn1_NOVALUE}). -record('KmeGenericEvent',{ eventNo, device = asn1_NOVALUE, connection = asn1_NOVALUE, state = asn1_NOVALUE, cause = asn1_NOVALUE, message = asn1_NOVALUE}). +-endif. %% _KME_SPECIFIC_TYPES_HRL_ -- cgit v1.2.3