⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 megaco_ber_media_gateway_control_v1.erl

📁 OTP是开放电信平台的简称
💻 ERL
📖 第 1 页 / 共 5 页
字号:
%%-------------------------------------------------%% attribute number 2 with type INTEGER%%-------------------------------------------------   {EncBytes2,EncLen2} = ?RT_BER:encode_integer([], ?RT_BER:cindex(3,Val,packageVersion), [{tag,128,1,'IMPLICIT',0}]),   BytesSoFar = [EncBytes1, EncBytes2],  LenSoFar = EncLen1 + EncLen2,  ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar).'dec_PackagesItem'(Bytes, OptOrMand) ->   'dec_PackagesItem'(Bytes, OptOrMand, []).'dec_PackagesItem'(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 OCTET STRING%%-------------------------------------------------   {Term1,Bytes3,Rb2} = ?RT_BER:decode_octet_string(Bytes2,2,[{tag,128,0,'IMPLICIT',0}], no_length, mandatory),%%-------------------------------------------------%% attribute number 2 with type INTEGER%%-------------------------------------------------   {Term2,Bytes4,Rb3} = ?RT_BER:decode_integer(Bytes3,{0,99},[{tag,128,1,'IMPLICIT',0}], mandatory),   {Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,ext),   {{'PackagesItem', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}.%%================================%%  PackagesDescriptor%%================================'enc_PackagesDescriptor'({'PackagesDescriptor',Val}, TagIn) ->   'enc_PackagesDescriptor'(Val, TagIn);'enc_PackagesDescriptor'(Val, TagIn) ->   {EncBytes,EncLen} = 'enc_PackagesDescriptor_components'(Val,[],0),   ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], EncBytes, EncLen).'enc_PackagesDescriptor_components'([], AccBytes, AccLen) ->    {lists:reverse(AccBytes),AccLen};'enc_PackagesDescriptor_components'([H|T],AccBytes, AccLen) ->   {EncBytes,EncLen} = 'enc_PackagesItem'(H, []),   'enc_PackagesDescriptor_components'(T,[EncBytes|AccBytes], AccLen + EncLen).'dec_PackagesDescriptor'(Bytes, OptOrMand) ->   'dec_PackagesDescriptor'(Bytes, OptOrMand, []).'dec_PackagesDescriptor'(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_PackagesItem'/3, [], []).%%================================%%  ServiceChangeProfile%%================================'enc_ServiceChangeProfile'(Val, TagIn) ->%%-------------------------------------------------%% attribute number 1 with type IA5String%%-------------------------------------------------   {EncBytes1,EncLen1} = ?RT_BER:encode_restricted_string([], ?RT_BER:cindex(2,Val,profileName), 22, [{tag,128,0,'IMPLICIT',0}]),   BytesSoFar = [EncBytes1],  LenSoFar = EncLen1,  ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar).'dec_ServiceChangeProfile'(Bytes, OptOrMand) ->   'dec_ServiceChangeProfile'(Bytes, OptOrMand, []).'dec_ServiceChangeProfile'(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 IA5String%%-------------------------------------------------   {Term1,Bytes3,Rb2} = ?RT_BER:decode_restricted_string(Bytes2,{1,67},22,[{tag,128,0,'IMPLICIT',0}], no_length, mandatory),   {Bytes4,Rb3} = ?RT_BER:restbytes2(RemBytes, Bytes3,noext),   {{'ServiceChangeProfile', Term1}, Bytes4, Rb1+Rb2+Rb3}.%%================================%%  ServiceChangeMethod%%================================'enc_ServiceChangeMethod'({'ServiceChangeMethod',Val}, TagIn) ->   'enc_ServiceChangeMethod'(Val, TagIn);'enc_ServiceChangeMethod'(Val, TagIn) ->case (case Val of {asn1_enum,_}->Val;{_,_}->element(2,Val);_->Val end) offailover -> ?RT_BER:encode_enumerated(0,TagIn ++ []);forced -> ?RT_BER:encode_enumerated(1,TagIn ++ []);graceful -> ?RT_BER:encode_enumerated(2,TagIn ++ []);restart -> ?RT_BER:encode_enumerated(3,TagIn ++ []);disconnected -> ?RT_BER:encode_enumerated(4,TagIn ++ []);handOff -> ?RT_BER:encode_enumerated(5,TagIn ++ []);{asn1_enum,Enumval1} -> ?RT_BER:encode_enumerated(Enumval1,TagIn ++ []);Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}})end.'dec_ServiceChangeMethod'(Bytes, OptOrMand) ->   'dec_ServiceChangeMethod'(Bytes, OptOrMand, []).'dec_ServiceChangeMethod'(Bytes, OptOrMand, TagIn) ->?RT_BER:decode_enumerated(Bytes,[],{[{failover,0},{forced,1},{graceful,2},{restart,3},{disconnected,4},{handOff,5}],[]},TagIn++[], OptOrMand).%%================================%%  ServiceChangeResParm%%================================'enc_ServiceChangeResParm'(Val, TagIn) ->%%-------------------------------------------------%% attribute number 1   External megaco_ber_media_gateway_control_v1:MId OPTIONAL%%-------------------------------------------------   {EncBytes1,EncLen1} =  case ?RT_BER:cindex(2,Val,serviceChangeMgcId) of         asn1_NOVALUE -> {<<>>,0};         _ ->            'enc_MId'(?RT_BER:cindex(2,Val,serviceChangeMgcId), [{tag,128,0,'EXPLICIT',32}])       end,%%-------------------------------------------------%% attribute number 2   External megaco_ber_media_gateway_control_v1:ServiceChangeAddress OPTIONAL%%-------------------------------------------------   {EncBytes2,EncLen2} =  case ?RT_BER:cindex(3,Val,serviceChangeAddress) of         asn1_NOVALUE -> {<<>>,0};         _ ->            'enc_ServiceChangeAddress'(?RT_BER:cindex(3,Val,serviceChangeAddress), [{tag,128,1,'EXPLICIT',32}])       end,%%-------------------------------------------------%% attribute number 3 with type INTEGER OPTIONAL%%-------------------------------------------------   {EncBytes3,EncLen3} =  case ?RT_BER:cindex(4,Val,serviceChangeVersion) of         asn1_NOVALUE -> {<<>>,0};         _ ->            ?RT_BER:encode_integer([], ?RT_BER:cindex(4,Val,serviceChangeVersion), [{tag,128,2,'IMPLICIT',0}])       end,%%-------------------------------------------------%% attribute number 4   External megaco_ber_media_gateway_control_v1:ServiceChangeProfile OPTIONAL%%-------------------------------------------------   {EncBytes4,EncLen4} =  case ?RT_BER:cindex(5,Val,serviceChangeProfile) of         asn1_NOVALUE -> {<<>>,0};         _ ->            'enc_ServiceChangeProfile'(?RT_BER:cindex(5,Val,serviceChangeProfile), [{tag,128,3,'IMPLICIT',0}])       end,%%-------------------------------------------------%% attribute number 5   External megaco_ber_media_gateway_control_v1:TimeNotation OPTIONAL%%-------------------------------------------------   {EncBytes5,EncLen5} =  case ?RT_BER:cindex(6,Val,timeStamp) of         asn1_NOVALUE -> {<<>>,0};         _ ->            'enc_TimeNotation'(?RT_BER:cindex(6,Val,timeStamp), [{tag,128,4,'IMPLICIT',0}])       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).'dec_ServiceChangeResParm'(Bytes, OptOrMand) ->   'dec_ServiceChangeResParm'(Bytes, OptOrMand, []).'dec_ServiceChangeResParm'(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 megaco_ber_media_gateway_control_v1:MId OPTIONAL%%-------------------------------------------------   {Term1,Bytes3,Rb2} = case Bytes2 of<<2:2,_:1,0:5,_/binary>> ->'dec_MId'(Bytes2, opt_or_default, [{tag,128,0,'EXPLICIT',32}]);_ ->{ asn1_NOVALUE, Bytes2, 0 }end,%%-------------------------------------------------%% attribute number 2   External megaco_ber_media_gateway_control_v1:ServiceChangeAddress OPTIONAL%%-------------------------------------------------   {Term2,Bytes4,Rb3} = case Bytes3 of<<2:2,_:1,1:5,_/binary>> ->'dec_ServiceChangeAddress'(Bytes3, opt_or_default, [{tag,128,1,'EXPLICIT',32}]);_ ->{ asn1_NOVALUE, Bytes3, 0 }end,%%-------------------------------------------------%% attribute number 3 with type INTEGER OPTIONAL%%-------------------------------------------------   {Term3,Bytes5,Rb4} = case Bytes4 of<<2:2,_:1,2:5,_/binary>> ->?RT_BER:decode_integer(Bytes4,{0,99},[{tag,128,2,'IMPLICIT',0}], mandatory);_ ->{ asn1_NOVALUE, Bytes4, 0 }end,%%-------------------------------------------------%% attribute number 4   External megaco_ber_media_gateway_control_v1:ServiceChangeProfile OPTIONAL%%-------------------------------------------------   {Term4,Bytes6,Rb5} = case Bytes5 of<<2:2,_:1,3:5,_/binary>> ->'dec_ServiceChangeProfile'(Bytes5, opt_or_default, [{tag,128,3,'IMPLICIT',0}]);_ ->{ asn1_NOVALUE, Bytes5, 0 }end,%%-------------------------------------------------%% attribute number 5   External megaco_ber_media_gateway_control_v1:TimeNotation OPTIONAL%%-------------------------------------------------   {Term5,Bytes7,Rb6} = case Bytes6 of<<2:2,_:1,4:5,_/binary>> ->'dec_TimeNotation'(Bytes6, opt_or_default, [{tag,128,4,'IMPLICIT',0}]);_ ->{ asn1_NOVALUE, Bytes6, 0 }end,   {Bytes8,Rb7} = ?RT_BER:restbytes2(RemBytes, Bytes7,ext),   {{'ServiceChangeResParm', Term1, Term2, Term3, Term4, Term5}, Bytes8, Rb1+Rb2+Rb3+Rb4+Rb5+Rb6+Rb7}.%%================================%%  ServiceChangeAddress%%================================'enc_ServiceChangeAddress'({'ServiceChangeAddress',Val}, TagIn) ->   'enc_ServiceChangeAddress'(Val, TagIn);'enc_ServiceChangeAddress'(Val, TagIn) ->   {EncBytes,EncLen} = case element(1,Val) of      portNumber ->         ?RT_BER:encode_integer([], element(2,Val), [{tag,128,0,'IMPLICIT',0}]);      ip4Address ->         'enc_IP4Address'(element(2,Val), [{tag,128,1,'IMPLICIT',0}]);      ip6Address ->         'enc_IP6Address'(element(2,Val), [{tag,128,2,'IMPLICIT',0}]);      domainName ->         'enc_DomainName'(element(2,Val), [{tag,128,3,'IMPLICIT',0}]);      deviceName ->         ?RT_BER:encode_restricted_string([], element(2,Val), 22, [{tag,128,4,'IMPLICIT',0}]);      mtpAddress ->         ?RT_BER:encode_octet_string([], element(2,Val), [{tag,128,5,'IMPLICIT',0}]);      Else ->          exit({error,{asn1,{invalid_choice_type,Else}}})   end,?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen).'dec_ServiceChangeAddress'(Bytes, OptOrMand) ->   'dec_ServiceChangeAddress'(Bytes, OptOrMand, []).'dec_ServiceChangeAddress'(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%% 'portNumber'      <<2:2,_:1,0:5,_/binary>> ->         {Dec, Rest, RbCho} = ?RT_BER:decode_integer(Bytes1,{0,65535},[{tag,128,0,'IMPLICIT',0}], mandatory),         {{portNumber, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};%% 'ip4Address'      <<2:2,_:1,1:5,_/binary>> ->         {Dec, Rest, RbCho} = 'dec_IP4Address'(Bytes1, mandatory, [{tag,128,1,'IMPLICIT',0}]),         {{ip4Address, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};%% 'ip6Address'      <<2:2,_:1,2:5,_/binary>> ->         {Dec, Rest, RbCho} = 'dec_IP6Address'(Bytes1, mandatory, [{tag,128,2,'IMPLICIT',0}]),         {{ip6Address, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};%% 'domainName'      <<2:2,_:1,3:5,_/binary>> ->         {Dec, Rest, RbCho} = 'dec_DomainName'(Bytes1, mandatory, [{tag,128,3,'IMPLICIT',0}]),         {{domainName, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};%% 'deviceName'      <<2:2,_:1,4:5,_/binary>> ->         {Dec, Rest, RbCho} = ?RT_BER:decode_restricted_string(Bytes1,{1,64},22,[{tag,128,4,'IMPLICIT',0}], no_length, mandatory),         {{deviceName, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -