%% Generated by the Erlang ASN.1 BER compiler. Version: 5.1 %% Purpose: Encoding and decoding of the types in IPMSAutoActionTypes. -module('IPMSAutoActionTypes'). -compile(nowarn_unused_vars). -dialyzer(no_improper_lists). -dialyzer(no_match). -include("IPMSAutoActionTypes.hrl"). -asn1_info([{vsn,'5.1'}, {module,'IPMSAutoActionTypes'}, {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_IPMAutoForwardRegistrationParameter/2, enc_IPMAutoForwardOptions/2, enc_AutoForwardRegistrationParameter88/2, enc_AutoForwardArguments/2, enc_PerMessageAutoForwardFields/2, enc_PerRecipientAutoForwardFields/2, enc_EncodedForwardingInformation/2, enc_ForwardingInformation1988/2, enc_IPMAutoAcknowledgementRegistrationParameter/2, enc_IPMAutoDiscardRegistrationParameter/2, enc_IPMAutoAdviseRegistrationParameter/2, enc_AutoDiscardProblem/2, enc_EXTERNAL/2 ]). -export([ dec_IPMAutoForwardRegistrationParameter/2, dec_IPMAutoForwardOptions/2, dec_AutoForwardRegistrationParameter88/2, dec_AutoForwardArguments/2, dec_PerMessageAutoForwardFields/2, dec_PerRecipientAutoForwardFields/2, dec_EncodedForwardingInformation/2, dec_ForwardingInformation1988/2, dec_IPMAutoAcknowledgementRegistrationParameter/2, dec_IPMAutoDiscardRegistrationParameter/2, dec_IPMAutoAdviseRegistrationParameter/2, dec_AutoDiscardProblem/2, dec_EXTERNAL/2 ]). -export([ 'enc_ipm-auto-forward'/3, 'enc_ipm-auto-acknowledgement'/3, 'enc_ipm-auto-correlate'/3, 'enc_ipm-auto-discard'/3, 'enc_ipm-auto-advise'/3, 'enc_auto-forwarding-loop'/3, 'enc_duplicate-ipn'/3, 'enc_ipm-auto-discard-error'/3 ]). -export([ 'dec_ipm-auto-forward'/3, 'dec_ipm-auto-acknowledgement'/3, 'dec_ipm-auto-correlate'/3, 'dec_ipm-auto-discard'/3, 'dec_ipm-auto-advise'/3, 'dec_auto-forwarding-loop'/3, 'dec_duplicate-ipn'/3, 'dec_ipm-auto-discard-error'/3 ]). -export([ getenc_IPMAutoActions/1, getenc_IPMAutoActionErrorTable/1, getenc_internal_object_set_argument_18/1, getenc_internal_object_set_argument_17/1, getenc_internal_object_set_argument_16/1, getenc_internal_object_set_argument_15/1 ]). -export([ getdec_IPMAutoActions/1, getdec_IPMAutoActionErrorTable/1, getdec_internal_object_set_argument_18/1, getdec_internal_object_set_argument_17/1, getdec_internal_object_set_argument_16/1, getdec_internal_object_set_argument_15/1 ]). -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('IPMAutoForwardRegistrationParameter', Data) -> enc_IPMAutoForwardRegistrationParameter(Data); encode_disp('IPMAutoForwardOptions', Data) -> enc_IPMAutoForwardOptions(Data); encode_disp('AutoForwardRegistrationParameter88', Data) -> enc_AutoForwardRegistrationParameter88(Data); encode_disp('AutoForwardArguments', Data) -> enc_AutoForwardArguments(Data); encode_disp('PerMessageAutoForwardFields', Data) -> enc_PerMessageAutoForwardFields(Data); encode_disp('PerRecipientAutoForwardFields', Data) -> enc_PerRecipientAutoForwardFields(Data); encode_disp('EncodedForwardingInformation', Data) -> enc_EncodedForwardingInformation(Data); encode_disp('ForwardingInformation1988', Data) -> enc_ForwardingInformation1988(Data); encode_disp('IPMAutoAcknowledgementRegistrationParameter', Data) -> enc_IPMAutoAcknowledgementRegistrationParameter(Data); encode_disp('IPMAutoDiscardRegistrationParameter', Data) -> enc_IPMAutoDiscardRegistrationParameter(Data); encode_disp('IPMAutoAdviseRegistrationParameter', Data) -> enc_IPMAutoAdviseRegistrationParameter(Data); encode_disp('AutoDiscardProblem', Data) -> enc_AutoDiscardProblem(Data); encode_disp('EXTERNAL', Data) -> enc_EXTERNAL(Data); encode_disp(Type, _Data) -> exit({error,{asn1,{undefined_type,Type}}}). decode_disp('IPMAutoForwardRegistrationParameter', Data) -> dec_IPMAutoForwardRegistrationParameter(Data); decode_disp('IPMAutoForwardOptions', Data) -> dec_IPMAutoForwardOptions(Data); decode_disp('AutoForwardRegistrationParameter88', Data) -> dec_AutoForwardRegistrationParameter88(Data); decode_disp('AutoForwardArguments', Data) -> dec_AutoForwardArguments(Data); decode_disp('PerMessageAutoForwardFields', Data) -> dec_PerMessageAutoForwardFields(Data); decode_disp('PerRecipientAutoForwardFields', Data) -> dec_PerRecipientAutoForwardFields(Data); decode_disp('EncodedForwardingInformation', Data) -> dec_EncodedForwardingInformation(Data); decode_disp('ForwardingInformation1988', Data) -> dec_ForwardingInformation1988(Data); decode_disp('IPMAutoAcknowledgementRegistrationParameter', Data) -> dec_IPMAutoAcknowledgementRegistrationParameter(Data); decode_disp('IPMAutoDiscardRegistrationParameter', Data) -> dec_IPMAutoDiscardRegistrationParameter(Data); decode_disp('IPMAutoAdviseRegistrationParameter', Data) -> dec_IPMAutoAdviseRegistrationParameter(Data); decode_disp('AutoDiscardProblem', Data) -> dec_AutoDiscardProblem(Data); decode_disp('EXTERNAL', Data) -> dec_EXTERNAL(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. %%================================ %% IPMAutoForwardRegistrationParameter %%================================ enc_IPMAutoForwardRegistrationParameter(Val) -> enc_IPMAutoForwardRegistrationParameter(Val, [<<48>>]). enc_IPMAutoForwardRegistrationParameter(Val, TagIn) -> {_,Cindex1,Cindex2,Cindex3,Cindex4,Cindex5,Cindex6,Cindex7} = Val, %%------------------------------------------------- %% attribute filter(1) External MSAbstractService:Filter OPTIONAL %%------------------------------------------------- {EncBytes1,EncLen1} = case Cindex1 of asn1_NOVALUE -> {<<>>,0}; _ -> 'MSAbstractService':'enc_Filter'(Cindex1, [<<160>>]) end, %%------------------------------------------------- %% attribute forwarding-envelope(2) External MTSAbstractService:MessageSubmissionEnvelope %%------------------------------------------------- {EncBytes2,EncLen2} = 'MTSAbstractService':'enc_MessageSubmissionEnvelope'(Cindex2, [<<49>>,<<161>>]), %%------------------------------------------------- %% attribute forwarding-heading(3) External IPMSInformationObjects:Heading %%------------------------------------------------- {EncBytes3,EncLen3} = 'IPMSInformationObjects':'enc_Heading'(Cindex3, [<<49>>,<<162>>]), %%------------------------------------------------- %% attribute forwarding-cover-note(4) External IPMSInformationObjects:BodyPart OPTIONAL %%------------------------------------------------- {EncBytes4,EncLen4} = case Cindex4 of asn1_NOVALUE -> {<<>>,0}; _ -> 'IPMSInformationObjects':'enc_BodyPart'(Cindex4, [<<163>>]) end, %%------------------------------------------------- %% attribute submission-options(5) External MSAbstractService:MSSubmissionOptions OPTIONAL %%------------------------------------------------- {EncBytes5,EncLen5} = case Cindex5 of asn1_NOVALUE -> {<<>>,0}; _ -> 'MSAbstractService':'enc_MSSubmissionOptions'(Cindex5, [<<49>>,<<164>>]) end, %%------------------------------------------------- %% attribute nrn-comment(6) with type PrintableString OPTIONAL %%------------------------------------------------- {EncBytes6,EncLen6} = case Cindex6 of asn1_NOVALUE -> {<<>>,0}; _ -> encode_restricted_string(Cindex6, [<<19>>,<<165>>]) end, %%------------------------------------------------- %% attribute ipm-auto-forward-options(7) with type BIT STRING DEFAULT = [] %%------------------------------------------------- {EncBytes7,EncLen7} = case Cindex7 of asn1_DEFAULT -> {<<>>,0}; _ when Cindex7 =:= [] -> {<<>>,0}; _ -> encode_named_bit_string(Cindex7, [{'forward-all-object-types',0},{'include-returned-content',1},{'include-returned-ipm',2},{'forwarded-content-prohibited',3},{'preserve-retrieval-status',4},{'delete-delivered-object',5}], [<<3>>,<<166>>]) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4, EncBytes5, EncBytes6, EncBytes7], LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5 + EncLen6 + EncLen7, encode_tags(TagIn, BytesSoFar, LenSoFar). dec_IPMAutoForwardRegistrationParameter(Tlv) -> dec_IPMAutoForwardRegistrationParameter(Tlv, [16]). dec_IPMAutoForwardRegistrationParameter(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- %% attribute filter(1) External MSAbstractService:Filter OPTIONAL %%------------------------------------------------- {Term1,Tlv2} = case Tlv1 of [{131072,V1}|TempTlv2] -> {'MSAbstractService':'dec_Filter'(V1, []), TempTlv2}; _ -> { asn1_NOVALUE, Tlv1} end, %%------------------------------------------------- %% attribute forwarding-envelope(2) External MTSAbstractService:MessageSubmissionEnvelope %%------------------------------------------------- [V2|Tlv3] = Tlv2, Term2 = 'MTSAbstractService':'dec_MessageSubmissionEnvelope'(V2, [131073,17]), %%------------------------------------------------- %% attribute forwarding-heading(3) External IPMSInformationObjects:Heading %%------------------------------------------------- [V3|Tlv4] = Tlv3, Term3 = 'IPMSInformationObjects':'dec_Heading'(V3, [131074,17]), %%------------------------------------------------- %% attribute forwarding-cover-note(4) External IPMSInformationObjects:BodyPart OPTIONAL %%------------------------------------------------- {Term4,Tlv5} = case Tlv4 of [{131075,V4}|TempTlv5] -> {'IPMSInformationObjects':'dec_BodyPart'(V4, []), TempTlv5}; _ -> { asn1_NOVALUE, Tlv4} end, %%------------------------------------------------- %% attribute submission-options(5) External MSAbstractService:MSSubmissionOptions OPTIONAL %%------------------------------------------------- {Term5,Tlv6} = case Tlv5 of [{131076,V5}|TempTlv6] -> {'MSAbstractService':'dec_MSSubmissionOptions'(V5, [17]), TempTlv6}; _ -> { asn1_NOVALUE, Tlv5} end, %%------------------------------------------------- %% attribute nrn-comment(6) with type PrintableString OPTIONAL %%------------------------------------------------- {Term6,Tlv7} = case Tlv6 of [{131077,V6}|TempTlv7] -> {begin Val1 = decode_restricted_string(V6, [19]), C1 = byte_size(Val1), if 0 =< C1, C1 =< 256 -> binary_to_list(Val1); true -> exit({error,{asn1,bad_range}}) end end, TempTlv7}; _ -> { asn1_NOVALUE, Tlv6} end, %%------------------------------------------------- %% attribute ipm-auto-forward-options(7) with type BIT STRING DEFAULT = [] %%------------------------------------------------- {Term7,Tlv8} = case Tlv7 of [{131078,V7}|TempTlv8] -> {decode_named_bit_string(V7, [{'forward-all-object-types',0},{'include-returned-content',1},{'include-returned-ipm',2},{'forwarded-content-prohibited',3},{'preserve-retrieval-status',4},{'delete-delivered-object',5}], [3]), TempTlv8}; _ -> {[],Tlv7} end, case Tlv8 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv8}}}) % extra fields not allowed end, Res1 = {'IPMAutoForwardRegistrationParameter',Term1,Term2,Term3,Term4,Term5,Term6,Term7}, Res1. %%================================ %% IPMAutoForwardOptions %%================================ enc_IPMAutoForwardOptions(Val) -> enc_IPMAutoForwardOptions(Val, [<<3>>]). enc_IPMAutoForwardOptions(Val, TagIn) -> encode_named_bit_string(Val, [{'forward-all-object-types',0},{'include-returned-content',1},{'include-returned-ipm',2},{'forwarded-content-prohibited',3},{'preserve-retrieval-status',4},{'delete-delivered-object',5}], TagIn). dec_IPMAutoForwardOptions(Tlv) -> dec_IPMAutoForwardOptions(Tlv, [3]). dec_IPMAutoForwardOptions(Tlv, TagIn) -> decode_named_bit_string(Tlv, [{'forward-all-object-types',0},{'include-returned-content',1},{'include-returned-ipm',2},{'forwarded-content-prohibited',3},{'preserve-retrieval-status',4},{'delete-delivered-object',5}], TagIn). %%================================ %% AutoForwardRegistrationParameter88 %%================================ enc_AutoForwardRegistrationParameter88(Val) -> enc_AutoForwardRegistrationParameter88(Val, [<<49>>]). enc_AutoForwardRegistrationParameter88(Val, TagIn) -> {_,Cindex1,Cindex2,Cindex3,Cindex4} = Val, %%------------------------------------------------- %% attribute filter(1) External MSAbstractService:Filter OPTIONAL %%------------------------------------------------- {EncBytes1,EncLen1} = case Cindex1 of asn1_NOVALUE -> {<<>>,0}; _ -> 'MSAbstractService':'enc_Filter'(Cindex1, [<<160>>]) end, %%------------------------------------------------- %% attribute auto-forward-arguments(2) External IPMSAutoActionTypes:AutoForwardArguments %%------------------------------------------------- {EncBytes2,EncLen2} = 'enc_AutoForwardArguments'(Cindex2, [<<49>>,<<161>>]), %%------------------------------------------------- %% attribute delete-after-auto-forwarding(3) with type BOOLEAN DEFAULT = false %%------------------------------------------------- {EncBytes3,EncLen3} = case Cindex3 of asn1_DEFAULT -> {<<>>,0}; _ when Cindex3 =:= false -> {<<>>,0}; _ -> encode_boolean(Cindex3, [<<1>>,<<162>>]) end, %%------------------------------------------------- %% attribute forwarding-information(4) with type OCTET STRING %%------------------------------------------------- {EncBytes4,EncLen4} = encode_restricted_string(Cindex4, [<<4>>,<<163>>]), BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4], LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4, encode_tags(TagIn, BytesSoFar, LenSoFar). dec_AutoForwardRegistrationParameter88(Tlv) -> dec_AutoForwardRegistrationParameter88(Tlv, [17]). dec_AutoForwardRegistrationParameter88(Tlv, TagIn) -> Tlv1 = match_tags(Tlv, TagIn), SetFun = fun(FunTlv) -> case FunTlv of %filter TTlv = {131072,_} -> {1, TTlv}; %auto-forward-arguments TTlv = {131073,_} -> {2, TTlv}; %delete-after-auto-forwarding TTlv = {131074,_} -> {3, TTlv}; %forwarding-information TTlv = {131075,_} -> {4, TTlv}; Else -> {5, Else} end end, PositionList = [SetFun(TempTlv)|| TempTlv <- Tlv1], Tlv2 = [Stlv || {_,Stlv} <- lists:sort(PositionList)], %%------------------------------------------------- %% attribute filter(1) External MSAbstractService:Filter OPTIONAL %%------------------------------------------------- {Term1,Tlv3} = case Tlv2 of [{131072,V1}|TempTlv3] -> {'MSAbstractService':'dec_Filter'(V1, []), TempTlv3}; _ -> { asn1_NOVALUE, Tlv2} end, %%------------------------------------------------- %% attribute auto-forward-arguments(2) External IPMSAutoActionTypes:AutoForwardArguments %%------------------------------------------------- [V2|Tlv4] = Tlv3, Term2 = 'dec_AutoForwardArguments'(V2, [131073,17]), %%------------------------------------------------- %% attribute delete-after-auto-forwarding(3) with type BOOLEAN DEFAULT = false %%------------------------------------------------- {Term3,Tlv5} = case Tlv4 of [{131074,V3}|TempTlv5] -> {decode_boolean(V3, [1]), TempTlv5}; _ -> {false,Tlv4} end, %%------------------------------------------------- %% attribute forwarding-information(4) with type OCTET STRING %%------------------------------------------------- [V4|Tlv6] = Tlv5, Term4 = decode_octet_string(V4, [131075,4]), case Tlv6 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv6}}}) % extra fields not allowed end, Res1 = {'AutoForwardRegistrationParameter88',Term1,Term2,Term3,Term4}, Res1. %%================================ %% AutoForwardArguments %%================================ enc_AutoForwardArguments(Val) -> enc_AutoForwardArguments(Val, [<<49>>]). enc_AutoForwardArguments(Val, TagIn) -> {_,Cindex1,Cindex2,Cindex3,Cindex4,Cindex5,Cindex6,Cindex7} = Val, %%------------------------------------------------- %% attribute originator-name(1) External MTSAbstractService:OriginatorName %%------------------------------------------------- {EncBytes1,EncLen1} = 'MTSAbstractService':'enc_OriginatorName'(Cindex1, [<<96>>]), %%------------------------------------------------- %% attribute content-identifier(2) with type PrintableString OPTIONAL %%------------------------------------------------- {EncBytes2,EncLen2} = case Cindex2 of asn1_NOVALUE -> {<<>>,0}; _ -> encode_restricted_string(Cindex2, [<<74>>]) end, %%------------------------------------------------- %% attribute priority(3) with type ENUMERATED OPTIONAL %%------------------------------------------------- {EncBytes3,EncLen3} = case Cindex3 of asn1_NOVALUE -> {<<>>,0}; _ -> case Cindex3 of normal -> encode_tags([<<71>>], [0], 1); 'non-urgent' -> encode_tags([<<71>>], [1], 1); urgent -> encode_tags([<<71>>], [2], 1); Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) end end, %%------------------------------------------------- %% attribute per-message-indicators(4) with type BIT STRING OPTIONAL %%------------------------------------------------- {EncBytes4,EncLen4} = case Cindex4 of asn1_NOVALUE -> {<<>>,0}; _ -> encode_named_bit_string(16, Cindex4, [{'disclosure-of-other-recipients',0},{'implicit-conversion-prohibited',1},{'alternate-recipient-allowed',2},{'content-return-request',3},{reserved,4},{'bit-5',5},{'bit-6',6},{'service-message',7}], [<<72>>]) end, %%------------------------------------------------- %% attribute deferred-delivery-time(5) with type UTCTime OPTIONAL %%------------------------------------------------- {EncBytes5,EncLen5} = case Cindex5 of asn1_NOVALUE -> {<<>>,0}; _ -> encode_restricted_string(Cindex5, [<<128>>]) end, %%------------------------------------------------- %% attribute extensions(6) with type SET OF DEFAULT = [] %%------------------------------------------------- {EncBytes6,EncLen6} = case Cindex6 of asn1_DEFAULT -> {<<>>,0}; _ when Cindex6 =:= [] -> {<<>>,0}; _ -> 'enc_AutoForwardArguments_extensions'(Cindex6, [<<162>>]) end, %%------------------------------------------------- %% attribute per-recipient-fields(7) with type SEQUENCE OF %%------------------------------------------------- {EncBytes7,EncLen7} = 'enc_AutoForwardArguments_per-recipient-fields'(Cindex7, [<<161>>]), BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4, EncBytes5, EncBytes6, EncBytes7], LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5 + EncLen6 + EncLen7, encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% AutoForwardArguments_extensions %%================================ enc_AutoForwardArguments_extensions(Val, TagIn) -> {EncBytes,EncLen} = 'enc_AutoForwardArguments_extensions_components'(Val,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_AutoForwardArguments_extensions_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_AutoForwardArguments_extensions_components'([H|T],AccBytes, AccLen) -> {EncBytes,EncLen} = 'enc_AutoForwardArguments_extensions_ExtensionField'(H, [<<48>>]), 'enc_AutoForwardArguments_extensions_components'(T,[EncBytes|AccBytes], AccLen + EncLen). %%================================ %% AutoForwardArguments_extensions_ExtensionField %%================================ enc_AutoForwardArguments_extensions_ExtensionField(Val, TagIn) -> {_,Cindex1,Cindex2,Cindex3} = Val, Objtype = 'IPMSAutoActionTypes':'getenc_internal_object_set_argument_15'( Cindex1), %%------------------------------------------------- %% attribute type(1) External MTSAbstractService:ExtensionType %%------------------------------------------------- {EncBytes1,EncLen1} = 'MTSAbstractService':'enc_ExtensionType'(Cindex1, []), %%------------------------------------------------- %% attribute criticality(2) with type BIT STRING DEFAULT = [] %%------------------------------------------------- {EncBytes2,EncLen2} = case Cindex2 of asn1_DEFAULT -> {<<>>,0}; _ when Cindex2 =:= [] -> {<<>>,0}; _ -> encode_named_bit_string(16, Cindex2, [{'for-submission',0},{'for-transfer',1},{'for-delivery',2}], [<<129>>]) end, %%------------------------------------------------- %% attribute value(3) with type typefieldType DEFAULT = 'NULL' %%------------------------------------------------- {EncBytes3,EncLen3} = case Cindex3 of asn1_DEFAULT -> {<<>>,0}; _ when Cindex3 =:= 'NULL' -> {<<>>,0}; _ -> {TmpBytes3,_ } = Objtype('Type', Cindex3, []), encode_open_type(TmpBytes3, [<<162>>]) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3], LenSoFar = EncLen1 + EncLen2 + EncLen3, encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% AutoForwardArguments_per-recipient-fields %%================================ 'enc_AutoForwardArguments_per-recipient-fields'(Val, TagIn) -> {EncBytes,EncLen} = 'enc_AutoForwardArguments_per-recipient-fields_components'(Val,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_AutoForwardArguments_per-recipient-fields_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_AutoForwardArguments_per-recipient-fields_components'([H|T],AccBytes, AccLen) -> {EncBytes,EncLen} = 'enc_PerRecipientAutoForwardFields'(H, [<<49>>]), 'enc_AutoForwardArguments_per-recipient-fields_components'(T,[EncBytes|AccBytes], AccLen + EncLen). dec_AutoForwardArguments(Tlv) -> dec_AutoForwardArguments(Tlv, [17]). dec_AutoForwardArguments(Tlv, TagIn) -> Tlv1 = match_tags(Tlv, TagIn), SetFun = fun(FunTlv) -> case FunTlv of %originator-name TTlv = {65536,_} -> {1, TTlv}; %content-identifier TTlv = {65546,_} -> {2, TTlv}; %priority TTlv = {65543,_} -> {3, TTlv}; %per-message-indicators TTlv = {65544,_} -> {4, TTlv}; %deferred-delivery-time TTlv = {131072,_} -> {5, TTlv}; %extensions TTlv = {131074,_} -> {6, TTlv}; %per-recipient-fields TTlv = {131073,_} -> {7, TTlv}; Else -> {8, Else} end end, PositionList = [SetFun(TempTlv)|| TempTlv <- Tlv1], Tlv2 = [Stlv || {_,Stlv} <- lists:sort(PositionList)], %%------------------------------------------------- %% attribute originator-name(1) External MTSAbstractService:OriginatorName %%------------------------------------------------- [V1|Tlv3] = Tlv2, Term1 = 'MTSAbstractService':'dec_OriginatorName'(V1, [65536]), %%------------------------------------------------- %% attribute content-identifier(2) with type PrintableString OPTIONAL %%------------------------------------------------- {Term2,Tlv4} = case Tlv3 of [{65546,V2}|TempTlv4] -> {begin Val1 = decode_restricted_string(V2, []), C1 = byte_size(Val1), if 1 =< C1, C1 =< 16 -> binary_to_list(Val1); true -> exit({error,{asn1,bad_range}}) end end, TempTlv4}; _ -> { asn1_NOVALUE, Tlv3} end, %%------------------------------------------------- %% attribute priority(3) with type ENUMERATED OPTIONAL %%------------------------------------------------- {Term3,Tlv5} = case Tlv4 of [{65543,V3}|TempTlv5] -> {case decode_integer(V3, []) of 0 -> normal; 1 -> 'non-urgent'; 2 -> urgent; Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) end, TempTlv5}; _ -> { asn1_NOVALUE, Tlv4} end, %%------------------------------------------------- %% attribute per-message-indicators(4) with type BIT STRING OPTIONAL %%------------------------------------------------- {Term4,Tlv6} = case Tlv5 of [{65544,V4}|TempTlv6] -> {decode_named_bit_string(V4, [{'disclosure-of-other-recipients',0},{'implicit-conversion-prohibited',1},{'alternate-recipient-allowed',2},{'content-return-request',3},{reserved,4},{'bit-5',5},{'bit-6',6},{'service-message',7}], []), TempTlv6}; _ -> { asn1_NOVALUE, Tlv5} end, %%------------------------------------------------- %% attribute deferred-delivery-time(5) with type UTCTime OPTIONAL %%------------------------------------------------- {Term5,Tlv7} = case Tlv6 of [{131072,V5}|TempTlv7] -> {begin binary_to_list(decode_restricted_string(V5, [])) end , TempTlv7}; _ -> { asn1_NOVALUE, Tlv6} end, %%------------------------------------------------- %% attribute extensions(6) with type SET OF DEFAULT = [] %%------------------------------------------------- {Term6,Tlv8} = case Tlv7 of [{131074,V6}|TempTlv8] -> {'dec_AutoForwardArguments_extensions'(V6, []), TempTlv8}; _ -> {[],Tlv7} end, %%------------------------------------------------- %% attribute per-recipient-fields(7) with type SEQUENCE OF %%------------------------------------------------- [V7|Tlv9] = Tlv8, Term7 = 'dec_AutoForwardArguments_per-recipient-fields'(V7, [131073]), case Tlv9 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv9}}}) % extra fields not allowed end, Res1 = {'AutoForwardArguments',Term1,Term2,Term3,Term4,Term5,Term6,Term7}, Res1. 'dec_AutoForwardArguments_extensions'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), ['dec_AutoForwardArguments_extensions_ExtensionField'(V1, [16]) || V1 <- Tlv1]. 'dec_AutoForwardArguments_extensions_ExtensionField'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- %% attribute type(1) External MTSAbstractService:ExtensionType %%------------------------------------------------- [V1|Tlv2] = Tlv1, Term1 = 'MTSAbstractService':'dec_ExtensionType'(V1, []), %%------------------------------------------------- %% attribute criticality(2) with type BIT STRING DEFAULT = [] %%------------------------------------------------- {Term2,Tlv3} = case Tlv2 of [{131073,V2}|TempTlv3] -> {decode_named_bit_string(V2, [{'for-submission',0},{'for-transfer',1},{'for-delivery',2}], []), TempTlv3}; _ -> {[],Tlv2} end, %%------------------------------------------------- %% attribute value(3) with type typefieldType DEFAULT = 'NULL' %%------------------------------------------------- {Tmpterm1,Tlv4} = case Tlv3 of [{131074,V3}|TempTlv4] -> {decode_open_type(V3, []), TempTlv4}; _ -> {'NULL',Tlv3} end, DecObjtypeTerm1 = 'IPMSAutoActionTypes':'getdec_internal_object_set_argument_15'(Term1), Term3 = case Tmpterm1 of 'NULL' ->'NULL'; _ -> case (catch DecObjtypeTerm1('Type', Tmpterm1, [])) of {'EXIT', Reason1} -> exit({'Type not compatible with table constraint',Reason1}); Tmpterm2 -> Tmpterm2 end end, case Tlv4 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowed end, Res1 = {'ExtensionField',Term1,Term2,Term3}, Res1. 'dec_AutoForwardArguments_per-recipient-fields'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), ['dec_PerRecipientAutoForwardFields'(V1, [17]) || V1 <- Tlv1]. %%================================ %% PerMessageAutoForwardFields %%================================ enc_PerMessageAutoForwardFields(Val) -> enc_PerMessageAutoForwardFields(Val, [<<49>>]). enc_PerMessageAutoForwardFields(Val, TagIn) -> {_,Cindex1,Cindex2,Cindex3,Cindex4,Cindex5,Cindex6} = Val, %%------------------------------------------------- %% attribute originator-name(1) External MTSAbstractService:OriginatorName %%------------------------------------------------- {EncBytes1,EncLen1} = 'MTSAbstractService':'enc_OriginatorName'(Cindex1, [<<96>>]), %%------------------------------------------------- %% attribute content-identifier(2) with type PrintableString OPTIONAL %%------------------------------------------------- {EncBytes2,EncLen2} = case Cindex2 of asn1_NOVALUE -> {<<>>,0}; _ -> encode_restricted_string(Cindex2, [<<74>>]) end, %%------------------------------------------------- %% attribute priority(3) with type ENUMERATED OPTIONAL %%------------------------------------------------- {EncBytes3,EncLen3} = case Cindex3 of asn1_NOVALUE -> {<<>>,0}; _ -> case Cindex3 of normal -> encode_tags([<<71>>], [0], 1); 'non-urgent' -> encode_tags([<<71>>], [1], 1); urgent -> encode_tags([<<71>>], [2], 1); Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) end end, %%------------------------------------------------- %% attribute per-message-indicators(4) with type BIT STRING OPTIONAL %%------------------------------------------------- {EncBytes4,EncLen4} = case Cindex4 of asn1_NOVALUE -> {<<>>,0}; _ -> encode_named_bit_string(16, Cindex4, [{'disclosure-of-other-recipients',0},{'implicit-conversion-prohibited',1},{'alternate-recipient-allowed',2},{'content-return-request',3},{reserved,4},{'bit-5',5},{'bit-6',6},{'service-message',7}], [<<72>>]) end, %%------------------------------------------------- %% attribute deferred-delivery-time(5) with type UTCTime OPTIONAL %%------------------------------------------------- {EncBytes5,EncLen5} = case Cindex5 of asn1_NOVALUE -> {<<>>,0}; _ -> encode_restricted_string(Cindex5, [<<128>>]) end, %%------------------------------------------------- %% attribute extensions(6) with type SET OF DEFAULT = [] %%------------------------------------------------- {EncBytes6,EncLen6} = case Cindex6 of asn1_DEFAULT -> {<<>>,0}; _ when Cindex6 =:= [] -> {<<>>,0}; _ -> 'enc_PerMessageAutoForwardFields_extensions'(Cindex6, [<<162>>]) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4, EncBytes5, EncBytes6], LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5 + EncLen6, encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% PerMessageAutoForwardFields_extensions %%================================ enc_PerMessageAutoForwardFields_extensions(Val, TagIn) -> {EncBytes,EncLen} = 'enc_PerMessageAutoForwardFields_extensions_components'(Val,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_PerMessageAutoForwardFields_extensions_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_PerMessageAutoForwardFields_extensions_components'([H|T],AccBytes, AccLen) -> {EncBytes,EncLen} = 'enc_PerMessageAutoForwardFields_extensions_ExtensionField'(H, [<<48>>]), 'enc_PerMessageAutoForwardFields_extensions_components'(T,[EncBytes|AccBytes], AccLen + EncLen). %%================================ %% PerMessageAutoForwardFields_extensions_ExtensionField %%================================ enc_PerMessageAutoForwardFields_extensions_ExtensionField(Val, TagIn) -> {_,Cindex1,Cindex2,Cindex3} = Val, Objtype = 'IPMSAutoActionTypes':'getenc_internal_object_set_argument_17'( Cindex1), %%------------------------------------------------- %% attribute type(1) External MTSAbstractService:ExtensionType %%------------------------------------------------- {EncBytes1,EncLen1} = 'MTSAbstractService':'enc_ExtensionType'(Cindex1, []), %%------------------------------------------------- %% attribute criticality(2) with type BIT STRING DEFAULT = [] %%------------------------------------------------- {EncBytes2,EncLen2} = case Cindex2 of asn1_DEFAULT -> {<<>>,0}; _ when Cindex2 =:= [] -> {<<>>,0}; _ -> encode_named_bit_string(16, Cindex2, [{'for-submission',0},{'for-transfer',1},{'for-delivery',2}], [<<129>>]) end, %%------------------------------------------------- %% attribute value(3) with type typefieldType DEFAULT = 'NULL' %%------------------------------------------------- {EncBytes3,EncLen3} = case Cindex3 of asn1_DEFAULT -> {<<>>,0}; _ when Cindex3 =:= 'NULL' -> {<<>>,0}; _ -> {TmpBytes3,_ } = Objtype('Type', Cindex3, []), encode_open_type(TmpBytes3, [<<162>>]) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3], LenSoFar = EncLen1 + EncLen2 + EncLen3, encode_tags(TagIn, BytesSoFar, LenSoFar). dec_PerMessageAutoForwardFields(Tlv) -> dec_PerMessageAutoForwardFields(Tlv, [17]). dec_PerMessageAutoForwardFields(Tlv, TagIn) -> Tlv1 = match_tags(Tlv, TagIn), SetFun = fun(FunTlv) -> case FunTlv of %originator-name TTlv = {65536,_} -> {1, TTlv}; %content-identifier TTlv = {65546,_} -> {2, TTlv}; %priority TTlv = {65543,_} -> {3, TTlv}; %per-message-indicators TTlv = {65544,_} -> {4, TTlv}; %deferred-delivery-time TTlv = {131072,_} -> {5, TTlv}; %extensions TTlv = {131074,_} -> {6, TTlv}; Else -> {7, Else} end end, PositionList = [SetFun(TempTlv)|| TempTlv <- Tlv1], Tlv2 = [Stlv || {_,Stlv} <- lists:sort(PositionList)], %%------------------------------------------------- %% attribute originator-name(1) External MTSAbstractService:OriginatorName %%------------------------------------------------- [V1|Tlv3] = Tlv2, Term1 = 'MTSAbstractService':'dec_OriginatorName'(V1, [65536]), %%------------------------------------------------- %% attribute content-identifier(2) with type PrintableString OPTIONAL %%------------------------------------------------- {Term2,Tlv4} = case Tlv3 of [{65546,V2}|TempTlv4] -> {begin Val1 = decode_restricted_string(V2, []), C1 = byte_size(Val1), if 1 =< C1, C1 =< 16 -> binary_to_list(Val1); true -> exit({error,{asn1,bad_range}}) end end, TempTlv4}; _ -> { asn1_NOVALUE, Tlv3} end, %%------------------------------------------------- %% attribute priority(3) with type ENUMERATED OPTIONAL %%------------------------------------------------- {Term3,Tlv5} = case Tlv4 of [{65543,V3}|TempTlv5] -> {case decode_integer(V3, []) of 0 -> normal; 1 -> 'non-urgent'; 2 -> urgent; Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) end, TempTlv5}; _ -> { asn1_NOVALUE, Tlv4} end, %%------------------------------------------------- %% attribute per-message-indicators(4) with type BIT STRING OPTIONAL %%------------------------------------------------- {Term4,Tlv6} = case Tlv5 of [{65544,V4}|TempTlv6] -> {decode_named_bit_string(V4, [{'disclosure-of-other-recipients',0},{'implicit-conversion-prohibited',1},{'alternate-recipient-allowed',2},{'content-return-request',3},{reserved,4},{'bit-5',5},{'bit-6',6},{'service-message',7}], []), TempTlv6}; _ -> { asn1_NOVALUE, Tlv5} end, %%------------------------------------------------- %% attribute deferred-delivery-time(5) with type UTCTime OPTIONAL %%------------------------------------------------- {Term5,Tlv7} = case Tlv6 of [{131072,V5}|TempTlv7] -> {begin binary_to_list(decode_restricted_string(V5, [])) end , TempTlv7}; _ -> { asn1_NOVALUE, Tlv6} end, %%------------------------------------------------- %% attribute extensions(6) with type SET OF DEFAULT = [] %%------------------------------------------------- {Term6,Tlv8} = case Tlv7 of [{131074,V6}|TempTlv8] -> {'dec_PerMessageAutoForwardFields_extensions'(V6, []), TempTlv8}; _ -> {[],Tlv7} end, case Tlv8 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv8}}}) % extra fields not allowed end, Res1 = {'PerMessageAutoForwardFields',Term1,Term2,Term3,Term4,Term5,Term6}, Res1. 'dec_PerMessageAutoForwardFields_extensions'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), ['dec_PerMessageAutoForwardFields_extensions_ExtensionField'(V1, [16]) || V1 <- Tlv1]. 'dec_PerMessageAutoForwardFields_extensions_ExtensionField'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- %% attribute type(1) External MTSAbstractService:ExtensionType %%------------------------------------------------- [V1|Tlv2] = Tlv1, Term1 = 'MTSAbstractService':'dec_ExtensionType'(V1, []), %%------------------------------------------------- %% attribute criticality(2) with type BIT STRING DEFAULT = [] %%------------------------------------------------- {Term2,Tlv3} = case Tlv2 of [{131073,V2}|TempTlv3] -> {decode_named_bit_string(V2, [{'for-submission',0},{'for-transfer',1},{'for-delivery',2}], []), TempTlv3}; _ -> {[],Tlv2} end, %%------------------------------------------------- %% attribute value(3) with type typefieldType DEFAULT = 'NULL' %%------------------------------------------------- {Tmpterm1,Tlv4} = case Tlv3 of [{131074,V3}|TempTlv4] -> {decode_open_type(V3, []), TempTlv4}; _ -> {'NULL',Tlv3} end, DecObjtypeTerm1 = 'IPMSAutoActionTypes':'getdec_internal_object_set_argument_17'(Term1), Term3 = case Tmpterm1 of 'NULL' ->'NULL'; _ -> case (catch DecObjtypeTerm1('Type', Tmpterm1, [])) of {'EXIT', Reason1} -> exit({'Type not compatible with table constraint',Reason1}); Tmpterm2 -> Tmpterm2 end end, case Tlv4 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowed end, Res1 = {'ExtensionField',Term1,Term2,Term3}, Res1. %%================================ %% PerRecipientAutoForwardFields %%================================ enc_PerRecipientAutoForwardFields(Val) -> enc_PerRecipientAutoForwardFields(Val, [<<49>>]). enc_PerRecipientAutoForwardFields(Val, TagIn) -> {_,Cindex1,Cindex2,Cindex3,Cindex4} = Val, %%------------------------------------------------- %% attribute recipient-name(1) External MTSAbstractService:RecipientName %%------------------------------------------------- {EncBytes1,EncLen1} = 'MTSAbstractService':'enc_RecipientName'(Cindex1, [<<96>>]), %%------------------------------------------------- %% attribute originator-report-request(2) with type BIT STRING %%------------------------------------------------- {EncBytes2,EncLen2} = encode_named_bit_string(16, Cindex2, [{report,3},{'non-delivery-report',4}], [<<128>>]), %%------------------------------------------------- %% attribute explicit-conversion(3) with type INTEGER OPTIONAL %%------------------------------------------------- {EncBytes3,EncLen3} = case Cindex3 of asn1_NOVALUE -> {<<>>,0}; _ -> encode_integer(Cindex3, [{'ia5-text-to-teletex',0},{'ia5-text-to-g3-facsimile',8},{'ia5-text-to-g4-class-1',9},{'ia5-text-to-videotex',10},{'teletex-to-ia5-text',11},{'teletex-to-g3-facsimile',12},{'teletex-to-g4-class-1',13},{'teletex-to-videotex',14},{'videotex-to-ia5-text',16},{'videotex-to-teletex',17}], [<<129>>]) end, %%------------------------------------------------- %% attribute extensions(4) with type SET OF DEFAULT = [] %%------------------------------------------------- {EncBytes4,EncLen4} = case Cindex4 of asn1_DEFAULT -> {<<>>,0}; _ when Cindex4 =:= [] -> {<<>>,0}; _ -> 'enc_PerRecipientAutoForwardFields_extensions'(Cindex4, [<<162>>]) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4], LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4, encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% PerRecipientAutoForwardFields_extensions %%================================ enc_PerRecipientAutoForwardFields_extensions(Val, TagIn) -> {EncBytes,EncLen} = 'enc_PerRecipientAutoForwardFields_extensions_components'(Val,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_PerRecipientAutoForwardFields_extensions_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_PerRecipientAutoForwardFields_extensions_components'([H|T],AccBytes, AccLen) -> {EncBytes,EncLen} = 'enc_PerRecipientAutoForwardFields_extensions_ExtensionField'(H, [<<48>>]), 'enc_PerRecipientAutoForwardFields_extensions_components'(T,[EncBytes|AccBytes], AccLen + EncLen). %%================================ %% PerRecipientAutoForwardFields_extensions_ExtensionField %%================================ enc_PerRecipientAutoForwardFields_extensions_ExtensionField(Val, TagIn) -> {_,Cindex1,Cindex2,Cindex3} = Val, Objtype = 'IPMSAutoActionTypes':'getenc_internal_object_set_argument_16'( Cindex1), %%------------------------------------------------- %% attribute type(1) External MTSAbstractService:ExtensionType %%------------------------------------------------- {EncBytes1,EncLen1} = 'MTSAbstractService':'enc_ExtensionType'(Cindex1, []), %%------------------------------------------------- %% attribute criticality(2) with type BIT STRING DEFAULT = [] %%------------------------------------------------- {EncBytes2,EncLen2} = case Cindex2 of asn1_DEFAULT -> {<<>>,0}; _ when Cindex2 =:= [] -> {<<>>,0}; _ -> encode_named_bit_string(16, Cindex2, [{'for-submission',0},{'for-transfer',1},{'for-delivery',2}], [<<129>>]) end, %%------------------------------------------------- %% attribute value(3) with type typefieldType DEFAULT = 'NULL' %%------------------------------------------------- {EncBytes3,EncLen3} = case Cindex3 of asn1_DEFAULT -> {<<>>,0}; _ when Cindex3 =:= 'NULL' -> {<<>>,0}; _ -> {TmpBytes3,_ } = Objtype('Type', Cindex3, []), encode_open_type(TmpBytes3, [<<162>>]) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3], LenSoFar = EncLen1 + EncLen2 + EncLen3, encode_tags(TagIn, BytesSoFar, LenSoFar). dec_PerRecipientAutoForwardFields(Tlv) -> dec_PerRecipientAutoForwardFields(Tlv, [17]). dec_PerRecipientAutoForwardFields(Tlv, TagIn) -> Tlv1 = match_tags(Tlv, TagIn), SetFun = fun(FunTlv) -> case FunTlv of %recipient-name TTlv = {65536,_} -> {1, TTlv}; %originator-report-request TTlv = {131072,_} -> {2, TTlv}; %explicit-conversion TTlv = {131073,_} -> {3, TTlv}; %extensions TTlv = {131074,_} -> {4, TTlv}; Else -> {5, Else} end end, PositionList = [SetFun(TempTlv)|| TempTlv <- Tlv1], Tlv2 = [Stlv || {_,Stlv} <- lists:sort(PositionList)], %%------------------------------------------------- %% attribute recipient-name(1) External MTSAbstractService:RecipientName %%------------------------------------------------- [V1|Tlv3] = Tlv2, Term1 = 'MTSAbstractService':'dec_RecipientName'(V1, [65536]), %%------------------------------------------------- %% attribute originator-report-request(2) with type BIT STRING %%------------------------------------------------- [V2|Tlv4] = Tlv3, Term2 = decode_named_bit_string(V2, [{report,3},{'non-delivery-report',4}], [131072]), %%------------------------------------------------- %% attribute explicit-conversion(3) with type INTEGER OPTIONAL %%------------------------------------------------- {Term3,Tlv5} = case Tlv4 of [{131073,V3}|TempTlv5] -> {begin Val1 = decode_integer(V3, []), if 0 =< Val1, Val1 =< 256 -> Val2 = Val1, number2name(Val2, [{'ia5-text-to-teletex',0},{'ia5-text-to-g3-facsimile',8},{'ia5-text-to-g4-class-1',9},{'ia5-text-to-videotex',10},{'teletex-to-ia5-text',11},{'teletex-to-g3-facsimile',12},{'teletex-to-g4-class-1',13},{'teletex-to-videotex',14},{'videotex-to-ia5-text',16},{'videotex-to-teletex',17}]); true -> exit({error,{asn1,bad_range}}) end end, TempTlv5}; _ -> { asn1_NOVALUE, Tlv4} end, %%------------------------------------------------- %% attribute extensions(4) with type SET OF DEFAULT = [] %%------------------------------------------------- {Term4,Tlv6} = case Tlv5 of [{131074,V4}|TempTlv6] -> {'dec_PerRecipientAutoForwardFields_extensions'(V4, []), TempTlv6}; _ -> {[],Tlv5} end, case Tlv6 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv6}}}) % extra fields not allowed end, Res1 = {'PerRecipientAutoForwardFields',Term1,Term2,Term3,Term4}, Res1. 'dec_PerRecipientAutoForwardFields_extensions'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), ['dec_PerRecipientAutoForwardFields_extensions_ExtensionField'(V1, [16]) || V1 <- Tlv1]. 'dec_PerRecipientAutoForwardFields_extensions_ExtensionField'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- %% attribute type(1) External MTSAbstractService:ExtensionType %%------------------------------------------------- [V1|Tlv2] = Tlv1, Term1 = 'MTSAbstractService':'dec_ExtensionType'(V1, []), %%------------------------------------------------- %% attribute criticality(2) with type BIT STRING DEFAULT = [] %%------------------------------------------------- {Term2,Tlv3} = case Tlv2 of [{131073,V2}|TempTlv3] -> {decode_named_bit_string(V2, [{'for-submission',0},{'for-transfer',1},{'for-delivery',2}], []), TempTlv3}; _ -> {[],Tlv2} end, %%------------------------------------------------- %% attribute value(3) with type typefieldType DEFAULT = 'NULL' %%------------------------------------------------- {Tmpterm1,Tlv4} = case Tlv3 of [{131074,V3}|TempTlv4] -> {decode_open_type(V3, []), TempTlv4}; _ -> {'NULL',Tlv3} end, DecObjtypeTerm1 = 'IPMSAutoActionTypes':'getdec_internal_object_set_argument_16'(Term1), Term3 = case Tmpterm1 of 'NULL' ->'NULL'; _ -> case (catch DecObjtypeTerm1('Type', Tmpterm1, [])) of {'EXIT', Reason1} -> exit({'Type not compatible with table constraint',Reason1}); Tmpterm2 -> Tmpterm2 end end, case Tlv4 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowed end, Res1 = {'ExtensionField',Term1,Term2,Term3}, Res1. %%================================ %% EncodedForwardingInformation %%================================ enc_EncodedForwardingInformation(Val) -> enc_EncodedForwardingInformation(Val, [<<4>>]). enc_EncodedForwardingInformation(Val, TagIn) -> encode_restricted_string(Val, TagIn). dec_EncodedForwardingInformation(Tlv) -> dec_EncodedForwardingInformation(Tlv, [4]). dec_EncodedForwardingInformation(Tlv, TagIn) -> decode_octet_string(Tlv, TagIn). %%================================ %% ForwardingInformation1988 %%================================ enc_ForwardingInformation1988(Val) -> enc_ForwardingInformation1988(Val, [<<49>>]). enc_ForwardingInformation1988(Val, TagIn) -> {_,Cindex1,Cindex2,Cindex3} = Val, %%------------------------------------------------- %% attribute auto-forwarding-comment(1) with type PrintableString OPTIONAL %%------------------------------------------------- {EncBytes1,EncLen1} = case Cindex1 of asn1_NOVALUE -> {<<>>,0}; _ -> encode_restricted_string(Cindex1, [<<128>>]) end, %%------------------------------------------------- %% attribute ia5-cover-note(2) External IPMSInformationObjects:IA5TextBodyPart OPTIONAL %%------------------------------------------------- {EncBytes2,EncLen2} = case Cindex2 of asn1_NOVALUE -> {<<>>,0}; _ -> 'IPMSInformationObjects':'enc_IA5TextBodyPart'(Cindex2, [<<161>>]) end, %%------------------------------------------------- %% attribute this-ipm-prefix(3) with type PrintableString OPTIONAL %%------------------------------------------------- {EncBytes3,EncLen3} = case Cindex3 of asn1_NOVALUE -> {<<>>,0}; _ -> encode_restricted_string(Cindex3, [<<130>>]) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3], LenSoFar = EncLen1 + EncLen2 + EncLen3, encode_tags(TagIn, BytesSoFar, LenSoFar). dec_ForwardingInformation1988(Tlv) -> dec_ForwardingInformation1988(Tlv, [17]). dec_ForwardingInformation1988(Tlv, TagIn) -> Tlv1 = match_tags(Tlv, TagIn), SetFun = fun(FunTlv) -> case FunTlv of %auto-forwarding-comment TTlv = {131072,_} -> {1, TTlv}; %ia5-cover-note TTlv = {131073,_} -> {2, TTlv}; %this-ipm-prefix TTlv = {131074,_} -> {3, TTlv}; Else -> {4, Else} end end, PositionList = [SetFun(TempTlv)|| TempTlv <- Tlv1], Tlv2 = [Stlv || {_,Stlv} <- lists:sort(PositionList)], %%------------------------------------------------- %% attribute auto-forwarding-comment(1) with type PrintableString OPTIONAL %%------------------------------------------------- {Term1,Tlv3} = case Tlv2 of [{131072,V1}|TempTlv3] -> {begin Val1 = decode_restricted_string(V1, []), C1 = byte_size(Val1), if 0 =< C1, C1 =< 256 -> binary_to_list(Val1); true -> exit({error,{asn1,bad_range}}) end end, TempTlv3}; _ -> { asn1_NOVALUE, Tlv2} end, %%------------------------------------------------- %% attribute ia5-cover-note(2) External IPMSInformationObjects:IA5TextBodyPart OPTIONAL %%------------------------------------------------- {Term2,Tlv4} = case Tlv3 of [{131073,V2}|TempTlv4] -> {'IPMSInformationObjects':'dec_IA5TextBodyPart'(V2, []), TempTlv4}; _ -> { asn1_NOVALUE, Tlv3} end, %%------------------------------------------------- %% attribute this-ipm-prefix(3) with type PrintableString OPTIONAL %%------------------------------------------------- {Term3,Tlv5} = case Tlv4 of [{131074,V3}|TempTlv5] -> {begin Val2 = decode_restricted_string(V3, []), C2 = byte_size(Val2), if 1 =< C2, C2 =< 2 -> binary_to_list(Val2); true -> exit({error,{asn1,bad_range}}) end end, TempTlv5}; _ -> { asn1_NOVALUE, Tlv4} end, case Tlv5 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv5}}}) % extra fields not allowed end, Res1 = {'ForwardingInformation1988',Term1,Term2,Term3}, Res1. %%================================ %% IPMAutoAcknowledgementRegistrationParameter %%================================ enc_IPMAutoAcknowledgementRegistrationParameter(Val) -> enc_IPMAutoAcknowledgementRegistrationParameter(Val, [<<49>>]). enc_IPMAutoAcknowledgementRegistrationParameter(Val, TagIn) -> {_,Cindex1,Cindex2} = Val, %%------------------------------------------------- %% attribute auto-acknowledge-suppl-receipt-info(1) with type PrintableString OPTIONAL %%------------------------------------------------- {EncBytes1,EncLen1} = case Cindex1 of asn1_NOVALUE -> {<<>>,0}; _ -> encode_restricted_string(Cindex1, [<<19>>,<<160>>]) end, %%------------------------------------------------- %% attribute submission-options(2) External MSAbstractService:MSSubmissionOptions OPTIONAL %%------------------------------------------------- {EncBytes2,EncLen2} = case Cindex2 of asn1_NOVALUE -> {<<>>,0}; _ -> 'MSAbstractService':'enc_MSSubmissionOptions'(Cindex2, [<<49>>,<<161>>]) end, BytesSoFar = [EncBytes1, EncBytes2], LenSoFar = EncLen1 + EncLen2, encode_tags(TagIn, BytesSoFar, LenSoFar). dec_IPMAutoAcknowledgementRegistrationParameter(Tlv) -> dec_IPMAutoAcknowledgementRegistrationParameter(Tlv, [17]). dec_IPMAutoAcknowledgementRegistrationParameter(Tlv, TagIn) -> Tlv1 = match_tags(Tlv, TagIn), SetFun = fun(FunTlv) -> case FunTlv of %auto-acknowledge-suppl-receipt-info TTlv = {131072,_} -> {1, TTlv}; %submission-options TTlv = {131073,_} -> {2, TTlv}; Else -> {3, Else} end end, PositionList = [SetFun(TempTlv)|| TempTlv <- Tlv1], Tlv2 = [Stlv || {_,Stlv} <- lists:sort(PositionList)], %%------------------------------------------------- %% attribute auto-acknowledge-suppl-receipt-info(1) with type PrintableString OPTIONAL %%------------------------------------------------- {Term1,Tlv3} = case Tlv2 of [{131072,V1}|TempTlv3] -> {begin Val1 = decode_restricted_string(V1, [19]), C1 = byte_size(Val1), if 1 =< C1, C1 =< 256 -> binary_to_list(Val1); true -> exit({error,{asn1,bad_range}}) end end, TempTlv3}; _ -> { asn1_NOVALUE, Tlv2} end, %%------------------------------------------------- %% attribute submission-options(2) External MSAbstractService:MSSubmissionOptions OPTIONAL %%------------------------------------------------- {Term2,Tlv4} = case Tlv3 of [{131073,V2}|TempTlv4] -> {'MSAbstractService':'dec_MSSubmissionOptions'(V2, [17]), TempTlv4}; _ -> { asn1_NOVALUE, Tlv3} end, case Tlv4 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowed end, Res1 = {'IPMAutoAcknowledgementRegistrationParameter',Term1,Term2}, Res1. %%================================ %% IPMAutoDiscardRegistrationParameter %%================================ enc_IPMAutoDiscardRegistrationParameter(Val) -> enc_IPMAutoDiscardRegistrationParameter(Val, [<<49>>]). enc_IPMAutoDiscardRegistrationParameter(Val, TagIn) -> {_,Cindex1,Cindex2,Cindex3,Cindex4,Cindex5} = Val, %%------------------------------------------------- %% attribute filter(1) External MSAbstractService:Filter OPTIONAL %%------------------------------------------------- {EncBytes1,EncLen1} = case Cindex1 of asn1_NOVALUE -> {<<>>,0}; _ -> 'MSAbstractService':'enc_Filter'(Cindex1, [<<160>>]) end, %%------------------------------------------------- %% attribute submission-options(2) External MSAbstractService:MSSubmissionOptions OPTIONAL %%------------------------------------------------- {EncBytes2,EncLen2} = case Cindex2 of asn1_NOVALUE -> {<<>>,0}; _ -> 'MSAbstractService':'enc_MSSubmissionOptions'(Cindex2, [<<49>>,<<161>>]) end, %%------------------------------------------------- %% attribute auto-discard-expired-ipms(3) with type BOOLEAN %%------------------------------------------------- {EncBytes3,EncLen3} = encode_boolean(Cindex3, [<<1>>,<<162>>]), %%------------------------------------------------- %% attribute auto-discard-obsoleted-ipms(4) with type BOOLEAN %%------------------------------------------------- {EncBytes4,EncLen4} = encode_boolean(Cindex4, [<<1>>,<<163>>]), %%------------------------------------------------- %% attribute restrict-obsoleting-to-originator(5) with type BOOLEAN %%------------------------------------------------- {EncBytes5,EncLen5} = encode_boolean(Cindex5, [<<1>>,<<164>>]), BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4, EncBytes5], LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5, encode_tags(TagIn, BytesSoFar, LenSoFar). dec_IPMAutoDiscardRegistrationParameter(Tlv) -> dec_IPMAutoDiscardRegistrationParameter(Tlv, [17]). dec_IPMAutoDiscardRegistrationParameter(Tlv, TagIn) -> Tlv1 = match_tags(Tlv, TagIn), SetFun = fun(FunTlv) -> case FunTlv of %filter TTlv = {131072,_} -> {1, TTlv}; %submission-options TTlv = {131073,_} -> {2, TTlv}; %auto-discard-expired-ipms TTlv = {131074,_} -> {3, TTlv}; %auto-discard-obsoleted-ipms TTlv = {131075,_} -> {4, TTlv}; %restrict-obsoleting-to-originator TTlv = {131076,_} -> {5, TTlv}; Else -> {6, Else} end end, PositionList = [SetFun(TempTlv)|| TempTlv <- Tlv1], Tlv2 = [Stlv || {_,Stlv} <- lists:sort(PositionList)], %%------------------------------------------------- %% attribute filter(1) External MSAbstractService:Filter OPTIONAL %%------------------------------------------------- {Term1,Tlv3} = case Tlv2 of [{131072,V1}|TempTlv3] -> {'MSAbstractService':'dec_Filter'(V1, []), TempTlv3}; _ -> { asn1_NOVALUE, Tlv2} end, %%------------------------------------------------- %% attribute submission-options(2) External MSAbstractService:MSSubmissionOptions OPTIONAL %%------------------------------------------------- {Term2,Tlv4} = case Tlv3 of [{131073,V2}|TempTlv4] -> {'MSAbstractService':'dec_MSSubmissionOptions'(V2, [17]), TempTlv4}; _ -> { asn1_NOVALUE, Tlv3} end, %%------------------------------------------------- %% attribute auto-discard-expired-ipms(3) with type BOOLEAN %%------------------------------------------------- [V3|Tlv5] = Tlv4, Term3 = decode_boolean(V3, [131074,1]), %%------------------------------------------------- %% attribute auto-discard-obsoleted-ipms(4) with type BOOLEAN %%------------------------------------------------- [V4|Tlv6] = Tlv5, Term4 = decode_boolean(V4, [131075,1]), %%------------------------------------------------- %% attribute restrict-obsoleting-to-originator(5) with type BOOLEAN %%------------------------------------------------- [V5|Tlv7] = Tlv6, Term5 = decode_boolean(V5, [131076,1]), case Tlv7 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv7}}}) % extra fields not allowed end, Res1 = {'IPMAutoDiscardRegistrationParameter',Term1,Term2,Term3,Term4,Term5}, Res1. %%================================ %% IPMAutoAdviseRegistrationParameter %%================================ enc_IPMAutoAdviseRegistrationParameter(Val) -> enc_IPMAutoAdviseRegistrationParameter(Val, [<<49>>]). enc_IPMAutoAdviseRegistrationParameter(Val, TagIn) -> {_,Cindex1,Cindex2,Cindex3,Cindex4,Cindex5,Cindex6} = Val, %%------------------------------------------------- %% attribute enabled(1) with type BOOLEAN DEFAULT = true %%------------------------------------------------- {EncBytes1,EncLen1} = case Cindex1 of asn1_DEFAULT -> {<<>>,0}; _ when Cindex1 =:= true -> {<<>>,0}; _ -> encode_boolean(Cindex1, [<<1>>,<<160>>]) end, %%------------------------------------------------- %% attribute filter(2) External MSAbstractService:Filter OPTIONAL %%------------------------------------------------- {EncBytes2,EncLen2} = case Cindex2 of asn1_NOVALUE -> {<<>>,0}; _ -> 'MSAbstractService':'enc_Filter'(Cindex2, [<<161>>]) end, %%------------------------------------------------- %% attribute advice-notifications(3) with type SET OF %%------------------------------------------------- {EncBytes3,EncLen3} = 'enc_IPMAutoAdviseRegistrationParameter_advice-notifications'(Cindex3, [<<49>>,<<162>>]), %%------------------------------------------------- %% attribute suppress-subsequent-notifications(4) with type BOOLEAN DEFAULT = true %%------------------------------------------------- {EncBytes4,EncLen4} = case Cindex4 of asn1_DEFAULT -> {<<>>,0}; _ when Cindex4 =:= true -> {<<>>,0}; _ -> encode_boolean(Cindex4, [<<1>>,<<163>>]) end, %%------------------------------------------------- %% attribute use-ipm-if-an-not-supported(5) with type BOOLEAN DEFAULT = false %%------------------------------------------------- {EncBytes5,EncLen5} = case Cindex5 of asn1_DEFAULT -> {<<>>,0}; _ when Cindex5 =:= false -> {<<>>,0}; _ -> encode_boolean(Cindex5, [<<1>>,<<164>>]) end, %%------------------------------------------------- %% attribute submission-options(6) External MSAbstractService:MSSubmissionOptions OPTIONAL %%------------------------------------------------- {EncBytes6,EncLen6} = case Cindex6 of asn1_NOVALUE -> {<<>>,0}; _ -> 'MSAbstractService':'enc_MSSubmissionOptions'(Cindex6, [<<49>>,<<165>>]) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4, EncBytes5, EncBytes6], LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5 + EncLen6, encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% IPMAutoAdviseRegistrationParameter_advice-notifications %%================================ 'enc_IPMAutoAdviseRegistrationParameter_advice-notifications'(Val, TagIn) -> {EncBytes,EncLen} = 'enc_IPMAutoAdviseRegistrationParameter_advice-notifications_components'(Val,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_IPMAutoAdviseRegistrationParameter_advice-notifications_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_IPMAutoAdviseRegistrationParameter_advice-notifications_components'([H|T],AccBytes, AccLen) -> {EncBytes,EncLen} = 'enc_IPMAutoAdviseRegistrationParameter_advice-notifications_IPMSExtension'(H, [<<48>>]), 'enc_IPMAutoAdviseRegistrationParameter_advice-notifications_components'(T,[EncBytes|AccBytes], AccLen + EncLen). %%================================ %% IPMAutoAdviseRegistrationParameter_advice-notifications_IPMSExtension %%================================ 'enc_IPMAutoAdviseRegistrationParameter_advice-notifications_IPMSExtension'(Val, TagIn) -> {_,Cindex1,Cindex2} = Val, Objtype = 'IPMSAutoActionTypes':'getenc_internal_object_set_argument_18'( Cindex1), %%------------------------------------------------- %% attribute type(1) with type OBJECT IDENTIFIER %%------------------------------------------------- {EncBytes1,EncLen1} = encode_object_identifier(Cindex1, [<<6>>]), %%------------------------------------------------- %% attribute value(2) with type typefieldType DEFAULT = 'NULL' %%------------------------------------------------- {EncBytes2,EncLen2} = case Cindex2 of asn1_DEFAULT -> {<<>>,0}; _ when Cindex2 =:= 'NULL' -> {<<>>,0}; _ -> {TmpBytes2,_ } = Objtype('Type', Cindex2, []), encode_open_type(TmpBytes2, []) end, BytesSoFar = [EncBytes1, EncBytes2], LenSoFar = EncLen1 + EncLen2, encode_tags(TagIn, BytesSoFar, LenSoFar). dec_IPMAutoAdviseRegistrationParameter(Tlv) -> dec_IPMAutoAdviseRegistrationParameter(Tlv, [17]). dec_IPMAutoAdviseRegistrationParameter(Tlv, TagIn) -> Tlv1 = match_tags(Tlv, TagIn), SetFun = fun(FunTlv) -> case FunTlv of %enabled TTlv = {131072,_} -> {1, TTlv}; %filter TTlv = {131073,_} -> {2, TTlv}; %advice-notifications TTlv = {131074,_} -> {3, TTlv}; %suppress-subsequent-notifications TTlv = {131075,_} -> {4, TTlv}; %use-ipm-if-an-not-supported TTlv = {131076,_} -> {5, TTlv}; %submission-options TTlv = {131077,_} -> {6, TTlv}; Else -> {7, Else} end end, PositionList = [SetFun(TempTlv)|| TempTlv <- Tlv1], Tlv2 = [Stlv || {_,Stlv} <- lists:sort(PositionList)], %%------------------------------------------------- %% attribute enabled(1) with type BOOLEAN DEFAULT = true %%------------------------------------------------- {Term1,Tlv3} = case Tlv2 of [{131072,V1}|TempTlv3] -> {decode_boolean(V1, [1]), TempTlv3}; _ -> {true,Tlv2} end, %%------------------------------------------------- %% attribute filter(2) External MSAbstractService:Filter OPTIONAL %%------------------------------------------------- {Term2,Tlv4} = case Tlv3 of [{131073,V2}|TempTlv4] -> {'MSAbstractService':'dec_Filter'(V2, []), TempTlv4}; _ -> { asn1_NOVALUE, Tlv3} end, %%------------------------------------------------- %% attribute advice-notifications(3) with type SET OF %%------------------------------------------------- [V3|Tlv5] = Tlv4, Term3 = 'dec_IPMAutoAdviseRegistrationParameter_advice-notifications'(V3, [131074,17]), %%------------------------------------------------- %% attribute suppress-subsequent-notifications(4) with type BOOLEAN DEFAULT = true %%------------------------------------------------- {Term4,Tlv6} = case Tlv5 of [{131075,V4}|TempTlv6] -> {decode_boolean(V4, [1]), TempTlv6}; _ -> {true,Tlv5} end, %%------------------------------------------------- %% attribute use-ipm-if-an-not-supported(5) with type BOOLEAN DEFAULT = false %%------------------------------------------------- {Term5,Tlv7} = case Tlv6 of [{131076,V5}|TempTlv7] -> {decode_boolean(V5, [1]), TempTlv7}; _ -> {false,Tlv6} end, %%------------------------------------------------- %% attribute submission-options(6) External MSAbstractService:MSSubmissionOptions OPTIONAL %%------------------------------------------------- {Term6,Tlv8} = case Tlv7 of [{131077,V6}|TempTlv8] -> {'MSAbstractService':'dec_MSSubmissionOptions'(V6, [17]), TempTlv8}; _ -> { asn1_NOVALUE, Tlv7} end, case Tlv8 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv8}}}) % extra fields not allowed end, Res1 = {'IPMAutoAdviseRegistrationParameter',Term1,Term2,Term3,Term4,Term5,Term6}, Res1. 'dec_IPMAutoAdviseRegistrationParameter_advice-notifications'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), ['dec_IPMAutoAdviseRegistrationParameter_advice-notifications_IPMSExtension'(V1, [16]) || V1 <- Tlv1]. 'dec_IPMAutoAdviseRegistrationParameter_advice-notifications_IPMSExtension'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- %% attribute type(1) with type OBJECT IDENTIFIER %%------------------------------------------------- [V1|Tlv2] = Tlv1, Term1 = decode_object_identifier(V1, [6]), %%------------------------------------------------- %% attribute value(2) with type typefieldType DEFAULT = 'NULL' %%------------------------------------------------- {Tmpterm1,Tlv3} = case Tlv2 of [V2|TempTlv3] -> {decode_open_type(V2, []), TempTlv3}; _ -> {'NULL',Tlv2} end, DecObjtypeTerm1 = 'IPMSAutoActionTypes':'getdec_internal_object_set_argument_18'(Term1), Term2 = case Tmpterm1 of 'NULL' ->'NULL'; _ -> case (catch DecObjtypeTerm1('Type', Tmpterm1, [])) of {'EXIT', Reason1} -> exit({'Type not compatible with table constraint',Reason1}); Tmpterm2 -> Tmpterm2 end end, case Tlv3 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed end, Res1 = {'IPMSExtension',Term1,Term2}, Res1. %%================================ %% AutoDiscardProblem %%================================ enc_AutoDiscardProblem(Val) -> enc_AutoDiscardProblem(Val, [<<2>>]). enc_AutoDiscardProblem(Val, TagIn) -> encode_integer(Val, [{'not-obsoleted-by-originator',0}], TagIn). dec_AutoDiscardProblem(Tlv) -> dec_AutoDiscardProblem(Tlv, [2]). dec_AutoDiscardProblem(Tlv, TagIn) -> begin Val1 = decode_integer(Tlv, TagIn), number2name(Val1, [{'not-obsoleted-by-originator',0}]) end . %%================================ %% EXTERNAL %%================================ enc_EXTERNAL(Val) -> enc_EXTERNAL(Val, [<<40>>]). enc_EXTERNAL(Val, TagIn) -> NewVal = transform_to_EXTERNAL1990(Val), {_,Cindex1,Cindex2,Cindex3,Cindex4} = NewVal, %%------------------------------------------------- %% attribute direct-reference(1) with type OBJECT IDENTIFIER OPTIONAL %%------------------------------------------------- {EncBytes1,EncLen1} = case Cindex1 of asn1_NOVALUE -> {<<>>,0}; _ -> encode_object_identifier(Cindex1, [<<6>>]) end, %%------------------------------------------------- %% attribute indirect-reference(2) with type INTEGER OPTIONAL %%------------------------------------------------- {EncBytes2,EncLen2} = case Cindex2 of asn1_NOVALUE -> {<<>>,0}; _ -> encode_integer(Cindex2, [<<2>>]) end, %%------------------------------------------------- %% attribute data-value-descriptor(3) with type ObjectDescriptor OPTIONAL %%------------------------------------------------- {EncBytes3,EncLen3} = case Cindex3 of asn1_NOVALUE -> {<<>>,0}; _ -> encode_restricted_string(Cindex3, [<<7>>]) end, %%------------------------------------------------- %% attribute encoding(4) with type CHOICE %%------------------------------------------------- {EncBytes4,EncLen4} = 'enc_EXTERNAL_encoding'(Cindex4, []), BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4], LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4, encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% EXTERNAL_encoding %%================================ enc_EXTERNAL_encoding(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of 'single-ASN1-type' -> encode_open_type(element(2,Val), [<<160>>]); 'octet-aligned' -> encode_restricted_string(element(2,Val), [<<129>>]); arbitrary -> encode_unnamed_bit_string(element(2,Val), [<<130>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, encode_tags(TagIn, EncBytes, EncLen). dec_EXTERNAL(Tlv) -> dec_EXTERNAL(Tlv, [8]). dec_EXTERNAL(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- %% attribute direct-reference(1) with type OBJECT IDENTIFIER OPTIONAL %%------------------------------------------------- {Term1,Tlv2} = case Tlv1 of [{6,V1}|TempTlv2] -> {decode_object_identifier(V1, []), TempTlv2}; _ -> { asn1_NOVALUE, Tlv1} end, %%------------------------------------------------- %% attribute indirect-reference(2) with type INTEGER OPTIONAL %%------------------------------------------------- {Term2,Tlv3} = case Tlv2 of [{2,V2}|TempTlv3] -> {decode_integer(V2, []), TempTlv3}; _ -> { asn1_NOVALUE, Tlv2} end, %%------------------------------------------------- %% attribute data-value-descriptor(3) with type ObjectDescriptor OPTIONAL %%------------------------------------------------- {Term3,Tlv4} = case Tlv3 of [{7,V3}|TempTlv4] -> {begin binary_to_list(decode_restricted_string(V3, [])) end , TempTlv4}; _ -> { asn1_NOVALUE, Tlv3} end, %%------------------------------------------------- %% attribute encoding(4) with type CHOICE %%------------------------------------------------- [V4|Tlv5] = Tlv4, Term4 = 'dec_EXTERNAL_encoding'(V4, []), case Tlv5 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv5}}}) % extra fields not allowed end, OldFormat={'EXTERNAL',Term1,Term2,Term3,Term4}, 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 . %%================================ %% ipm-auto-forward %%================================ 'enc_ipm-auto-forward'('RegistrationParameter', Val, _RestPrimFieldName) -> 'enc_ipm-auto-forward_RegistrationParameter'(Val,[]). %%================================ %% ipm-auto-forward_RegistrationParameter %%================================ 'enc_ipm-auto-forward_RegistrationParameter'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of 'ipm-auto-forward-registration-parameter' -> 'enc_IPMAutoForwardRegistrationParameter'(element(2,Val), [<<48>>]); 'auto-forward-registration-parameter-88' -> 'enc_AutoForwardRegistrationParameter88'(element(2,Val), [<<49>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, encode_tags(TagIn, EncBytes, EncLen). 'dec_ipm-auto-forward'('RegistrationParameter', Bytes,_) -> Tlv = tlv_format(Bytes), 'dec_ipm-auto-forward_RegistrationParameter'(Tlv,[]). 'dec_ipm-auto-forward_RegistrationParameter'(Tlv, TagIn) -> Tlv1 = match_tags(Tlv, TagIn), case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of %% 'ipm-auto-forward-registration-parameter' {16, V1} -> {'ipm-auto-forward-registration-parameter', 'dec_IPMAutoForwardRegistrationParameter'(V1, [])}; %% 'auto-forward-registration-parameter-88' {17, V1} -> {'auto-forward-registration-parameter-88', 'dec_AutoForwardRegistrationParameter88'(V1, [])}; Else -> exit({error,{asn1,{invalid_choice_tag,Else}}}) end . tlv_format(Bytes) when is_binary(Bytes) -> {Tlv,_} = ber_decode_nif(Bytes), Tlv; tlv_format(Bytes) -> Bytes. %%================================ %% ipm-auto-acknowledgement %%================================ 'enc_ipm-auto-acknowledgement'('RegistrationParameter', Val, _RestPrimFieldName) -> enc_IPMAutoAcknowledgementRegistrationParameter(Val, [<<49>>]). 'dec_ipm-auto-acknowledgement'('RegistrationParameter', Bytes,_) -> Tlv = tlv_format(Bytes), dec_IPMAutoAcknowledgementRegistrationParameter(Tlv, [17]). %%================================ %% ipm-auto-correlate %%================================ 'enc_ipm-auto-correlate'('RegistrationParameter', Val, _RestPrimFieldName) -> {Val,0}. 'dec_ipm-auto-correlate'('RegistrationParameter', Bytes,_) -> Bytes. %%================================ %% ipm-auto-discard %%================================ 'enc_ipm-auto-discard'('RegistrationParameter', Val, _RestPrimFieldName) -> enc_IPMAutoDiscardRegistrationParameter(Val, [<<49>>]). 'dec_ipm-auto-discard'('RegistrationParameter', Bytes,_) -> Tlv = tlv_format(Bytes), dec_IPMAutoDiscardRegistrationParameter(Tlv, [17]). %%================================ %% ipm-auto-advise %%================================ 'enc_ipm-auto-advise'('RegistrationParameter', Val, _RestPrimFieldName) -> enc_IPMAutoAdviseRegistrationParameter(Val, [<<49>>]). 'dec_ipm-auto-advise'('RegistrationParameter', Bytes,_) -> Tlv = tlv_format(Bytes), dec_IPMAutoAdviseRegistrationParameter(Tlv, [17]). %%================================ %% auto-forwarding-loop %%================================ 'enc_auto-forwarding-loop'('ParameterType', Val, _RestPrimFieldName) -> {Val,0}. 'dec_auto-forwarding-loop'('ParameterType', Bytes,_) -> Bytes. %%================================ %% duplicate-ipn %%================================ 'enc_duplicate-ipn'('ParameterType', Val, _RestPrimFieldName) -> {Val,0}. 'dec_duplicate-ipn'('ParameterType', Bytes,_) -> Bytes. %%================================ %% ipm-auto-discard-error %%================================ 'enc_ipm-auto-discard-error'('ParameterType', Val, _RestPrimFieldName) -> 'enc_ipm-auto-discard-error_ParameterType'(Val,[<<49>>]). %%================================ %% ipm-auto-discard-error_ParameterType %%================================ 'enc_ipm-auto-discard-error_ParameterType'(Val, TagIn) -> {_,Cindex1} = Val, %%------------------------------------------------- %% attribute problem(1) with type INTEGER %%------------------------------------------------- {EncBytes1,EncLen1} = encode_integer(Cindex1, [{'not-obsoleted-by-originator',0}], [<<2>>,<<160>>]), BytesSoFar = [EncBytes1], LenSoFar = EncLen1, encode_tags(TagIn, BytesSoFar, LenSoFar). 'dec_ipm-auto-discard-error'('ParameterType', Bytes,_) -> Tlv = tlv_format(Bytes), 'dec_ipm-auto-discard-error_ParameterType'(Tlv,[17]). 'dec_ipm-auto-discard-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 INTEGER %%------------------------------------------------- [V1|Tlv3] = Tlv2, Term1 = begin Val1 = decode_integer(V1, [131072,2]), number2name(Val1, [{'not-obsoleted-by-originator',0}]) end , case Tlv3 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed end, Res1 = {'ipm-auto-discard-error_ParameterType',Term1}, Res1. %%================================ %% IPMAutoActions %%================================ getenc_IPMAutoActions(Id) when Id =:= {2,6,1,15,0} -> fun 'enc_ipm-auto-acknowledgement'/3; getenc_IPMAutoActions(Id) when Id =:= {2,6,1,15,1} -> fun 'enc_ipm-auto-correlate'/3; getenc_IPMAutoActions(Id) when Id =:= {2,6,1,15,2} -> fun 'enc_ipm-auto-discard'/3; getenc_IPMAutoActions(Id) when Id =:= {2,6,1,15,3} -> fun 'enc_ipm-auto-advise'/3; getenc_IPMAutoActions(Id) when Id =:= {2,6,4,4,0} -> fun 'enc_ipm-auto-forward'/3; getenc_IPMAutoActions(_) -> fun(_, Val, _RestPrimFieldName) -> case Val of {asn1_OPENTYPE,Bin} when is_binary(Bin) -> {Bin,byte_size(Bin)} end end. getdec_IPMAutoActions(Id) when Id =:= {2,6,1,15,0} -> fun 'dec_ipm-auto-acknowledgement'/3; getdec_IPMAutoActions(Id) when Id =:= {2,6,1,15,1} -> fun 'dec_ipm-auto-correlate'/3; getdec_IPMAutoActions(Id) when Id =:= {2,6,1,15,2} -> fun 'dec_ipm-auto-discard'/3; getdec_IPMAutoActions(Id) when Id =:= {2,6,1,15,3} -> fun 'dec_ipm-auto-advise'/3; getdec_IPMAutoActions(Id) when Id =:= {2,6,4,4,0} -> fun 'dec_ipm-auto-forward'/3; getdec_IPMAutoActions(_) -> fun(_,Bytes, _RestPrimFieldName) -> case Bytes of Bin when is_binary(Bin) -> {asn1_OPENTYPE,Bin}; _ -> {asn1_OPENTYPE,ber_encode(Bytes)} end end. %%================================ %% IPMAutoActionErrorTable %%================================ getenc_IPMAutoActionErrorTable(Id) when Id =:= {global,{2,6,1,16,0}} -> fun 'enc_ipm-auto-discard-error'/3; getenc_IPMAutoActionErrorTable(Id) when Id =:= {global,{2,6,1,16,1}} -> fun 'enc_auto-forwarding-loop'/3; getenc_IPMAutoActionErrorTable(Id) when Id =:= {global,{2,6,1,16,2}} -> fun 'enc_duplicate-ipn'/3; getenc_IPMAutoActionErrorTable(Id) when Id =:= {local,1} -> fun(T,V,O) -> 'MTSAbstractService':'enc_submission-control-violated'(T,V,O) end; getenc_IPMAutoActionErrorTable(Id) when Id =:= {local,2} -> fun(T,V,O) -> 'MTSAbstractService':'enc_originator-invalid'(T,V,O) end; getenc_IPMAutoActionErrorTable(Id) when Id =:= {local,3} -> fun(T,V,O) -> 'MTSAbstractService':'enc_recipient-improperly-specified'(T,V,O) end; getenc_IPMAutoActionErrorTable(Id) when Id =:= {local,4} -> fun(T,V,O) -> 'MTSAbstractService':'enc_element-of-service-not-subscribed'(T,V,O) end; getenc_IPMAutoActionErrorTable(Id) when Id =:= {local,11} -> fun(T,V,O) -> 'MTSAbstractService':'enc_inconsistent-request'(T,V,O) end; getenc_IPMAutoActionErrorTable(Id) when Id =:= {local,12} -> fun(T,V,O) -> 'MTSAbstractService':'enc_security-error'(T,V,O) end; getenc_IPMAutoActionErrorTable(Id) when Id =:= {local,13} -> fun(T,V,O) -> 'MTSAbstractService':'enc_unsupported-critical-function'(T,V,O) end; getenc_IPMAutoActionErrorTable(Id) when Id =:= {local,15} -> fun(T,V,O) -> 'MTSAbstractService':'enc_remote-bind-error'(T,V,O) end; getenc_IPMAutoActionErrorTable(Id) when Id =:= {local,27} -> fun(T,V,O) -> 'MSAbstractService':'enc_service-error'(T,V,O) end; getenc_IPMAutoActionErrorTable(Id) when Id =:= {local,31} -> fun(T,V,O) -> 'MSAbstractService':'enc_ms-extension-error'(T,V,O) end; getenc_IPMAutoActionErrorTable(_) -> fun(_, Val, _RestPrimFieldName) -> case Val of {asn1_OPENTYPE,Bin} when is_binary(Bin) -> {Bin,byte_size(Bin)} end end. getdec_IPMAutoActionErrorTable(Id) when Id =:= {global,{2,6,1,16,0}} -> fun 'dec_ipm-auto-discard-error'/3; getdec_IPMAutoActionErrorTable(Id) when Id =:= {global,{2,6,1,16,1}} -> fun 'dec_auto-forwarding-loop'/3; getdec_IPMAutoActionErrorTable(Id) when Id =:= {global,{2,6,1,16,2}} -> fun 'dec_duplicate-ipn'/3; getdec_IPMAutoActionErrorTable(Id) when Id =:= {local,1} -> fun(T,V,O) -> 'MTSAbstractService':'dec_submission-control-violated'(T,V,O) end; getdec_IPMAutoActionErrorTable(Id) when Id =:= {local,2} -> fun(T,V,O) -> 'MTSAbstractService':'dec_originator-invalid'(T,V,O) end; getdec_IPMAutoActionErrorTable(Id) when Id =:= {local,3} -> fun(T,V,O) -> 'MTSAbstractService':'dec_recipient-improperly-specified'(T,V,O) end; getdec_IPMAutoActionErrorTable(Id) when Id =:= {local,4} -> fun(T,V,O) -> 'MTSAbstractService':'dec_element-of-service-not-subscribed'(T,V,O) end; getdec_IPMAutoActionErrorTable(Id) when Id =:= {local,11} -> fun(T,V,O) -> 'MTSAbstractService':'dec_inconsistent-request'(T,V,O) end; getdec_IPMAutoActionErrorTable(Id) when Id =:= {local,12} -> fun(T,V,O) -> 'MTSAbstractService':'dec_security-error'(T,V,O) end; getdec_IPMAutoActionErrorTable(Id) when Id =:= {local,13} -> fun(T,V,O) -> 'MTSAbstractService':'dec_unsupported-critical-function'(T,V,O) end; getdec_IPMAutoActionErrorTable(Id) when Id =:= {local,15} -> fun(T,V,O) -> 'MTSAbstractService':'dec_remote-bind-error'(T,V,O) end; getdec_IPMAutoActionErrorTable(Id) when Id =:= {local,27} -> fun(T,V,O) -> 'MSAbstractService':'dec_service-error'(T,V,O) end; getdec_IPMAutoActionErrorTable(Id) when Id =:= {local,31} -> fun(T,V,O) -> 'MSAbstractService':'dec_ms-extension-error'(T,V,O) end; getdec_IPMAutoActionErrorTable(_) -> fun(_,Bytes, _RestPrimFieldName) -> case Bytes of Bin when is_binary(Bin) -> {asn1_OPENTYPE,Bin}; _ -> {asn1_OPENTYPE,ber_encode(Bytes)} end end. %%================================ %% internal_object_set_argument_18 %%================================ getenc_internal_object_set_argument_18(Id) when Id =:= {2,6,1,19,0} -> fun(T,V,O) -> 'IPMSInformationObjects':'enc_absence-advice'(T,V,O) end; getenc_internal_object_set_argument_18(Id) when Id =:= {2,6,1,19,1} -> fun(T,V,O) -> 'IPMSInformationObjects':'enc_change-of-address-advice'(T,V,O) end; getenc_internal_object_set_argument_18(_) -> fun(_, Val, _RestPrimFieldName) -> case Val of {asn1_OPENTYPE,Bin} when is_binary(Bin) -> {Bin,byte_size(Bin)} end end. getdec_internal_object_set_argument_18(Id) when Id =:= {2,6,1,19,0} -> fun(T,V,O) -> 'IPMSInformationObjects':'dec_absence-advice'(T,V,O) end; getdec_internal_object_set_argument_18(Id) when Id =:= {2,6,1,19,1} -> fun(T,V,O) -> 'IPMSInformationObjects':'dec_change-of-address-advice'(T,V,O) end; getdec_internal_object_set_argument_18(_) -> fun(_,Bytes, _RestPrimFieldName) -> case Bytes of Bin when is_binary(Bin) -> {asn1_OPENTYPE,Bin}; _ -> {asn1_OPENTYPE,ber_encode(Bytes)} end end. %%================================ %% internal_object_set_argument_17 %%================================ getenc_internal_object_set_argument_17(Id) when Id =:= {'standard-extension',1} -> fun(T,V,O) -> 'MTSAbstractService':'enc_recipient-reassignment-prohibited'(T,V,O) end; getenc_internal_object_set_argument_17(Id) when Id =:= {'standard-extension',3} -> fun(T,V,O) -> 'MTSAbstractService':'enc_dl-expansion-prohibited'(T,V,O) end; getenc_internal_object_set_argument_17(Id) when Id =:= {'standard-extension',4} -> fun(T,V,O) -> 'MTSAbstractService':'enc_conversion-with-loss-prohibited'(T,V,O) end; getenc_internal_object_set_argument_17(Id) when Id =:= {'standard-extension',5} -> fun(T,V,O) -> 'MTSAbstractService':'enc_latest-delivery-time'(T,V,O) end; getenc_internal_object_set_argument_17(Id) when Id =:= {'standard-extension',13} -> fun(T,V,O) -> 'MTSAbstractService':'enc_originator-return-address'(T,V,O) end; getenc_internal_object_set_argument_17(Id) when Id =:= {'standard-extension',15} -> fun(T,V,O) -> 'MTSAbstractService':'enc_originator-certificate'(T,V,O) end; getenc_internal_object_set_argument_17(Id) when Id =:= {'standard-extension',17} -> fun(T,V,O) -> 'MTSAbstractService':'enc_content-confidentiality-algorithm-identifier'(T,V,O) end; getenc_internal_object_set_argument_17(Id) when Id =:= {'standard-extension',19} -> fun(T,V,O) -> 'MTSAbstractService':'enc_message-origin-authentication-check'(T,V,O) end; getenc_internal_object_set_argument_17(Id) when Id =:= {'standard-extension',20} -> fun(T,V,O) -> 'MTSAbstractService':'enc_message-security-label'(T,V,O) end; getenc_internal_object_set_argument_17(Id) when Id =:= {'standard-extension',21} -> fun(T,V,O) -> 'MTSAbstractService':'enc_proof-of-submission-request'(T,V,O) end; getenc_internal_object_set_argument_17(Id) when Id =:= {'standard-extension',23} -> fun(T,V,O) -> 'MTSAbstractService':'enc_content-correlator'(T,V,O) end; getenc_internal_object_set_argument_17(Id) when Id =:= {'standard-extension',36} -> fun(T,V,O) -> 'MSAbstractService':'enc_forwarding-request'(T,V,O) end; getenc_internal_object_set_argument_17(Id) when Id =:= {'standard-extension',40} -> fun(T,V,O) -> 'MTSAbstractService':'enc_multiple-originator-certificates'(T,V,O) end; getenc_internal_object_set_argument_17(Id) when Id =:= {'standard-extension',42} -> fun(T,V,O) -> 'MTSAbstractService':'enc_dl-exempted-recipients'(T,V,O) end; getenc_internal_object_set_argument_17(Id) when Id =:= {'standard-extension',45} -> fun(T,V,O) -> 'MTSAbstractService':'enc_certificate-selectors'(T,V,O) end; getenc_internal_object_set_argument_17(_) -> fun(_, Val, _RestPrimFieldName) -> case Val of {asn1_OPENTYPE,Bin} when is_binary(Bin) -> {Bin,byte_size(Bin)} end end. getdec_internal_object_set_argument_17(Id) when Id =:= {'standard-extension',1} -> fun(T,V,O) -> 'MTSAbstractService':'dec_recipient-reassignment-prohibited'(T,V,O) end; getdec_internal_object_set_argument_17(Id) when Id =:= {'standard-extension',3} -> fun(T,V,O) -> 'MTSAbstractService':'dec_dl-expansion-prohibited'(T,V,O) end; getdec_internal_object_set_argument_17(Id) when Id =:= {'standard-extension',4} -> fun(T,V,O) -> 'MTSAbstractService':'dec_conversion-with-loss-prohibited'(T,V,O) end; getdec_internal_object_set_argument_17(Id) when Id =:= {'standard-extension',5} -> fun(T,V,O) -> 'MTSAbstractService':'dec_latest-delivery-time'(T,V,O) end; getdec_internal_object_set_argument_17(Id) when Id =:= {'standard-extension',13} -> fun(T,V,O) -> 'MTSAbstractService':'dec_originator-return-address'(T,V,O) end; getdec_internal_object_set_argument_17(Id) when Id =:= {'standard-extension',15} -> fun(T,V,O) -> 'MTSAbstractService':'dec_originator-certificate'(T,V,O) end; getdec_internal_object_set_argument_17(Id) when Id =:= {'standard-extension',17} -> fun(T,V,O) -> 'MTSAbstractService':'dec_content-confidentiality-algorithm-identifier'(T,V,O) end; getdec_internal_object_set_argument_17(Id) when Id =:= {'standard-extension',19} -> fun(T,V,O) -> 'MTSAbstractService':'dec_message-origin-authentication-check'(T,V,O) end; getdec_internal_object_set_argument_17(Id) when Id =:= {'standard-extension',20} -> fun(T,V,O) -> 'MTSAbstractService':'dec_message-security-label'(T,V,O) end; getdec_internal_object_set_argument_17(Id) when Id =:= {'standard-extension',21} -> fun(T,V,O) -> 'MTSAbstractService':'dec_proof-of-submission-request'(T,V,O) end; getdec_internal_object_set_argument_17(Id) when Id =:= {'standard-extension',23} -> fun(T,V,O) -> 'MTSAbstractService':'dec_content-correlator'(T,V,O) end; getdec_internal_object_set_argument_17(Id) when Id =:= {'standard-extension',36} -> fun(T,V,O) -> 'MSAbstractService':'dec_forwarding-request'(T,V,O) end; getdec_internal_object_set_argument_17(Id) when Id =:= {'standard-extension',40} -> fun(T,V,O) -> 'MTSAbstractService':'dec_multiple-originator-certificates'(T,V,O) end; getdec_internal_object_set_argument_17(Id) when Id =:= {'standard-extension',42} -> fun(T,V,O) -> 'MTSAbstractService':'dec_dl-exempted-recipients'(T,V,O) end; getdec_internal_object_set_argument_17(Id) when Id =:= {'standard-extension',45} -> fun(T,V,O) -> 'MTSAbstractService':'dec_certificate-selectors'(T,V,O) end; getdec_internal_object_set_argument_17(_) -> fun(_,Bytes, _RestPrimFieldName) -> case Bytes of Bin when is_binary(Bin) -> {asn1_OPENTYPE,Bin}; _ -> {asn1_OPENTYPE,ber_encode(Bytes)} end end. %%================================ %% internal_object_set_argument_16 %%================================ getenc_internal_object_set_argument_16(Id) when Id =:= {'standard-extension',2} -> fun(T,V,O) -> 'MTSAbstractService':'enc_originator-requested-alternate-recipient'(T,V,O) end; getenc_internal_object_set_argument_16(Id) when Id =:= {'standard-extension',6} -> fun(T,V,O) -> 'MTSAbstractService':'enc_requested-delivery-method'(T,V,O) end; getenc_internal_object_set_argument_16(Id) when Id =:= {'standard-extension',7} -> fun(T,V,O) -> 'MTSAbstractService':'enc_physical-forwarding-prohibited'(T,V,O) end; getenc_internal_object_set_argument_16(Id) when Id =:= {'standard-extension',8} -> fun(T,V,O) -> 'MTSAbstractService':'enc_physical-forwarding-address-request'(T,V,O) end; getenc_internal_object_set_argument_16(Id) when Id =:= {'standard-extension',9} -> fun(T,V,O) -> 'MTSAbstractService':'enc_physical-delivery-modes'(T,V,O) end; getenc_internal_object_set_argument_16(Id) when Id =:= {'standard-extension',10} -> fun(T,V,O) -> 'MTSAbstractService':'enc_registered-mail-type'(T,V,O) end; getenc_internal_object_set_argument_16(Id) when Id =:= {'standard-extension',11} -> fun(T,V,O) -> 'MTSAbstractService':'enc_recipient-number-for-advice'(T,V,O) end; getenc_internal_object_set_argument_16(Id) when Id =:= {'standard-extension',12} -> fun(T,V,O) -> 'MTSAbstractService':'enc_physical-rendition-attributes'(T,V,O) end; getenc_internal_object_set_argument_16(Id) when Id =:= {'standard-extension',14} -> fun(T,V,O) -> 'MTSAbstractService':'enc_physical-delivery-report-request'(T,V,O) end; getenc_internal_object_set_argument_16(Id) when Id =:= {'standard-extension',16} -> fun(T,V,O) -> 'MTSAbstractService':'enc_message-token'(T,V,O) end; getenc_internal_object_set_argument_16(Id) when Id =:= {'standard-extension',18} -> fun(T,V,O) -> 'MTSAbstractService':'enc_content-integrity-check'(T,V,O) end; getenc_internal_object_set_argument_16(Id) when Id =:= {'standard-extension',22} -> fun(T,V,O) -> 'MTSAbstractService':'enc_proof-of-delivery-request'(T,V,O) end; getenc_internal_object_set_argument_16(Id) when Id =:= {'standard-extension',28} -> fun(T,V,O) -> 'MTSAbstractService':'enc_recipient-certificate'(T,V,O) end; getenc_internal_object_set_argument_16(Id) when Id =:= {'standard-extension',41} -> fun(T,V,O) -> 'IPMSInformationObjects':'enc_blind-copy-recipients'(T,V,O) end; getenc_internal_object_set_argument_16(Id) when Id =:= {'standard-extension',43} -> fun(T,V,O) -> 'IPMSSecurityExtensions':'enc_body-part-encryption-token'(T,V,O) end; getenc_internal_object_set_argument_16(Id) when Id =:= {'standard-extension',44} -> fun(T,V,O) -> 'IPMSSecurityExtensions':'enc_forwarded-content-token'(T,V,O) end; getenc_internal_object_set_argument_16(Id) when Id =:= {'standard-extension',46} -> fun(T,V,O) -> 'MTSAbstractService':'enc_certificate-selectors-override'(T,V,O) end; getenc_internal_object_set_argument_16(_) -> fun(_, Val, _RestPrimFieldName) -> case Val of {asn1_OPENTYPE,Bin} when is_binary(Bin) -> {Bin,byte_size(Bin)} end end. getdec_internal_object_set_argument_16(Id) when Id =:= {'standard-extension',2} -> fun(T,V,O) -> 'MTSAbstractService':'dec_originator-requested-alternate-recipient'(T,V,O) end; getdec_internal_object_set_argument_16(Id) when Id =:= {'standard-extension',6} -> fun(T,V,O) -> 'MTSAbstractService':'dec_requested-delivery-method'(T,V,O) end; getdec_internal_object_set_argument_16(Id) when Id =:= {'standard-extension',7} -> fun(T,V,O) -> 'MTSAbstractService':'dec_physical-forwarding-prohibited'(T,V,O) end; getdec_internal_object_set_argument_16(Id) when Id =:= {'standard-extension',8} -> fun(T,V,O) -> 'MTSAbstractService':'dec_physical-forwarding-address-request'(T,V,O) end; getdec_internal_object_set_argument_16(Id) when Id =:= {'standard-extension',9} -> fun(T,V,O) -> 'MTSAbstractService':'dec_physical-delivery-modes'(T,V,O) end; getdec_internal_object_set_argument_16(Id) when Id =:= {'standard-extension',10} -> fun(T,V,O) -> 'MTSAbstractService':'dec_registered-mail-type'(T,V,O) end; getdec_internal_object_set_argument_16(Id) when Id =:= {'standard-extension',11} -> fun(T,V,O) -> 'MTSAbstractService':'dec_recipient-number-for-advice'(T,V,O) end; getdec_internal_object_set_argument_16(Id) when Id =:= {'standard-extension',12} -> fun(T,V,O) -> 'MTSAbstractService':'dec_physical-rendition-attributes'(T,V,O) end; getdec_internal_object_set_argument_16(Id) when Id =:= {'standard-extension',14} -> fun(T,V,O) -> 'MTSAbstractService':'dec_physical-delivery-report-request'(T,V,O) end; getdec_internal_object_set_argument_16(Id) when Id =:= {'standard-extension',16} -> fun(T,V,O) -> 'MTSAbstractService':'dec_message-token'(T,V,O) end; getdec_internal_object_set_argument_16(Id) when Id =:= {'standard-extension',18} -> fun(T,V,O) -> 'MTSAbstractService':'dec_content-integrity-check'(T,V,O) end; getdec_internal_object_set_argument_16(Id) when Id =:= {'standard-extension',22} -> fun(T,V,O) -> 'MTSAbstractService':'dec_proof-of-delivery-request'(T,V,O) end; getdec_internal_object_set_argument_16(Id) when Id =:= {'standard-extension',28} -> fun(T,V,O) -> 'MTSAbstractService':'dec_recipient-certificate'(T,V,O) end; getdec_internal_object_set_argument_16(Id) when Id =:= {'standard-extension',41} -> fun(T,V,O) -> 'IPMSInformationObjects':'dec_blind-copy-recipients'(T,V,O) end; getdec_internal_object_set_argument_16(Id) when Id =:= {'standard-extension',43} -> fun(T,V,O) -> 'IPMSSecurityExtensions':'dec_body-part-encryption-token'(T,V,O) end; getdec_internal_object_set_argument_16(Id) when Id =:= {'standard-extension',44} -> fun(T,V,O) -> 'IPMSSecurityExtensions':'dec_forwarded-content-token'(T,V,O) end; getdec_internal_object_set_argument_16(Id) when Id =:= {'standard-extension',46} -> fun(T,V,O) -> 'MTSAbstractService':'dec_certificate-selectors-override'(T,V,O) end; getdec_internal_object_set_argument_16(_) -> fun(_,Bytes, _RestPrimFieldName) -> case Bytes of Bin when is_binary(Bin) -> {asn1_OPENTYPE,Bin}; _ -> {asn1_OPENTYPE,ber_encode(Bytes)} end end. %%================================ %% internal_object_set_argument_15 %%================================ getenc_internal_object_set_argument_15(Id) when Id =:= {'standard-extension',1} -> fun(T,V,O) -> 'MTSAbstractService':'enc_recipient-reassignment-prohibited'(T,V,O) end; getenc_internal_object_set_argument_15(Id) when Id =:= {'standard-extension',3} -> fun(T,V,O) -> 'MTSAbstractService':'enc_dl-expansion-prohibited'(T,V,O) end; getenc_internal_object_set_argument_15(Id) when Id =:= {'standard-extension',4} -> fun(T,V,O) -> 'MTSAbstractService':'enc_conversion-with-loss-prohibited'(T,V,O) end; getenc_internal_object_set_argument_15(Id) when Id =:= {'standard-extension',5} -> fun(T,V,O) -> 'MTSAbstractService':'enc_latest-delivery-time'(T,V,O) end; getenc_internal_object_set_argument_15(Id) when Id =:= {'standard-extension',13} -> fun(T,V,O) -> 'MTSAbstractService':'enc_originator-return-address'(T,V,O) end; getenc_internal_object_set_argument_15(Id) when Id =:= {'standard-extension',15} -> fun(T,V,O) -> 'MTSAbstractService':'enc_originator-certificate'(T,V,O) end; getenc_internal_object_set_argument_15(Id) when Id =:= {'standard-extension',17} -> fun(T,V,O) -> 'MTSAbstractService':'enc_content-confidentiality-algorithm-identifier'(T,V,O) end; getenc_internal_object_set_argument_15(Id) when Id =:= {'standard-extension',19} -> fun(T,V,O) -> 'MTSAbstractService':'enc_message-origin-authentication-check'(T,V,O) end; getenc_internal_object_set_argument_15(Id) when Id =:= {'standard-extension',20} -> fun(T,V,O) -> 'MTSAbstractService':'enc_message-security-label'(T,V,O) end; getenc_internal_object_set_argument_15(Id) when Id =:= {'standard-extension',21} -> fun(T,V,O) -> 'MTSAbstractService':'enc_proof-of-submission-request'(T,V,O) end; getenc_internal_object_set_argument_15(Id) when Id =:= {'standard-extension',23} -> fun(T,V,O) -> 'MTSAbstractService':'enc_content-correlator'(T,V,O) end; getenc_internal_object_set_argument_15(Id) when Id =:= {'standard-extension',36} -> fun(T,V,O) -> 'MSAbstractService':'enc_forwarding-request'(T,V,O) end; getenc_internal_object_set_argument_15(Id) when Id =:= {'standard-extension',40} -> fun(T,V,O) -> 'MTSAbstractService':'enc_multiple-originator-certificates'(T,V,O) end; getenc_internal_object_set_argument_15(Id) when Id =:= {'standard-extension',42} -> fun(T,V,O) -> 'MTSAbstractService':'enc_dl-exempted-recipients'(T,V,O) end; getenc_internal_object_set_argument_15(Id) when Id =:= {'standard-extension',45} -> fun(T,V,O) -> 'MTSAbstractService':'enc_certificate-selectors'(T,V,O) end; getenc_internal_object_set_argument_15(_) -> fun(_, Val, _RestPrimFieldName) -> case Val of {asn1_OPENTYPE,Bin} when is_binary(Bin) -> {Bin,byte_size(Bin)} end end. getdec_internal_object_set_argument_15(Id) when Id =:= {'standard-extension',1} -> fun(T,V,O) -> 'MTSAbstractService':'dec_recipient-reassignment-prohibited'(T,V,O) end; getdec_internal_object_set_argument_15(Id) when Id =:= {'standard-extension',3} -> fun(T,V,O) -> 'MTSAbstractService':'dec_dl-expansion-prohibited'(T,V,O) end; getdec_internal_object_set_argument_15(Id) when Id =:= {'standard-extension',4} -> fun(T,V,O) -> 'MTSAbstractService':'dec_conversion-with-loss-prohibited'(T,V,O) end; getdec_internal_object_set_argument_15(Id) when Id =:= {'standard-extension',5} -> fun(T,V,O) -> 'MTSAbstractService':'dec_latest-delivery-time'(T,V,O) end; getdec_internal_object_set_argument_15(Id) when Id =:= {'standard-extension',13} -> fun(T,V,O) -> 'MTSAbstractService':'dec_originator-return-address'(T,V,O) end; getdec_internal_object_set_argument_15(Id) when Id =:= {'standard-extension',15} -> fun(T,V,O) -> 'MTSAbstractService':'dec_originator-certificate'(T,V,O) end; getdec_internal_object_set_argument_15(Id) when Id =:= {'standard-extension',17} -> fun(T,V,O) -> 'MTSAbstractService':'dec_content-confidentiality-algorithm-identifier'(T,V,O) end; getdec_internal_object_set_argument_15(Id) when Id =:= {'standard-extension',19} -> fun(T,V,O) -> 'MTSAbstractService':'dec_message-origin-authentication-check'(T,V,O) end; getdec_internal_object_set_argument_15(Id) when Id =:= {'standard-extension',20} -> fun(T,V,O) -> 'MTSAbstractService':'dec_message-security-label'(T,V,O) end; getdec_internal_object_set_argument_15(Id) when Id =:= {'standard-extension',21} -> fun(T,V,O) -> 'MTSAbstractService':'dec_proof-of-submission-request'(T,V,O) end; getdec_internal_object_set_argument_15(Id) when Id =:= {'standard-extension',23} -> fun(T,V,O) -> 'MTSAbstractService':'dec_content-correlator'(T,V,O) end; getdec_internal_object_set_argument_15(Id) when Id =:= {'standard-extension',36} -> fun(T,V,O) -> 'MSAbstractService':'dec_forwarding-request'(T,V,O) end; getdec_internal_object_set_argument_15(Id) when Id =:= {'standard-extension',40} -> fun(T,V,O) -> 'MTSAbstractService':'dec_multiple-originator-certificates'(T,V,O) end; getdec_internal_object_set_argument_15(Id) when Id =:= {'standard-extension',42} -> fun(T,V,O) -> 'MTSAbstractService':'dec_dl-exempted-recipients'(T,V,O) end; getdec_internal_object_set_argument_15(Id) when Id =:= {'standard-extension',45} -> fun(T,V,O) -> 'MTSAbstractService':'dec_certificate-selectors'(T,V,O) end; getdec_internal_object_set_argument_15(_) -> 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_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_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(Size, [FirstVal | RestVal], NamedBitList, TagIn) -> ToSetPos = get_all_bitposes([FirstVal | RestVal], NamedBitList, []), BitList = make_and_set_list(Size, ToSetPos, 0), {Len, Unused, OctetList} = encode_bitstring(BitList), encode_tags(TagIn, [Unused | OctetList], Len + 1). 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_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, 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(C, [H | _] = Bits, NamedBitList, TagIn) when is_atom(H) -> do_encode_named_bit_string(C, Bits, NamedBitList, TagIn); encode_named_bit_string(C, [{bit, _} | _] = Bits, NamedBitList, TagIn) -> do_encode_named_bit_string(C, Bits, NamedBitList, TagIn); encode_named_bit_string(C, [], _NamedBitList, TagIn) -> encode_unnamed_bit_string(C, <<>>, TagIn); encode_named_bit_string(C, Bits, _NamedBitList, TagIn) when is_bitstring(Bits) -> encode_unnamed_bit_string(C, Bits, TagIn). 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([], _NamedBitList, TagIn) -> encode_unnamed_bit_string(<<>>, 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)). encode_unnamed_bit_string(MaxBits, Bits, TagIn) -> NumBits = bit_size(Bits), Unused = (8 - NumBits band 7) band 7, Bin = <>, if NumBits > MaxBits -> exit({error, {asn1, {bitstring_length, {{was, NumBits}, {maximum, MaxBits}}}}}); true -> encode_tags(TagIn, Bin, byte_size(Bin)) end. 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. 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).