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

📄 megaco_ber_media_gateway_control_v1.erl

📁 OTP是开放电信平台的简称
💻 ERL
📖 第 1 页 / 共 5 页
字号:
'dec_Value'(Bytes, OptOrMand) ->   'dec_Value'(Bytes, OptOrMand, []).'dec_Value'(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(FBytes,_,_)->?RT_BER:decode_octet_string(FBytes,[],[], no_length, mandatory)end, [], []).%%================================%%  TimeNotation%%================================'enc_TimeNotation'(Val, TagIn) ->%%-------------------------------------------------%% attribute number 1 with type IA5String%%-------------------------------------------------   {EncBytes1,EncLen1} = ?RT_BER:encode_restricted_string([], ?RT_BER:cindex(2,Val,date), 22, [{tag,128,0,'IMPLICIT',0}]),%%-------------------------------------------------%% attribute number 2 with type IA5String%%-------------------------------------------------   {EncBytes2,EncLen2} = ?RT_BER:encode_restricted_string([], ?RT_BER:cindex(3,Val,time), 22, [{tag,128,1,'IMPLICIT',0}]),   BytesSoFar = [EncBytes1, EncBytes2],  LenSoFar = EncLen1 + EncLen2,  ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar).'dec_TimeNotation'(Bytes, OptOrMand) ->   'dec_TimeNotation'(Bytes, OptOrMand, []).'dec_TimeNotation'(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,8,22,[{tag,128,0,'IMPLICIT',0}], no_length, mandatory),%%-------------------------------------------------%% attribute number 2 with type IA5String%%-------------------------------------------------   {Term2,Bytes4,Rb3} = ?RT_BER:decode_restricted_string(Bytes3,8,22,[{tag,128,1,'IMPLICIT',0}], no_length, mandatory),   {Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext),   {{'TimeNotation', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}.%%================================%%  H221NonStandard%%================================'enc_H221NonStandard'(Val, TagIn) ->%%-------------------------------------------------%% attribute number 1 with type INTEGER%%-------------------------------------------------   {EncBytes1,EncLen1} = ?RT_BER:encode_integer([], ?RT_BER:cindex(2,Val,t35CountryCode1), [{tag,128,0,'IMPLICIT',0}]),%%-------------------------------------------------%% attribute number 2 with type INTEGER%%-------------------------------------------------   {EncBytes2,EncLen2} = ?RT_BER:encode_integer([], ?RT_BER:cindex(3,Val,t35CountryCode2), [{tag,128,1,'IMPLICIT',0}]),%%-------------------------------------------------%% attribute number 3 with type INTEGER%%-------------------------------------------------   {EncBytes3,EncLen3} = ?RT_BER:encode_integer([], ?RT_BER:cindex(4,Val,t35Extension), [{tag,128,2,'IMPLICIT',0}]),%%-------------------------------------------------%% attribute number 4 with type INTEGER%%-------------------------------------------------   {EncBytes4,EncLen4} = ?RT_BER:encode_integer([], ?RT_BER:cindex(5,Val,manufacturerCode), [{tag,128,3,'IMPLICIT',0}]),   BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4],  LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4,  ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar).'dec_H221NonStandard'(Bytes, OptOrMand) ->   'dec_H221NonStandard'(Bytes, OptOrMand, []).'dec_H221NonStandard'(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,{0,255},[{tag,128,0,'IMPLICIT',0}], mandatory),%%-------------------------------------------------%% attribute number 2 with type INTEGER%%-------------------------------------------------   {Term2,Bytes4,Rb3} = ?RT_BER:decode_integer(Bytes3,{0,255},[{tag,128,1,'IMPLICIT',0}], mandatory),%%-------------------------------------------------%% attribute number 3 with type INTEGER%%-------------------------------------------------   {Term3,Bytes5,Rb4} = ?RT_BER:decode_integer(Bytes4,{0,255},[{tag,128,2,'IMPLICIT',0}], mandatory),%%-------------------------------------------------%% attribute number 4 with type INTEGER%%-------------------------------------------------   {Term4,Bytes6,Rb5} = ?RT_BER:decode_integer(Bytes5,{0,65535},[{tag,128,3,'IMPLICIT',0}], mandatory),   {Bytes7,Rb6} = ?RT_BER:restbytes2(RemBytes, Bytes6,ext),   {{'H221NonStandard', Term1, Term2, Term3, Term4}, Bytes7, Rb1+Rb2+Rb3+Rb4+Rb5+Rb6}.%%================================%%  NonStandardIdentifier%%================================'enc_NonStandardIdentifier'({'NonStandardIdentifier',Val}, TagIn) ->   'enc_NonStandardIdentifier'(Val, TagIn);'enc_NonStandardIdentifier'(Val, TagIn) ->   {EncBytes,EncLen} = case element(1,Val) of      object ->         ?RT_BER:encode_object_identifier(element(2,Val), [{tag,128,0,'IMPLICIT',0}]);      h221NonStandard ->         'enc_H221NonStandard'(element(2,Val), [{tag,128,1,'IMPLICIT',0}]);      experimental ->         ?RT_BER:encode_restricted_string([], element(2,Val), 22, [{tag,128,2,'IMPLICIT',0}]);      Else ->          exit({error,{asn1,{invalid_choice_type,Else}}})   end,?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen).'dec_NonStandardIdentifier'(Bytes, OptOrMand) ->   'dec_NonStandardIdentifier'(Bytes, OptOrMand, []).'dec_NonStandardIdentifier'(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%% 'object'      <<2:2,_:1,0:5,_/binary>> ->         {Dec, Rest, RbCho} = ?RT_BER:decode_object_identifier(Bytes1,[{tag,128,0,'IMPLICIT',0}], mandatory),         {{object, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};%% 'h221NonStandard'      <<2:2,_:1,1:5,_/binary>> ->         {Dec, Rest, RbCho} = 'dec_H221NonStandard'(Bytes1, mandatory, [{tag,128,1,'IMPLICIT',0}]),         {{h221NonStandard, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};%% 'experimental'      <<2:2,_:1,2:5,_/binary>> ->         {Dec, Rest, RbCho} = ?RT_BER:decode_restricted_string(Bytes1,8,22,[{tag,128,2,'IMPLICIT',0}], no_length, mandatory),         {{experimental, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};      _ ->          {{asn1_ExtAlt,Bytes1},<<>>, RbExp}   end.%%================================%%  NonStandardData%%================================'enc_NonStandardData'(Val, TagIn) ->%%-------------------------------------------------%% attribute number 1   External megaco_ber_media_gateway_control_v1:NonStandardIdentifier%%-------------------------------------------------   {EncBytes1,EncLen1} = 'enc_NonStandardIdentifier'(?RT_BER:cindex(2,Val,nonStandardIdentifier), [{tag,128,0,'EXPLICIT',32}]),%%-------------------------------------------------%% attribute number 2 with type OCTET STRING%%-------------------------------------------------   {EncBytes2,EncLen2} = ?RT_BER:encode_octet_string([], ?RT_BER:cindex(3,Val,data), [{tag,128,1,'IMPLICIT',0}]),   BytesSoFar = [EncBytes1, EncBytes2],  LenSoFar = EncLen1 + EncLen2,  ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar).'dec_NonStandardData'(Bytes, OptOrMand) ->   'dec_NonStandardData'(Bytes, OptOrMand, []).'dec_NonStandardData'(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:NonStandardIdentifier%%-------------------------------------------------   {Term1,Bytes3,Rb2} = 'dec_NonStandardIdentifier'(Bytes2, mandatory, [{tag,128,0,'EXPLICIT',32}]),%%-------------------------------------------------%% attribute number 2 with type OCTET STRING%%-------------------------------------------------   {Term2,Bytes4,Rb3} = ?RT_BER:decode_octet_string(Bytes3,[],[{tag,128,1,'IMPLICIT',0}], no_length, mandatory),   {Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext),   {{'NonStandardData', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}.%%================================%%  StatisticsParameter%%================================'enc_StatisticsParameter'(Val, TagIn) ->%%-------------------------------------------------%% attribute number 1 with type OCTET STRING%%-------------------------------------------------   {EncBytes1,EncLen1} = ?RT_BER:encode_octet_string([], ?RT_BER:cindex(2,Val,statName), [{tag,128,0,'IMPLICIT',0}]),%%-------------------------------------------------%% attribute number 2   External megaco_ber_media_gateway_control_v1:Value OPTIONAL%%-------------------------------------------------   {EncBytes2,EncLen2} =  case ?RT_BER:cindex(3,Val,statValue) of         asn1_NOVALUE -> {<<>>,0};         _ ->            'enc_Value'(?RT_BER:cindex(3,Val,statValue), [{tag,128,1,'IMPLICIT',0}])       end,   BytesSoFar = [EncBytes1, EncBytes2],  LenSoFar = EncLen1 + EncLen2,  ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar).'dec_StatisticsParameter'(Bytes, OptOrMand) ->   'dec_StatisticsParameter'(Bytes, OptOrMand, []).'dec_StatisticsParameter'(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,4,[{tag,128,0,'IMPLICIT',0}], no_length, mandatory),%%-------------------------------------------------%% attribute number 2   External megaco_ber_media_gateway_control_v1:Value OPTIONAL%%-------------------------------------------------   {Term2,Bytes4,Rb3} = case Bytes3 of<<2:2,_:1,1:5,_/binary>> ->'dec_Value'(Bytes3, opt_or_default, [{tag,128,1,'IMPLICIT',0}]);_ ->{ asn1_NOVALUE, Bytes3, 0 }end,   {Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext),   {{'StatisticsParameter', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}.%%================================%%  StatisticsDescriptor%%================================'enc_StatisticsDescriptor'({'StatisticsDescriptor',Val}, TagIn) ->   'enc_StatisticsDescriptor'(Val, TagIn);'enc_StatisticsDescriptor'(Val, TagIn) ->   {EncBytes,EncLen} = 'enc_StatisticsDescriptor_components'(Val,[],0),   ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], EncBytes, EncLen).'enc_StatisticsDescriptor_components'([], AccBytes, AccLen) ->    {lists:reverse(AccBytes),AccLen};'enc_StatisticsDescriptor_components'([H|T],AccBytes, AccLen) ->   {EncBytes,EncLen} = 'enc_StatisticsParameter'(H, []),   'enc_StatisticsDescriptor_components'(T,[EncBytes|AccBytes], AccLen + EncLen).'dec_StatisticsDescriptor'(Bytes, OptOrMand) ->   'dec_StatisticsDescriptor'(Bytes, OptOrMand, []).'dec_StatisticsDescriptor'(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_StatisticsParameter'/3, [], []).%%================================%%  PackagesItem%%================================'enc_PackagesItem'(Val, TagIn) ->%%-------------------------------------------------%% attribute number 1 with type OCTET STRING%%-------------------------------------------------   {EncBytes1,EncLen1} = ?RT_BER:encode_octet_string([], ?RT_BER:cindex(2,Val,packageName), [{tag,128,0,'IMPLICIT',0}]),

⌨️ 快捷键说明

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