%% Generated by the Erlang ASN.1 BER compiler. Version: 5.1 %% Purpose: Encoding and decoding of the types in IPMSAbstractService. -module('IPMSAbstractService'). -compile(nowarn_unused_vars). -dialyzer(no_improper_lists). -dialyzer(no_match). -asn1_info([{vsn,'5.1'}, {module,'IPMSAbstractService'}, {options,[warnings,ber,errors, {cwd,"/Users/maxim/depot/synrc/mail/priv/mhs"}, {outdir,"/Users/maxim/depot/synrc/mail/priv/mhs"}, {i,"."}, {i,"/Users/maxim/depot/synrc/mail/priv/mhs"}]}]). -export([encoding_rule/0,maps/0,bit_string_format/0, legacy_erlang_types/0]). -export(['dialyzer-suppressions'/1]). -export([ enc_SubscriptionProblem/2 ]). -export([ dec_SubscriptionProblem/2 ]). -export([ 'enc_originate-probe'/3, 'enc_originate-ipm'/3, 'enc_originate-rn'/3, 'enc_originate-on'/3, 'enc_receive-report'/3, 'enc_receive-ipm'/3, 'enc_receive-rn'/3, 'enc_receive-nrn'/3, 'enc_receive-on'/3, 'enc_change-auto-discard'/3, 'enc_change-auto-acknowledgment'/3, 'enc_change-auto-forwarding'/3, 'enc_subscription-error'/3 ]). -export([ 'dec_originate-probe'/3, 'dec_originate-ipm'/3, 'dec_originate-rn'/3, 'dec_originate-on'/3, 'dec_receive-report'/3, 'dec_receive-ipm'/3, 'dec_receive-rn'/3, 'dec_receive-nrn'/3, 'dec_receive-on'/3, 'dec_change-auto-discard'/3, 'dec_change-auto-acknowledgment'/3, 'dec_change-auto-forwarding'/3, 'dec_subscription-error'/3 ]). -export([info/0]). -export([encode/2,decode/2]). encoding_rule() -> ber. maps() -> false. bit_string_format() -> bitstring. legacy_erlang_types() -> false. encode(Type, Data) -> try iolist_to_binary(element(1, encode_disp(Type, Data))) of Bytes -> {ok,Bytes} catch Class:Exception:Stk when Class =:= error; Class =:= exit -> case Exception of {error,{asn1,Reason}} -> {error,{asn1,{Reason,Stk}}}; Reason -> {error,{asn1,{Reason,Stk}}} end end. decode(Type, Data) -> try Result = decode_disp(Type, element(1, ber_decode_nif(Data))), {ok,Result} catch Class:Exception:Stk when Class =:= error; Class =:= exit -> case Exception of {error,{asn1,Reason}} -> {error,{asn1,{Reason,Stk}}}; Reason -> {error,{asn1,{Reason,Stk}}} end end. encode_disp('SubscriptionProblem', Data) -> enc_SubscriptionProblem(Data); encode_disp(Type, _Data) -> exit({error,{asn1,{undefined_type,Type}}}). decode_disp('SubscriptionProblem', Data) -> dec_SubscriptionProblem(Data); decode_disp(Type, _Data) -> exit({error,{asn1,{undefined_type,Type}}}). info() -> 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. %%================================ %% SubscriptionProblem %%================================ enc_SubscriptionProblem(Val) -> enc_SubscriptionProblem(Val, [<<10>>]). enc_SubscriptionProblem(Val, TagIn) -> case Val of 'ipms-eos-not-subscribed' -> encode_tags(TagIn, [0], 1); 'mts-eos-not-subscribed' -> encode_tags(TagIn, [1], 1); Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}}) end. dec_SubscriptionProblem(Tlv) -> dec_SubscriptionProblem(Tlv, [10]). dec_SubscriptionProblem(Tlv, TagIn) -> case decode_integer(Tlv, TagIn) of 0 -> 'ipms-eos-not-subscribed'; 1 -> 'mts-eos-not-subscribed'; Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) end. %%================================ %% originate-probe %%================================ 'enc_originate-probe'('ArgumentType', Val, _RestPrimFieldName) -> 'enc_originate-probe_ArgumentType'(Val,[<<49>>]); 'enc_originate-probe'('ResultType', Val, _RestPrimFieldName) -> 'enc_originate-probe_ResultType'(Val,[<<49>>]). %%================================ %% originate-probe_ResultType %%================================ 'enc_originate-probe_ResultType'(Val, TagIn) -> {_,Cindex1,Cindex2} = Val, %%------------------------------------------------- %% attribute submission-identifier(1) External MTSAbstractService:ProbeSubmissionIdentifier %%------------------------------------------------- {EncBytes1,EncLen1} = 'MTSAbstractService':'enc_ProbeSubmissionIdentifier'(Cindex1, [<<160>>]), %%------------------------------------------------- %% attribute submission-time(2) with type UTCTime %%------------------------------------------------- {EncBytes2,EncLen2} = encode_restricted_string(Cindex2, [<<129>>]), BytesSoFar = [EncBytes1, EncBytes2], LenSoFar = EncLen1 + EncLen2, encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% originate-probe_ArgumentType %%================================ 'enc_originate-probe_ArgumentType'(Val, TagIn) -> {_,Cindex1,Cindex2} = Val, %%------------------------------------------------- %% attribute envelope(1) External MTSAbstractService:ProbeSubmissionEnvelope %%------------------------------------------------- {EncBytes1,EncLen1} = 'MTSAbstractService':'enc_ProbeSubmissionEnvelope'(Cindex1, [<<160>>]), %%------------------------------------------------- %% attribute content(2) External IPMSInformationObjects:IPM %%------------------------------------------------- {EncBytes2,EncLen2} = 'IPMSInformationObjects':'enc_IPM'(Cindex2, [<<161>>]), BytesSoFar = [EncBytes1, EncBytes2], LenSoFar = EncLen1 + EncLen2, encode_tags(TagIn, BytesSoFar, LenSoFar). 'dec_originate-probe'('ArgumentType', Bytes,_) -> Tlv = tlv_format(Bytes), 'dec_originate-probe_ArgumentType'(Tlv,[17]); 'dec_originate-probe'('ResultType', Bytes,_) -> Tlv = tlv_format(Bytes), 'dec_originate-probe_ResultType'(Tlv,[17]). 'dec_originate-probe_ResultType'(Tlv, TagIn) -> Tlv1 = match_tags(Tlv, TagIn), SetFun = fun(FunTlv) -> case FunTlv of %submission-identifier TTlv = {131072,_} -> {1, TTlv}; %submission-time TTlv = {131073,_} -> {2, TTlv}; Else -> {3, Else} end end, PositionList = [SetFun(TempTlv)|| TempTlv <- Tlv1], Tlv2 = [Stlv || {_,Stlv} <- lists:sort(PositionList)], %%------------------------------------------------- %% attribute submission-identifier(1) External MTSAbstractService:ProbeSubmissionIdentifier %%------------------------------------------------- [V1|Tlv3] = Tlv2, Term1 = 'MTSAbstractService':'dec_ProbeSubmissionIdentifier'(V1, [131072]), %%------------------------------------------------- %% attribute submission-time(2) with type UTCTime %%------------------------------------------------- [V2|Tlv4] = Tlv3, Term2 = begin binary_to_list(decode_restricted_string(V2, [131073])) end , case Tlv4 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowed end, Res1 = {'originate-probe_ResultType',Term1,Term2}, Res1. 'dec_originate-probe_ArgumentType'(Tlv, TagIn) -> Tlv1 = match_tags(Tlv, TagIn), SetFun = fun(FunTlv) -> case FunTlv of %envelope TTlv = {131072,_} -> {1, TTlv}; %content TTlv = {131073,_} -> {2, TTlv}; Else -> {3, Else} end end, PositionList = [SetFun(TempTlv)|| TempTlv <- Tlv1], Tlv2 = [Stlv || {_,Stlv} <- lists:sort(PositionList)], %%------------------------------------------------- %% attribute envelope(1) External MTSAbstractService:ProbeSubmissionEnvelope %%------------------------------------------------- [V1|Tlv3] = Tlv2, Term1 = 'MTSAbstractService':'dec_ProbeSubmissionEnvelope'(V1, [131072]), %%------------------------------------------------- %% attribute content(2) External IPMSInformationObjects:IPM %%------------------------------------------------- [V2|Tlv4] = Tlv3, Term2 = 'IPMSInformationObjects':'dec_IPM'(V2, [131073]), case Tlv4 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowed end, Res1 = {'originate-probe_ArgumentType',Term1,Term2}, Res1. tlv_format(Bytes) when is_binary(Bytes) -> {Tlv,_} = ber_decode_nif(Bytes), Tlv; tlv_format(Bytes) -> Bytes. %%================================ %% originate-ipm %%================================ 'enc_originate-ipm'('ArgumentType', Val, _RestPrimFieldName) -> 'enc_originate-ipm_ArgumentType'(Val,[<<49>>]); 'enc_originate-ipm'('ResultType', Val, _RestPrimFieldName) -> 'enc_originate-ipm_ResultType'(Val,[<<49>>]). %%================================ %% originate-ipm_ResultType %%================================ 'enc_originate-ipm_ResultType'(Val, TagIn) -> {_,Cindex1,Cindex2} = Val, %%------------------------------------------------- %% attribute submission-identifier(1) External MTSAbstractService:MessageSubmissionIdentifier %%------------------------------------------------- {EncBytes1,EncLen1} = 'MTSAbstractService':'enc_MessageSubmissionIdentifier'(Cindex1, [<<160>>]), %%------------------------------------------------- %% attribute submission-time(2) with type UTCTime %%------------------------------------------------- {EncBytes2,EncLen2} = encode_restricted_string(Cindex2, [<<129>>]), BytesSoFar = [EncBytes1, EncBytes2], LenSoFar = EncLen1 + EncLen2, encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% originate-ipm_ArgumentType %%================================ 'enc_originate-ipm_ArgumentType'(Val, TagIn) -> {_,Cindex1,Cindex2} = Val, %%------------------------------------------------- %% attribute envelope(1) External MTSAbstractService:MessageSubmissionEnvelope %%------------------------------------------------- {EncBytes1,EncLen1} = 'MTSAbstractService':'enc_MessageSubmissionEnvelope'(Cindex1, [<<160>>]), %%------------------------------------------------- %% attribute content(2) External IPMSInformationObjects:IPM %%------------------------------------------------- {EncBytes2,EncLen2} = 'IPMSInformationObjects':'enc_IPM'(Cindex2, [<<161>>]), BytesSoFar = [EncBytes1, EncBytes2], LenSoFar = EncLen1 + EncLen2, encode_tags(TagIn, BytesSoFar, LenSoFar). 'dec_originate-ipm'('ArgumentType', Bytes,_) -> Tlv = tlv_format(Bytes), 'dec_originate-ipm_ArgumentType'(Tlv,[17]); 'dec_originate-ipm'('ResultType', Bytes,_) -> Tlv = tlv_format(Bytes), 'dec_originate-ipm_ResultType'(Tlv,[17]). 'dec_originate-ipm_ResultType'(Tlv, TagIn) -> Tlv1 = match_tags(Tlv, TagIn), SetFun = fun(FunTlv) -> case FunTlv of %submission-identifier TTlv = {131072,_} -> {1, TTlv}; %submission-time TTlv = {131073,_} -> {2, TTlv}; Else -> {3, Else} end end, PositionList = [SetFun(TempTlv)|| TempTlv <- Tlv1], Tlv2 = [Stlv || {_,Stlv} <- lists:sort(PositionList)], %%------------------------------------------------- %% attribute submission-identifier(1) External MTSAbstractService:MessageSubmissionIdentifier %%------------------------------------------------- [V1|Tlv3] = Tlv2, Term1 = 'MTSAbstractService':'dec_MessageSubmissionIdentifier'(V1, [131072]), %%------------------------------------------------- %% attribute submission-time(2) with type UTCTime %%------------------------------------------------- [V2|Tlv4] = Tlv3, Term2 = begin binary_to_list(decode_restricted_string(V2, [131073])) end , case Tlv4 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowed end, Res1 = {'originate-ipm_ResultType',Term1,Term2}, Res1. 'dec_originate-ipm_ArgumentType'(Tlv, TagIn) -> Tlv1 = match_tags(Tlv, TagIn), SetFun = fun(FunTlv) -> case FunTlv of %envelope TTlv = {131072,_} -> {1, TTlv}; %content TTlv = {131073,_} -> {2, TTlv}; Else -> {3, Else} end end, PositionList = [SetFun(TempTlv)|| TempTlv <- Tlv1], Tlv2 = [Stlv || {_,Stlv} <- lists:sort(PositionList)], %%------------------------------------------------- %% attribute envelope(1) External MTSAbstractService:MessageSubmissionEnvelope %%------------------------------------------------- [V1|Tlv3] = Tlv2, Term1 = 'MTSAbstractService':'dec_MessageSubmissionEnvelope'(V1, [131072]), %%------------------------------------------------- %% attribute content(2) External IPMSInformationObjects:IPM %%------------------------------------------------- [V2|Tlv4] = Tlv3, Term2 = 'IPMSInformationObjects':'dec_IPM'(V2, [131073]), case Tlv4 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowed end, Res1 = {'originate-ipm_ArgumentType',Term1,Term2}, Res1. %%================================ %% originate-rn %%================================ 'enc_originate-rn'('ArgumentType', Val, _RestPrimFieldName) -> 'enc_originate-rn_ArgumentType'(Val,[<<49>>]); 'enc_originate-rn'('ResultType', Val, _RestPrimFieldName) -> 'enc_originate-rn_ResultType'(Val,[<<49>>]). %%================================ %% originate-rn_ResultType %%================================ 'enc_originate-rn_ResultType'(Val, TagIn) -> {_,Cindex1,Cindex2} = Val, %%------------------------------------------------- %% attribute submission-identifier(1) External MTSAbstractService:MessageSubmissionIdentifier %%------------------------------------------------- {EncBytes1,EncLen1} = 'MTSAbstractService':'enc_MessageSubmissionIdentifier'(Cindex1, [<<160>>]), %%------------------------------------------------- %% attribute submission-time(2) with type UTCTime %%------------------------------------------------- {EncBytes2,EncLen2} = encode_restricted_string(Cindex2, [<<129>>]), BytesSoFar = [EncBytes1, EncBytes2], LenSoFar = EncLen1 + EncLen2, encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% originate-rn_ArgumentType %%================================ 'enc_originate-rn_ArgumentType'(Val, TagIn) -> {_,Cindex1,Cindex2} = Val, %%------------------------------------------------- %% attribute envelope(1) External MTSAbstractService:MessageSubmissionEnvelope %%------------------------------------------------- {EncBytes1,EncLen1} = 'MTSAbstractService':'enc_MessageSubmissionEnvelope'(Cindex1, [<<160>>]), %%------------------------------------------------- %% attribute content(2) External IPMSInformationObjects:RN %%------------------------------------------------- {EncBytes2,EncLen2} = 'IPMSInformationObjects':'enc_RN'(Cindex2, [<<161>>]), BytesSoFar = [EncBytes1, EncBytes2], LenSoFar = EncLen1 + EncLen2, encode_tags(TagIn, BytesSoFar, LenSoFar). 'dec_originate-rn'('ArgumentType', Bytes,_) -> Tlv = tlv_format(Bytes), 'dec_originate-rn_ArgumentType'(Tlv,[17]); 'dec_originate-rn'('ResultType', Bytes,_) -> Tlv = tlv_format(Bytes), 'dec_originate-rn_ResultType'(Tlv,[17]). 'dec_originate-rn_ResultType'(Tlv, TagIn) -> Tlv1 = match_tags(Tlv, TagIn), SetFun = fun(FunTlv) -> case FunTlv of %submission-identifier TTlv = {131072,_} -> {1, TTlv}; %submission-time TTlv = {131073,_} -> {2, TTlv}; Else -> {3, Else} end end, PositionList = [SetFun(TempTlv)|| TempTlv <- Tlv1], Tlv2 = [Stlv || {_,Stlv} <- lists:sort(PositionList)], %%------------------------------------------------- %% attribute submission-identifier(1) External MTSAbstractService:MessageSubmissionIdentifier %%------------------------------------------------- [V1|Tlv3] = Tlv2, Term1 = 'MTSAbstractService':'dec_MessageSubmissionIdentifier'(V1, [131072]), %%------------------------------------------------- %% attribute submission-time(2) with type UTCTime %%------------------------------------------------- [V2|Tlv4] = Tlv3, Term2 = begin binary_to_list(decode_restricted_string(V2, [131073])) end , case Tlv4 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowed end, Res1 = {'originate-rn_ResultType',Term1,Term2}, Res1. 'dec_originate-rn_ArgumentType'(Tlv, TagIn) -> Tlv1 = match_tags(Tlv, TagIn), SetFun = fun(FunTlv) -> case FunTlv of %envelope TTlv = {131072,_} -> {1, TTlv}; %content TTlv = {131073,_} -> {2, TTlv}; Else -> {3, Else} end end, PositionList = [SetFun(TempTlv)|| TempTlv <- Tlv1], Tlv2 = [Stlv || {_,Stlv} <- lists:sort(PositionList)], %%------------------------------------------------- %% attribute envelope(1) External MTSAbstractService:MessageSubmissionEnvelope %%------------------------------------------------- [V1|Tlv3] = Tlv2, Term1 = 'MTSAbstractService':'dec_MessageSubmissionEnvelope'(V1, [131072]), %%------------------------------------------------- %% attribute content(2) External IPMSInformationObjects:RN %%------------------------------------------------- [V2|Tlv4] = Tlv3, Term2 = 'IPMSInformationObjects':'dec_RN'(V2, [131073]), case Tlv4 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowed end, Res1 = {'originate-rn_ArgumentType',Term1,Term2}, Res1. %%================================ %% originate-on %%================================ 'enc_originate-on'('ArgumentType', Val, _RestPrimFieldName) -> 'enc_originate-on_ArgumentType'(Val,[<<49>>]); 'enc_originate-on'('ResultType', Val, _RestPrimFieldName) -> 'enc_originate-on_ResultType'(Val,[<<49>>]). %%================================ %% originate-on_ResultType %%================================ 'enc_originate-on_ResultType'(Val, TagIn) -> {_,Cindex1,Cindex2} = Val, %%------------------------------------------------- %% attribute submission-identifier(1) External MTSAbstractService:MessageSubmissionIdentifier %%------------------------------------------------- {EncBytes1,EncLen1} = 'MTSAbstractService':'enc_MessageSubmissionIdentifier'(Cindex1, [<<160>>]), %%------------------------------------------------- %% attribute submission-time(2) with type UTCTime %%------------------------------------------------- {EncBytes2,EncLen2} = encode_restricted_string(Cindex2, [<<129>>]), BytesSoFar = [EncBytes1, EncBytes2], LenSoFar = EncLen1 + EncLen2, encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% originate-on_ArgumentType %%================================ 'enc_originate-on_ArgumentType'(Val, TagIn) -> {_,Cindex1,Cindex2} = Val, %%------------------------------------------------- %% attribute envelope(1) External MTSAbstractService:MessageSubmissionEnvelope %%------------------------------------------------- {EncBytes1,EncLen1} = 'MTSAbstractService':'enc_MessageSubmissionEnvelope'(Cindex1, [<<160>>]), %%------------------------------------------------- %% attribute content(2) External IPMSInformationObjects:ON %%------------------------------------------------- {EncBytes2,EncLen2} = 'IPMSInformationObjects':'enc_ON'(Cindex2, [<<161>>]), BytesSoFar = [EncBytes1, EncBytes2], LenSoFar = EncLen1 + EncLen2, encode_tags(TagIn, BytesSoFar, LenSoFar). 'dec_originate-on'('ArgumentType', Bytes,_) -> Tlv = tlv_format(Bytes), 'dec_originate-on_ArgumentType'(Tlv,[17]); 'dec_originate-on'('ResultType', Bytes,_) -> Tlv = tlv_format(Bytes), 'dec_originate-on_ResultType'(Tlv,[17]). 'dec_originate-on_ResultType'(Tlv, TagIn) -> Tlv1 = match_tags(Tlv, TagIn), SetFun = fun(FunTlv) -> case FunTlv of %submission-identifier TTlv = {131072,_} -> {1, TTlv}; %submission-time TTlv = {131073,_} -> {2, TTlv}; Else -> {3, Else} end end, PositionList = [SetFun(TempTlv)|| TempTlv <- Tlv1], Tlv2 = [Stlv || {_,Stlv} <- lists:sort(PositionList)], %%------------------------------------------------- %% attribute submission-identifier(1) External MTSAbstractService:MessageSubmissionIdentifier %%------------------------------------------------- [V1|Tlv3] = Tlv2, Term1 = 'MTSAbstractService':'dec_MessageSubmissionIdentifier'(V1, [131072]), %%------------------------------------------------- %% attribute submission-time(2) with type UTCTime %%------------------------------------------------- [V2|Tlv4] = Tlv3, Term2 = begin binary_to_list(decode_restricted_string(V2, [131073])) end , case Tlv4 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowed end, Res1 = {'originate-on_ResultType',Term1,Term2}, Res1. 'dec_originate-on_ArgumentType'(Tlv, TagIn) -> Tlv1 = match_tags(Tlv, TagIn), SetFun = fun(FunTlv) -> case FunTlv of %envelope TTlv = {131072,_} -> {1, TTlv}; %content TTlv = {131073,_} -> {2, TTlv}; Else -> {3, Else} end end, PositionList = [SetFun(TempTlv)|| TempTlv <- Tlv1], Tlv2 = [Stlv || {_,Stlv} <- lists:sort(PositionList)], %%------------------------------------------------- %% attribute envelope(1) External MTSAbstractService:MessageSubmissionEnvelope %%------------------------------------------------- [V1|Tlv3] = Tlv2, Term1 = 'MTSAbstractService':'dec_MessageSubmissionEnvelope'(V1, [131072]), %%------------------------------------------------- %% attribute content(2) External IPMSInformationObjects:ON %%------------------------------------------------- [V2|Tlv4] = Tlv3, Term2 = 'IPMSInformationObjects':'dec_ON'(V2, [131073]), case Tlv4 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowed end, Res1 = {'originate-on_ArgumentType',Term1,Term2}, Res1. %%================================ %% receive-report %%================================ 'enc_receive-report'('ArgumentType', Val, _RestPrimFieldName) -> 'enc_receive-report_ArgumentType'(Val,[<<49>>]); 'enc_receive-report'('ResultType', Val, _RestPrimFieldName) -> {Val,0}. %%================================ %% receive-report_ArgumentType %%================================ 'enc_receive-report_ArgumentType'(Val, TagIn) -> {_,Cindex1,Cindex2} = Val, %%------------------------------------------------- %% attribute envelope(1) External MTSAbstractService:ReportDeliveryEnvelope %%------------------------------------------------- {EncBytes1,EncLen1} = 'MTSAbstractService':'enc_ReportDeliveryEnvelope'(Cindex1, [<<160>>]), %%------------------------------------------------- %% attribute undelivered-object(2) External IPMSInformationObjects:InformationObject OPTIONAL %%------------------------------------------------- {EncBytes2,EncLen2} = case Cindex2 of asn1_NOVALUE -> {<<>>,0}; _ -> 'IPMSInformationObjects':'enc_InformationObject'(Cindex2, [<<161>>]) end, BytesSoFar = [EncBytes1, EncBytes2], LenSoFar = EncLen1 + EncLen2, encode_tags(TagIn, BytesSoFar, LenSoFar). 'dec_receive-report'('ArgumentType', Bytes,_) -> Tlv = tlv_format(Bytes), 'dec_receive-report_ArgumentType'(Tlv,[17]); 'dec_receive-report'('ResultType', Bytes,_) -> Bytes. 'dec_receive-report_ArgumentType'(Tlv, TagIn) -> Tlv1 = match_tags(Tlv, TagIn), SetFun = fun(FunTlv) -> case FunTlv of %envelope TTlv = {131072,_} -> {1, TTlv}; %undelivered-object TTlv = {131073,_} -> {2, TTlv}; Else -> {3, Else} end end, PositionList = [SetFun(TempTlv)|| TempTlv <- Tlv1], Tlv2 = [Stlv || {_,Stlv} <- lists:sort(PositionList)], %%------------------------------------------------- %% attribute envelope(1) External MTSAbstractService:ReportDeliveryEnvelope %%------------------------------------------------- [V1|Tlv3] = Tlv2, Term1 = 'MTSAbstractService':'dec_ReportDeliveryEnvelope'(V1, [131072]), %%------------------------------------------------- %% attribute undelivered-object(2) External IPMSInformationObjects:InformationObject OPTIONAL %%------------------------------------------------- {Term2,Tlv4} = case Tlv3 of [{131073,V2}|TempTlv4] -> {'IPMSInformationObjects':'dec_InformationObject'(V2, []), TempTlv4}; _ -> { asn1_NOVALUE, Tlv3} end, case Tlv4 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowed end, Res1 = {'receive-report_ArgumentType',Term1,Term2}, Res1. %%================================ %% receive-ipm %%================================ 'enc_receive-ipm'('ArgumentType', Val, _RestPrimFieldName) -> 'enc_receive-ipm_ArgumentType'(Val,[<<49>>]); 'enc_receive-ipm'('ResultType', Val, _RestPrimFieldName) -> {Val,0}. %%================================ %% receive-ipm_ArgumentType %%================================ 'enc_receive-ipm_ArgumentType'(Val, TagIn) -> {_,Cindex1,Cindex2} = Val, %%------------------------------------------------- %% attribute envelope(1) External MTSAbstractService:MessageDeliveryEnvelope %%------------------------------------------------- {EncBytes1,EncLen1} = 'MTSAbstractService':'enc_MessageDeliveryEnvelope'(Cindex1, [<<160>>]), %%------------------------------------------------- %% attribute content(2) External IPMSInformationObjects:IPM %%------------------------------------------------- {EncBytes2,EncLen2} = 'IPMSInformationObjects':'enc_IPM'(Cindex2, [<<161>>]), BytesSoFar = [EncBytes1, EncBytes2], LenSoFar = EncLen1 + EncLen2, encode_tags(TagIn, BytesSoFar, LenSoFar). 'dec_receive-ipm'('ArgumentType', Bytes,_) -> Tlv = tlv_format(Bytes), 'dec_receive-ipm_ArgumentType'(Tlv,[17]); 'dec_receive-ipm'('ResultType', Bytes,_) -> Bytes. 'dec_receive-ipm_ArgumentType'(Tlv, TagIn) -> Tlv1 = match_tags(Tlv, TagIn), SetFun = fun(FunTlv) -> case FunTlv of %envelope TTlv = {131072,_} -> {1, TTlv}; %content TTlv = {131073,_} -> {2, TTlv}; Else -> {3, Else} end end, PositionList = [SetFun(TempTlv)|| TempTlv <- Tlv1], Tlv2 = [Stlv || {_,Stlv} <- lists:sort(PositionList)], %%------------------------------------------------- %% attribute envelope(1) External MTSAbstractService:MessageDeliveryEnvelope %%------------------------------------------------- [V1|Tlv3] = Tlv2, Term1 = 'MTSAbstractService':'dec_MessageDeliveryEnvelope'(V1, [131072]), %%------------------------------------------------- %% attribute content(2) External IPMSInformationObjects:IPM %%------------------------------------------------- [V2|Tlv4] = Tlv3, Term2 = 'IPMSInformationObjects':'dec_IPM'(V2, [131073]), case Tlv4 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowed end, Res1 = {'receive-ipm_ArgumentType',Term1,Term2}, Res1. %%================================ %% receive-rn %%================================ 'enc_receive-rn'('ArgumentType', Val, _RestPrimFieldName) -> 'enc_receive-rn_ArgumentType'(Val,[<<49>>]); 'enc_receive-rn'('ResultType', Val, _RestPrimFieldName) -> {Val,0}. %%================================ %% receive-rn_ArgumentType %%================================ 'enc_receive-rn_ArgumentType'(Val, TagIn) -> {_,Cindex1,Cindex2} = Val, %%------------------------------------------------- %% attribute envelope(1) External MTSAbstractService:MessageDeliveryEnvelope %%------------------------------------------------- {EncBytes1,EncLen1} = 'MTSAbstractService':'enc_MessageDeliveryEnvelope'(Cindex1, [<<160>>]), %%------------------------------------------------- %% attribute content(2) External IPMSInformationObjects:RN %%------------------------------------------------- {EncBytes2,EncLen2} = 'IPMSInformationObjects':'enc_RN'(Cindex2, [<<161>>]), BytesSoFar = [EncBytes1, EncBytes2], LenSoFar = EncLen1 + EncLen2, encode_tags(TagIn, BytesSoFar, LenSoFar). 'dec_receive-rn'('ArgumentType', Bytes,_) -> Tlv = tlv_format(Bytes), 'dec_receive-rn_ArgumentType'(Tlv,[17]); 'dec_receive-rn'('ResultType', Bytes,_) -> Bytes. 'dec_receive-rn_ArgumentType'(Tlv, TagIn) -> Tlv1 = match_tags(Tlv, TagIn), SetFun = fun(FunTlv) -> case FunTlv of %envelope TTlv = {131072,_} -> {1, TTlv}; %content TTlv = {131073,_} -> {2, TTlv}; Else -> {3, Else} end end, PositionList = [SetFun(TempTlv)|| TempTlv <- Tlv1], Tlv2 = [Stlv || {_,Stlv} <- lists:sort(PositionList)], %%------------------------------------------------- %% attribute envelope(1) External MTSAbstractService:MessageDeliveryEnvelope %%------------------------------------------------- [V1|Tlv3] = Tlv2, Term1 = 'MTSAbstractService':'dec_MessageDeliveryEnvelope'(V1, [131072]), %%------------------------------------------------- %% attribute content(2) External IPMSInformationObjects:RN %%------------------------------------------------- [V2|Tlv4] = Tlv3, Term2 = 'IPMSInformationObjects':'dec_RN'(V2, [131073]), case Tlv4 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowed end, Res1 = {'receive-rn_ArgumentType',Term1,Term2}, Res1. %%================================ %% receive-nrn %%================================ 'enc_receive-nrn'('ArgumentType', Val, _RestPrimFieldName) -> 'enc_receive-nrn_ArgumentType'(Val,[<<49>>]); 'enc_receive-nrn'('ResultType', Val, _RestPrimFieldName) -> {Val,0}. %%================================ %% receive-nrn_ArgumentType %%================================ 'enc_receive-nrn_ArgumentType'(Val, TagIn) -> {_,Cindex1,Cindex2} = Val, %%------------------------------------------------- %% attribute envelope(1) External MTSAbstractService:MessageDeliveryEnvelope %%------------------------------------------------- {EncBytes1,EncLen1} = 'MTSAbstractService':'enc_MessageDeliveryEnvelope'(Cindex1, [<<160>>]), %%------------------------------------------------- %% attribute content(2) External IPMSInformationObjects:NRN %%------------------------------------------------- {EncBytes2,EncLen2} = 'IPMSInformationObjects':'enc_NRN'(Cindex2, [<<161>>]), BytesSoFar = [EncBytes1, EncBytes2], LenSoFar = EncLen1 + EncLen2, encode_tags(TagIn, BytesSoFar, LenSoFar). 'dec_receive-nrn'('ArgumentType', Bytes,_) -> Tlv = tlv_format(Bytes), 'dec_receive-nrn_ArgumentType'(Tlv,[17]); 'dec_receive-nrn'('ResultType', Bytes,_) -> Bytes. 'dec_receive-nrn_ArgumentType'(Tlv, TagIn) -> Tlv1 = match_tags(Tlv, TagIn), SetFun = fun(FunTlv) -> case FunTlv of %envelope TTlv = {131072,_} -> {1, TTlv}; %content TTlv = {131073,_} -> {2, TTlv}; Else -> {3, Else} end end, PositionList = [SetFun(TempTlv)|| TempTlv <- Tlv1], Tlv2 = [Stlv || {_,Stlv} <- lists:sort(PositionList)], %%------------------------------------------------- %% attribute envelope(1) External MTSAbstractService:MessageDeliveryEnvelope %%------------------------------------------------- [V1|Tlv3] = Tlv2, Term1 = 'MTSAbstractService':'dec_MessageDeliveryEnvelope'(V1, [131072]), %%------------------------------------------------- %% attribute content(2) External IPMSInformationObjects:NRN %%------------------------------------------------- [V2|Tlv4] = Tlv3, Term2 = 'IPMSInformationObjects':'dec_NRN'(V2, [131073]), case Tlv4 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowed end, Res1 = {'receive-nrn_ArgumentType',Term1,Term2}, Res1. %%================================ %% receive-on %%================================ 'enc_receive-on'('ArgumentType', Val, _RestPrimFieldName) -> 'enc_receive-on_ArgumentType'(Val,[<<49>>]); 'enc_receive-on'('ResultType', Val, _RestPrimFieldName) -> {Val,0}. %%================================ %% receive-on_ArgumentType %%================================ 'enc_receive-on_ArgumentType'(Val, TagIn) -> {_,Cindex1,Cindex2} = Val, %%------------------------------------------------- %% attribute envelope(1) External MTSAbstractService:MessageDeliveryEnvelope %%------------------------------------------------- {EncBytes1,EncLen1} = 'MTSAbstractService':'enc_MessageDeliveryEnvelope'(Cindex1, [<<160>>]), %%------------------------------------------------- %% attribute content(2) External IPMSInformationObjects:ON %%------------------------------------------------- {EncBytes2,EncLen2} = 'IPMSInformationObjects':'enc_ON'(Cindex2, [<<161>>]), BytesSoFar = [EncBytes1, EncBytes2], LenSoFar = EncLen1 + EncLen2, encode_tags(TagIn, BytesSoFar, LenSoFar). 'dec_receive-on'('ArgumentType', Bytes,_) -> Tlv = tlv_format(Bytes), 'dec_receive-on_ArgumentType'(Tlv,[17]); 'dec_receive-on'('ResultType', Bytes,_) -> Bytes. 'dec_receive-on_ArgumentType'(Tlv, TagIn) -> Tlv1 = match_tags(Tlv, TagIn), SetFun = fun(FunTlv) -> case FunTlv of %envelope TTlv = {131072,_} -> {1, TTlv}; %content TTlv = {131073,_} -> {2, TTlv}; Else -> {3, Else} end end, PositionList = [SetFun(TempTlv)|| TempTlv <- Tlv1], Tlv2 = [Stlv || {_,Stlv} <- lists:sort(PositionList)], %%------------------------------------------------- %% attribute envelope(1) External MTSAbstractService:MessageDeliveryEnvelope %%------------------------------------------------- [V1|Tlv3] = Tlv2, Term1 = 'MTSAbstractService':'dec_MessageDeliveryEnvelope'(V1, [131072]), %%------------------------------------------------- %% attribute content(2) External IPMSInformationObjects:ON %%------------------------------------------------- [V2|Tlv4] = Tlv3, Term2 = 'IPMSInformationObjects':'dec_ON'(V2, [131073]), case Tlv4 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowed end, Res1 = {'receive-on_ArgumentType',Term1,Term2}, Res1. %%================================ %% change-auto-discard %%================================ 'enc_change-auto-discard'('ArgumentType', Val, _RestPrimFieldName) -> 'enc_change-auto-discard_ArgumentType'(Val,[<<49>>]); 'enc_change-auto-discard'('ResultType', Val, _RestPrimFieldName) -> {Val,0}. %%================================ %% change-auto-discard_ArgumentType %%================================ 'enc_change-auto-discard_ArgumentType'(Val, TagIn) -> {_,Cindex1,Cindex2} = Val, %%------------------------------------------------- %% attribute auto-discard-expired-IPMs(1) with type BOOLEAN %%------------------------------------------------- {EncBytes1,EncLen1} = encode_boolean(Cindex1, [<<128>>]), %%------------------------------------------------- %% attribute auto-discard-obsolete-IPMs(2) with type BOOLEAN %%------------------------------------------------- {EncBytes2,EncLen2} = encode_boolean(Cindex2, [<<129>>]), BytesSoFar = [EncBytes1, EncBytes2], LenSoFar = EncLen1 + EncLen2, encode_tags(TagIn, BytesSoFar, LenSoFar). 'dec_change-auto-discard'('ArgumentType', Bytes,_) -> Tlv = tlv_format(Bytes), 'dec_change-auto-discard_ArgumentType'(Tlv,[17]); 'dec_change-auto-discard'('ResultType', Bytes,_) -> Bytes. 'dec_change-auto-discard_ArgumentType'(Tlv, TagIn) -> Tlv1 = match_tags(Tlv, TagIn), SetFun = fun(FunTlv) -> case FunTlv of %auto-discard-expired-IPMs TTlv = {131072,_} -> {1, TTlv}; %auto-discard-obsolete-IPMs TTlv = {131073,_} -> {2, TTlv}; Else -> {3, Else} end end, PositionList = [SetFun(TempTlv)|| TempTlv <- Tlv1], Tlv2 = [Stlv || {_,Stlv} <- lists:sort(PositionList)], %%------------------------------------------------- %% attribute auto-discard-expired-IPMs(1) with type BOOLEAN %%------------------------------------------------- [V1|Tlv3] = Tlv2, Term1 = decode_boolean(V1, [131072]), %%------------------------------------------------- %% attribute auto-discard-obsolete-IPMs(2) with type BOOLEAN %%------------------------------------------------- [V2|Tlv4] = Tlv3, Term2 = decode_boolean(V2, [131073]), case Tlv4 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowed end, Res1 = {'change-auto-discard_ArgumentType',Term1,Term2}, Res1. %%================================ %% change-auto-acknowledgment %%================================ 'enc_change-auto-acknowledgment'('ArgumentType', Val, _RestPrimFieldName) -> 'enc_change-auto-acknowledgment_ArgumentType'(Val,[<<49>>]); 'enc_change-auto-acknowledgment'('ResultType', Val, _RestPrimFieldName) -> {Val,0}. %%================================ %% change-auto-acknowledgment_ArgumentType %%================================ 'enc_change-auto-acknowledgment_ArgumentType'(Val, TagIn) -> {_,Cindex1,Cindex2} = Val, %%------------------------------------------------- %% attribute auto-acknowledge-IPMs(1) with type BOOLEAN %%------------------------------------------------- {EncBytes1,EncLen1} = encode_boolean(Cindex1, [<<128>>]), %%------------------------------------------------- %% attribute auto-acknowledge-suppl-receipt-info(2) with type PrintableString OPTIONAL %%------------------------------------------------- {EncBytes2,EncLen2} = case Cindex2 of asn1_NOVALUE -> {<<>>,0}; _ -> encode_restricted_string(Cindex2, [<<129>>]) end, BytesSoFar = [EncBytes1, EncBytes2], LenSoFar = EncLen1 + EncLen2, encode_tags(TagIn, BytesSoFar, LenSoFar). 'dec_change-auto-acknowledgment'('ArgumentType', Bytes,_) -> Tlv = tlv_format(Bytes), 'dec_change-auto-acknowledgment_ArgumentType'(Tlv,[17]); 'dec_change-auto-acknowledgment'('ResultType', Bytes,_) -> Bytes. 'dec_change-auto-acknowledgment_ArgumentType'(Tlv, TagIn) -> Tlv1 = match_tags(Tlv, TagIn), SetFun = fun(FunTlv) -> case FunTlv of %auto-acknowledge-IPMs TTlv = {131072,_} -> {1, TTlv}; %auto-acknowledge-suppl-receipt-info TTlv = {131073,_} -> {2, TTlv}; Else -> {3, Else} end end, PositionList = [SetFun(TempTlv)|| TempTlv <- Tlv1], Tlv2 = [Stlv || {_,Stlv} <- lists:sort(PositionList)], %%------------------------------------------------- %% attribute auto-acknowledge-IPMs(1) with type BOOLEAN %%------------------------------------------------- [V1|Tlv3] = Tlv2, Term1 = decode_boolean(V1, [131072]), %%------------------------------------------------- %% attribute auto-acknowledge-suppl-receipt-info(2) with type PrintableString OPTIONAL %%------------------------------------------------- {Term2,Tlv4} = case Tlv3 of [{131073,V2}|TempTlv4] -> {begin Val1 = decode_restricted_string(V2, []), C1 = byte_size(Val1), if 1 =< C1, C1 =< 256 -> binary_to_list(Val1); true -> exit({error,{asn1,bad_range}}) end end, TempTlv4}; _ -> { asn1_NOVALUE, Tlv3} end, case Tlv4 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowed end, Res1 = {'change-auto-acknowledgment_ArgumentType',Term1,Term2}, Res1. %%================================ %% change-auto-forwarding %%================================ 'enc_change-auto-forwarding'('ArgumentType', Val, _RestPrimFieldName) -> 'enc_change-auto-forwarding_ArgumentType'(Val,[<<49>>]); 'enc_change-auto-forwarding'('ResultType', Val, _RestPrimFieldName) -> {Val,0}. %%================================ %% change-auto-forwarding_ArgumentType %%================================ 'enc_change-auto-forwarding_ArgumentType'(Val, TagIn) -> {_,Cindex1,Cindex2,Cindex3,Cindex4} = Val, %%------------------------------------------------- %% attribute auto-forward-IPMs(1) with type BOOLEAN %%------------------------------------------------- {EncBytes1,EncLen1} = encode_boolean(Cindex1, [<<128>>]), %%------------------------------------------------- %% attribute auto-forward-recipients(2) with type SEQUENCE OF OPTIONAL %%------------------------------------------------- {EncBytes2,EncLen2} = case Cindex2 of asn1_NOVALUE -> {<<>>,0}; _ -> 'enc_change-auto-forwarding_ArgumentType_auto-forward-recipients'(Cindex2, [<<161>>]) end, %%------------------------------------------------- %% attribute auto-forward-heading(3) External IPMSInformationObjects:Heading OPTIONAL %%------------------------------------------------- {EncBytes3,EncLen3} = case Cindex3 of asn1_NOVALUE -> {<<>>,0}; _ -> 'IPMSInformationObjects':'enc_Heading'(Cindex3, [<<162>>]) end, %%------------------------------------------------- %% attribute auto-forward-comment(4) with type PrintableString OPTIONAL %%------------------------------------------------- {EncBytes4,EncLen4} = case Cindex4 of asn1_NOVALUE -> {<<>>,0}; _ -> encode_restricted_string(Cindex4, [<<131>>]) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4], LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4, encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% change-auto-forwarding_ArgumentType_auto-forward-recipients %%================================ 'enc_change-auto-forwarding_ArgumentType_auto-forward-recipients'(Val, TagIn) -> {EncBytes,EncLen} = 'enc_change-auto-forwarding_ArgumentType_auto-forward-recipients_components'(Val,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_change-auto-forwarding_ArgumentType_auto-forward-recipients_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_change-auto-forwarding_ArgumentType_auto-forward-recipients_components'([H|T],AccBytes, AccLen) -> {EncBytes,EncLen} = 'MTSAbstractService':'enc_ORName'(H, [<<96>>]), 'enc_change-auto-forwarding_ArgumentType_auto-forward-recipients_components'(T,[EncBytes|AccBytes], AccLen + EncLen). 'dec_change-auto-forwarding'('ArgumentType', Bytes,_) -> Tlv = tlv_format(Bytes), 'dec_change-auto-forwarding_ArgumentType'(Tlv,[17]); 'dec_change-auto-forwarding'('ResultType', Bytes,_) -> Bytes. 'dec_change-auto-forwarding_ArgumentType'(Tlv, TagIn) -> Tlv1 = match_tags(Tlv, TagIn), SetFun = fun(FunTlv) -> case FunTlv of %auto-forward-IPMs TTlv = {131072,_} -> {1, TTlv}; %auto-forward-recipients TTlv = {131073,_} -> {2, TTlv}; %auto-forward-heading TTlv = {131074,_} -> {3, TTlv}; %auto-forward-comment TTlv = {131075,_} -> {4, TTlv}; Else -> {5, Else} end end, PositionList = [SetFun(TempTlv)|| TempTlv <- Tlv1], Tlv2 = [Stlv || {_,Stlv} <- lists:sort(PositionList)], %%------------------------------------------------- %% attribute auto-forward-IPMs(1) with type BOOLEAN %%------------------------------------------------- [V1|Tlv3] = Tlv2, Term1 = decode_boolean(V1, [131072]), %%------------------------------------------------- %% attribute auto-forward-recipients(2) with type SEQUENCE OF OPTIONAL %%------------------------------------------------- {Term2,Tlv4} = case Tlv3 of [{131073,V2}|TempTlv4] -> {'dec_change-auto-forwarding_ArgumentType_auto-forward-recipients'(V2, []), TempTlv4}; _ -> { asn1_NOVALUE, Tlv3} end, %%------------------------------------------------- %% attribute auto-forward-heading(3) External IPMSInformationObjects:Heading OPTIONAL %%------------------------------------------------- {Term3,Tlv5} = case Tlv4 of [{131074,V3}|TempTlv5] -> {'IPMSInformationObjects':'dec_Heading'(V3, []), TempTlv5}; _ -> { asn1_NOVALUE, Tlv4} end, %%------------------------------------------------- %% attribute auto-forward-comment(4) with type PrintableString OPTIONAL %%------------------------------------------------- {Term4,Tlv6} = case Tlv5 of [{131075,V4}|TempTlv6] -> {begin Val1 = decode_restricted_string(V4, []), C1 = byte_size(Val1), if 0 =< C1, C1 =< 256 -> binary_to_list(Val1); true -> exit({error,{asn1,bad_range}}) end end, TempTlv6}; _ -> { asn1_NOVALUE, Tlv5} end, case Tlv6 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv6}}}) % extra fields not allowed end, Res1 = {'change-auto-forwarding_ArgumentType',Term1,Term2,Term3,Term4}, Res1. 'dec_change-auto-forwarding_ArgumentType_auto-forward-recipients'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), ['MTSAbstractService':'dec_ORName'(V1, [65536]) || V1 <- Tlv1]. %%================================ %% subscription-error %%================================ 'enc_subscription-error'('ParameterType', Val, _RestPrimFieldName) -> 'enc_subscription-error_ParameterType'(Val,[<<49>>]). %%================================ %% subscription-error_ParameterType %%================================ 'enc_subscription-error_ParameterType'(Val, TagIn) -> {_,Cindex1} = Val, %%------------------------------------------------- %% attribute problem(1) with type ENUMERATED %%------------------------------------------------- {EncBytes1,EncLen1} = case Cindex1 of 'ipms-eos-not-subscribed' -> encode_tags([<<128>>], [0], 1); 'mts-eos-not-subscribed' -> encode_tags([<<128>>], [1], 1); Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}}) end, BytesSoFar = [EncBytes1], LenSoFar = EncLen1, encode_tags(TagIn, BytesSoFar, LenSoFar). 'dec_subscription-error'('ParameterType', Bytes,_) -> Tlv = tlv_format(Bytes), 'dec_subscription-error_ParameterType'(Tlv,[17]). 'dec_subscription-error_ParameterType'(Tlv, TagIn) -> Tlv1 = match_tags(Tlv, TagIn), SetFun = fun(FunTlv) -> case FunTlv of %problem TTlv = {131072,_} -> {1, TTlv}; Else -> {2, Else} end end, PositionList = [SetFun(TempTlv)|| TempTlv <- Tlv1], Tlv2 = [Stlv || {_,Stlv} <- lists:sort(PositionList)], %%------------------------------------------------- %% attribute problem(1) with type ENUMERATED %%------------------------------------------------- [V1|Tlv3] = Tlv2, Term1 = case decode_integer(V1, [131072]) of 0 -> 'ipms-eos-not-subscribed'; 1 -> 'mts-eos-not-subscribed'; Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) end, case Tlv3 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed end, Res1 = {'subscription-error_ParameterType',Term1}, Res1. %%% %%% 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_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_restricted_string(Tlv, TagsIn) -> match_and_collect(Tlv, TagsIn). 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_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_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([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}. 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, []).