%% Generated by the Erlang ASN.1 BER compiler. Version: 5.3.1 %% Purpose: Encoding and decoding of the types in InformationFramework. -module('InformationFramework'). -moduledoc false. -compile(nowarn_unused_vars). -dialyzer(no_improper_lists). -dialyzer(no_match). -include_lib("ca/include/InformationFramework.hrl"). -asn1_info([{vsn,'5.3.1'}, {module,'InformationFramework'}, {options,[warnings,ber,errors, {cwd,"/Users/5ht/depot/arvo-computer/ca/priv/csr"}, {outdir,"/Users/5ht/depot/arvo-computer/ca/priv/csr"}, {i,"."}, {i,"/Users/5ht/depot/arvo-computer/ca/priv/csr"}]}]). -export([encoding_rule/0,maps/0,bit_string_format/0, legacy_erlang_types/0]). -export(['dialyzer-suppressions'/1]). -export([ enc_Attribute/2, enc_AttributeType/2, enc_AttributeValue/2, enc_Context/2, enc_AttributeValueAssertion/2, enc_ContextAssertion/2, enc_AttributeTypeAssertion/2, enc_Name/2, enc_RDNSequence/2, enc_DistinguishedName/2, enc_RelativeDistinguishedName/2, enc_AttributeTypeX/2, enc_AttributeValueX/2, enc_AttributeTypeAndValue/2, enc_AttributeTypeAndDistinguishedValue/2, enc_SubtreeSpecification/2, enc_LocalName/2, enc_ChopSpecification/2, enc_BaseDistance/2, enc_Refinement/2, enc_ObjectClassKind/2, enc_AttributeUsage/2, enc_DITStructureRule/2, enc_RuleIdentifier/2, enc_DITContentRule/2, enc_DITContextUse/2, enc_SearchRuleDescription/2, enc_SearchRule/2, enc_SearchRuleId/2, enc_AllowedSubset/2, enc_ImposedSubset/2, enc_RequestAttribute/2, enc_ContextProfile/2, enc_ContextCombination/2, enc_MatchingUse/2, enc_AttributeCombination/2, enc_ResultAttribute/2, enc_OutputValues/2, enc_ControlOptions/2, enc_EntryLimit/2, enc_RelaxationPolicy/2, enc_MRMapping/2, enc_Mapping/2, enc_MRSubstitution/2, enc_subentryNameForm_DirectoryString/2, enc_subentry_DirectoryString/2 ]). -export([ dec_Attribute/2, dec_AttributeType/2, dec_AttributeValue/2, dec_Context/2, dec_AttributeValueAssertion/2, dec_ContextAssertion/2, dec_AttributeTypeAssertion/2, dec_Name/2, dec_RDNSequence/2, dec_DistinguishedName/2, dec_RelativeDistinguishedName/2, dec_AttributeTypeX/2, dec_AttributeValueX/2, dec_AttributeTypeAndValue/2, dec_AttributeTypeAndDistinguishedValue/2, dec_SubtreeSpecification/2, dec_LocalName/2, dec_ChopSpecification/2, dec_BaseDistance/2, dec_Refinement/2, dec_ObjectClassKind/2, dec_AttributeUsage/2, dec_DITStructureRule/2, dec_RuleIdentifier/2, dec_DITContentRule/2, dec_DITContextUse/2, dec_SearchRuleDescription/2, dec_SearchRule/2, dec_SearchRuleId/2, dec_AllowedSubset/2, dec_ImposedSubset/2, dec_RequestAttribute/2, dec_ContextProfile/2, dec_ContextCombination/2, dec_MatchingUse/2, dec_AttributeCombination/2, dec_ResultAttribute/2, dec_OutputValues/2, dec_ControlOptions/2, dec_EntryLimit/2, dec_RelaxationPolicy/2, dec_MRMapping/2, dec_Mapping/2, dec_MRSubstitution/2, dec_subentryNameForm_DirectoryString/2, dec_subentry_DirectoryString/2 ]). -export([ enc_objectClass/3, enc_aliasedEntryName/3, enc_objectIdentifierMatch/3, enc_distinguishedNameMatch/3, enc_createTimestamp/3, enc_modifyTimestamp/3, enc_subschemaTimestamp/3, enc_creatorsName/3, enc_modifiersName/3, enc_subschemaSubentryList/3, enc_accessControlSubentryList/3, enc_collectiveAttributeSubentryList/3, enc_contextDefaultSubentryList/3, enc_serviceAdminSubentryList/3, enc_hasSubordinates/3, enc_administrativeRole/3, enc_subtreeSpecification/3, enc_collectiveExclusions/3, enc_contextAssertionDefaults/3, enc_searchRules/3, enc_hierarchyLevel/3, enc_hierarchyBelow/3, enc_hierarchyParent/3 ]). -export([ dec_objectClass/3, dec_aliasedEntryName/3, dec_objectIdentifierMatch/3, dec_distinguishedNameMatch/3, dec_createTimestamp/3, dec_modifyTimestamp/3, dec_subschemaTimestamp/3, dec_creatorsName/3, dec_modifiersName/3, dec_subschemaSubentryList/3, dec_accessControlSubentryList/3, dec_collectiveAttributeSubentryList/3, dec_contextDefaultSubentryList/3, dec_serviceAdminSubentryList/3, dec_hasSubordinates/3, dec_administrativeRole/3, dec_subtreeSpecification/3, dec_collectiveExclusions/3, dec_contextAssertionDefaults/3, dec_searchRules/3, dec_hierarchyLevel/3, dec_hierarchyBelow/3, dec_hierarchyParent/3 ]). -export([ getenc_SupportedAttributes/1, getenc_SupportedContexts/1, getenc_SupportedMatchingRestrictions/1 ]). -export([ getdec_SupportedAttributes/1, getdec_SupportedContexts/1, getdec_SupportedMatchingRestrictions/1 ]). -export([ 'id-oc-top'/0, 'id-oc-alias'/0, 'id-oc-parent'/0, 'id-oc-child'/0, 'id-at-objectClass'/0, 'id-at-aliasedEntryName'/0, 'id-mr-objectIdentifierMatch'/0, 'id-mr-distinguishedNameMatch'/0, 'id-oa-excludeAllCollectiveAttributes'/0, 'id-oa-createTimestamp'/0, 'id-oa-modifyTimestamp'/0, 'id-oa-creatorsName'/0, 'id-oa-modifiersName'/0, 'id-oa-administrativeRole'/0, 'id-oa-subtreeSpecification'/0, 'id-oa-collectiveExclusions'/0, 'id-oa-subschemaTimestamp'/0, 'id-oa-hasSubordinates'/0, 'id-oa-subschemaSubentryList'/0, 'id-oa-accessControlSubentryList'/0, 'id-oa-collectiveAttributeSubentryList'/0, 'id-oa-contextDefaultSubentryList'/0, 'id-oa-contextAssertionDefault'/0, 'id-oa-serviceAdminSubentryList'/0, 'id-oa-searchRules'/0, 'id-oa-hierarchyLevel'/0, 'id-oa-hierarchyBelow'/0, 'id-oa-hierarchyParent'/0, 'id-sc-subentry'/0, 'id-sc-accessControlSubentry'/0, 'id-sc-collectiveAttributeSubentry'/0, 'id-sc-contextAssertionSubentry'/0, 'id-sc-serviceAdminSubentry'/0, 'id-nf-subentryNameForm'/0, 'id-ar-autonomousArea'/0, 'id-ar-accessControlSpecificArea'/0, 'id-ar-accessControlInnerArea'/0, 'id-ar-subschemaAdminSpecificArea'/0, 'id-ar-collectiveAttributeSpecificArea'/0, 'id-ar-collectiveAttributeInnerArea'/0, 'id-ar-contextDefaultSpecificArea'/0, 'id-ar-serviceSpecificArea'/0, 'id-at'/0, 'id-at-countryName'/0, 'id-at-organizationName'/0, 'id-at-serialNumber'/0, 'id-at-stateOrProvinceName'/0, 'id-at-localityName'/0, 'id-at-commonName'/0, 'id-at-organizationalUnitName'/0 ]). -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('Attribute', Data) -> enc_Attribute(Data); encode_disp('AttributeType', Data) -> enc_AttributeType(Data); encode_disp('AttributeValue', Data) -> enc_AttributeValue(Data); encode_disp('Context', Data) -> enc_Context(Data); encode_disp('AttributeValueAssertion', Data) -> enc_AttributeValueAssertion(Data); encode_disp('ContextAssertion', Data) -> enc_ContextAssertion(Data); encode_disp('AttributeTypeAssertion', Data) -> enc_AttributeTypeAssertion(Data); encode_disp('Name', Data) -> enc_Name(Data); encode_disp('RDNSequence', Data) -> enc_RDNSequence(Data); encode_disp('DistinguishedName', Data) -> enc_DistinguishedName(Data); encode_disp('RelativeDistinguishedName', Data) -> enc_RelativeDistinguishedName(Data); encode_disp('AttributeTypeX', Data) -> enc_AttributeTypeX(Data); encode_disp('AttributeValueX', Data) -> enc_AttributeValueX(Data); encode_disp('AttributeTypeAndValue', Data) -> enc_AttributeTypeAndValue(Data); encode_disp('AttributeTypeAndDistinguishedValue', Data) -> enc_AttributeTypeAndDistinguishedValue(Data); encode_disp('SubtreeSpecification', Data) -> enc_SubtreeSpecification(Data); encode_disp('LocalName', Data) -> enc_LocalName(Data); encode_disp('ChopSpecification', Data) -> enc_ChopSpecification(Data); encode_disp('BaseDistance', Data) -> enc_BaseDistance(Data); encode_disp('Refinement', Data) -> enc_Refinement(Data); encode_disp('ObjectClassKind', Data) -> enc_ObjectClassKind(Data); encode_disp('AttributeUsage', Data) -> enc_AttributeUsage(Data); encode_disp('DITStructureRule', Data) -> enc_DITStructureRule(Data); encode_disp('RuleIdentifier', Data) -> enc_RuleIdentifier(Data); encode_disp('DITContentRule', Data) -> enc_DITContentRule(Data); encode_disp('DITContextUse', Data) -> enc_DITContextUse(Data); encode_disp('SearchRuleDescription', Data) -> enc_SearchRuleDescription(Data); encode_disp('SearchRule', Data) -> enc_SearchRule(Data); encode_disp('SearchRuleId', Data) -> enc_SearchRuleId(Data); encode_disp('AllowedSubset', Data) -> enc_AllowedSubset(Data); encode_disp('ImposedSubset', Data) -> enc_ImposedSubset(Data); encode_disp('RequestAttribute', Data) -> enc_RequestAttribute(Data); encode_disp('ContextProfile', Data) -> enc_ContextProfile(Data); encode_disp('ContextCombination', Data) -> enc_ContextCombination(Data); encode_disp('MatchingUse', Data) -> enc_MatchingUse(Data); encode_disp('AttributeCombination', Data) -> enc_AttributeCombination(Data); encode_disp('ResultAttribute', Data) -> enc_ResultAttribute(Data); encode_disp('OutputValues', Data) -> enc_OutputValues(Data); encode_disp('ControlOptions', Data) -> enc_ControlOptions(Data); encode_disp('EntryLimit', Data) -> enc_EntryLimit(Data); encode_disp('RelaxationPolicy', Data) -> enc_RelaxationPolicy(Data); encode_disp('MRMapping', Data) -> enc_MRMapping(Data); encode_disp('Mapping', Data) -> enc_Mapping(Data); encode_disp('MRSubstitution', Data) -> enc_MRSubstitution(Data); encode_disp(subentryNameForm_DirectoryString, Data) -> enc_subentryNameForm_DirectoryString(Data); encode_disp(subentry_DirectoryString, Data) -> enc_subentry_DirectoryString(Data); encode_disp(Type, _Data) -> exit({error,{asn1,{undefined_type,Type}}}). decode_disp('Attribute', Data) -> dec_Attribute(Data); decode_disp('AttributeType', Data) -> dec_AttributeType(Data); decode_disp('AttributeValue', Data) -> dec_AttributeValue(Data); decode_disp('Context', Data) -> dec_Context(Data); decode_disp('AttributeValueAssertion', Data) -> dec_AttributeValueAssertion(Data); decode_disp('ContextAssertion', Data) -> dec_ContextAssertion(Data); decode_disp('AttributeTypeAssertion', Data) -> dec_AttributeTypeAssertion(Data); decode_disp('Name', Data) -> dec_Name(Data); decode_disp('RDNSequence', Data) -> dec_RDNSequence(Data); decode_disp('DistinguishedName', Data) -> dec_DistinguishedName(Data); decode_disp('RelativeDistinguishedName', Data) -> dec_RelativeDistinguishedName(Data); decode_disp('AttributeTypeX', Data) -> dec_AttributeTypeX(Data); decode_disp('AttributeValueX', Data) -> dec_AttributeValueX(Data); decode_disp('AttributeTypeAndValue', Data) -> dec_AttributeTypeAndValue(Data); decode_disp('AttributeTypeAndDistinguishedValue', Data) -> dec_AttributeTypeAndDistinguishedValue(Data); decode_disp('SubtreeSpecification', Data) -> dec_SubtreeSpecification(Data); decode_disp('LocalName', Data) -> dec_LocalName(Data); decode_disp('ChopSpecification', Data) -> dec_ChopSpecification(Data); decode_disp('BaseDistance', Data) -> dec_BaseDistance(Data); decode_disp('Refinement', Data) -> dec_Refinement(Data); decode_disp('ObjectClassKind', Data) -> dec_ObjectClassKind(Data); decode_disp('AttributeUsage', Data) -> dec_AttributeUsage(Data); decode_disp('DITStructureRule', Data) -> dec_DITStructureRule(Data); decode_disp('RuleIdentifier', Data) -> dec_RuleIdentifier(Data); decode_disp('DITContentRule', Data) -> dec_DITContentRule(Data); decode_disp('DITContextUse', Data) -> dec_DITContextUse(Data); decode_disp('SearchRuleDescription', Data) -> dec_SearchRuleDescription(Data); decode_disp('SearchRule', Data) -> dec_SearchRule(Data); decode_disp('SearchRuleId', Data) -> dec_SearchRuleId(Data); decode_disp('AllowedSubset', Data) -> dec_AllowedSubset(Data); decode_disp('ImposedSubset', Data) -> dec_ImposedSubset(Data); decode_disp('RequestAttribute', Data) -> dec_RequestAttribute(Data); decode_disp('ContextProfile', Data) -> dec_ContextProfile(Data); decode_disp('ContextCombination', Data) -> dec_ContextCombination(Data); decode_disp('MatchingUse', Data) -> dec_MatchingUse(Data); decode_disp('AttributeCombination', Data) -> dec_AttributeCombination(Data); decode_disp('ResultAttribute', Data) -> dec_ResultAttribute(Data); decode_disp('OutputValues', Data) -> dec_OutputValues(Data); decode_disp('ControlOptions', Data) -> dec_ControlOptions(Data); decode_disp('EntryLimit', Data) -> dec_EntryLimit(Data); decode_disp('RelaxationPolicy', Data) -> dec_RelaxationPolicy(Data); decode_disp('MRMapping', Data) -> dec_MRMapping(Data); decode_disp('Mapping', Data) -> dec_Mapping(Data); decode_disp('MRSubstitution', Data) -> dec_MRSubstitution(Data); decode_disp(subentryNameForm_DirectoryString, Data) -> dec_subentryNameForm_DirectoryString(Data); decode_disp(subentry_DirectoryString, Data) -> dec_subentry_DirectoryString(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. %%================================ %% Attribute %%================================ enc_Attribute(Val) -> enc_Attribute(Val, [<<48>>]). enc_Attribute(Val, TagIn) -> {_,Cindex1,Cindex2,Cindex3} = Val, Objtype = 'InformationFramework':'getenc_SupportedAttributes'( Cindex1), %%------------------------------------------------- %% attribute type(1) with type OBJECT IDENTIFIER %%------------------------------------------------- {EncBytes1,EncLen1} = encode_object_identifier(Cindex1, [<<6>>]), %%------------------------------------------------- %% attribute values(2) with type SET OF %%------------------------------------------------- {EncBytes2,EncLen2} = 'enc_Attribute_values'(Cindex2, [<<49>>], Objtype), %%------------------------------------------------- %% attribute valuesWithContext(3) with type SET OF OPTIONAL %%------------------------------------------------- {EncBytes3,EncLen3} = case Cindex3 of asn1_NOVALUE -> {<<>>,0}; _ -> 'enc_Attribute_valuesWithContext'(Cindex3, [<<49>>], Objtype) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3], LenSoFar = EncLen1 + EncLen2 + EncLen3, encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% Attribute_values %%================================ enc_Attribute_values(Val, TagIn, ObjFun) -> {EncBytes,EncLen} = 'enc_Attribute_values_components'(Val, ObjFun,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_Attribute_values_components'([], _, AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_Attribute_values_components'([H|T], ObjFun,AccBytes, AccLen) -> {TmpBytes,_} = ObjFun('Type', H, []), {EncBytes,EncLen} = encode_open_type(TmpBytes, []) , 'enc_Attribute_values_components'(T, ObjFun,[EncBytes|AccBytes], AccLen + EncLen). %%================================ %% Attribute_valuesWithContext %%================================ enc_Attribute_valuesWithContext(Val, TagIn, ObjFun) -> {EncBytes,EncLen} = 'enc_Attribute_valuesWithContext_components'(Val, ObjFun,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_Attribute_valuesWithContext_components'([], _, AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_Attribute_valuesWithContext_components'([H|T], ObjFun,AccBytes, AccLen) -> {EncBytes,EncLen} = 'enc_Attribute_valuesWithContext_SETOF'(H, [<<48>>], ObjFun), 'enc_Attribute_valuesWithContext_components'(T, ObjFun,[EncBytes|AccBytes], AccLen + EncLen). %%================================ %% Attribute_valuesWithContext_SETOF %%================================ enc_Attribute_valuesWithContext_SETOF(Val, TagIn, ObjFun) -> {_,Cindex1,Cindex2} = Val, %%------------------------------------------------- %% attribute value(1) with type typefieldType %%------------------------------------------------- {TmpBytes1,_} = ObjFun('Type', Cindex1, []), {EncBytes1,EncLen1} = encode_open_type(TmpBytes1, []) , %%------------------------------------------------- %% attribute contextList(2) with type SET OF %%------------------------------------------------- {EncBytes2,EncLen2} = 'enc_Attribute_valuesWithContext_SETOF_contextList'(Cindex2, [<<49>>]), BytesSoFar = [EncBytes1, EncBytes2], LenSoFar = EncLen1 + EncLen2, encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% Attribute_valuesWithContext_SETOF_contextList %%================================ enc_Attribute_valuesWithContext_SETOF_contextList(Val, TagIn) -> {EncBytes,EncLen} = 'enc_Attribute_valuesWithContext_SETOF_contextList_components'(Val,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_Attribute_valuesWithContext_SETOF_contextList_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_Attribute_valuesWithContext_SETOF_contextList_components'([H|T],AccBytes, AccLen) -> {EncBytes,EncLen} = 'enc_Context'(H, [<<48>>]), 'enc_Attribute_valuesWithContext_SETOF_contextList_components'(T,[EncBytes|AccBytes], AccLen + EncLen). dec_Attribute(Tlv) -> dec_Attribute(Tlv, [16]). dec_Attribute(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]), ObjFun = 'InformationFramework':'getdec_SupportedAttributes'(Term1), %%------------------------------------------------- %% attribute values(2) with type SET OF %%------------------------------------------------- [V2|Tlv3] = Tlv2, Term2 = 'dec_Attribute_values'(V2, [17], ObjFun), %%------------------------------------------------- %% attribute valuesWithContext(3) with type SET OF OPTIONAL %%------------------------------------------------- {Term3,Tlv4} = case Tlv3 of [{17,V3}|TempTlv4] -> {'dec_Attribute_valuesWithContext'(V3, [], ObjFun), TempTlv4}; _ -> { asn1_NOVALUE, Tlv3} end, case Tlv4 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowed end, Res1 = {'Attribute',Term1,Term2,Term3}, Res1. 'dec_Attribute_values'(Tlv, TagIn, ObjFun) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), [ begin Tmptlv1 = decode_open_type(V1, []), case (catch ObjFun('Type', Tmptlv1, [])) of {'EXIT',Reason1} -> exit({'Type not compatible with table constraint', Reason1}); Tmpterm1 -> Tmpterm1 end end || V1 <- Tlv1]. 'dec_Attribute_valuesWithContext'(Tlv, TagIn, ObjFun) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), ['dec_Attribute_valuesWithContext_SETOF'(V1, [16], ObjFun) || V1 <- Tlv1]. 'dec_Attribute_valuesWithContext_SETOF'(Tlv, TagIn, ObjFun) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- %% attribute value(1) with type typefieldType %%------------------------------------------------- [V1|Tlv2] = Tlv1, Term1 = begin Tmptlv1 = decode_open_type(V1, []), case (catch ObjFun('Type', Tmptlv1, [])) of {'EXIT',Reason1} -> exit({'Type not compatible with table constraint', Reason1}); Tmpterm1 -> Tmpterm1 end end , %%------------------------------------------------- %% attribute contextList(2) with type SET OF %%------------------------------------------------- [V2|Tlv3] = Tlv2, Term2 = 'dec_Attribute_valuesWithContext_SETOF_contextList'(V2, [17]), case Tlv3 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed end, Res1 = {'Attribute_valuesWithContext_SETOF',Term1,Term2}, Res1. 'dec_Attribute_valuesWithContext_SETOF_contextList'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), ['dec_Context'(V1, [16]) || V1 <- Tlv1]. %%================================ %% AttributeType %%================================ enc_AttributeType(Val) -> enc_AttributeType(Val, [<<6>>]). enc_AttributeType(Val, TagIn) -> encode_object_identifier(Val, TagIn). dec_AttributeType(Tlv) -> dec_AttributeType(Tlv, [6]). dec_AttributeType(Tlv, TagIn) -> decode_object_identifier(Tlv, TagIn). %%================================ %% AttributeValue %%================================ enc_AttributeValue(Val) -> enc_AttributeValue(Val, []). enc_AttributeValue(Val, TagIn) -> %% OPEN TYPE encode_open_type(Val, TagIn). dec_AttributeValue(Tlv) -> dec_AttributeValue(Tlv, []). dec_AttributeValue(Tlv, TagIn) -> decode_open_type_as_binary(Tlv, TagIn). %%================================ %% Context %%================================ enc_Context(Val) -> enc_Context(Val, [<<48>>]). enc_Context(Val, TagIn) -> {_,Cindex1,Cindex2,Cindex3} = Val, ObjcontextType = 'InformationFramework':'getenc_SupportedContexts'( Cindex1), %%------------------------------------------------- %% attribute contextType(1) with type OBJECT IDENTIFIER %%------------------------------------------------- {EncBytes1,EncLen1} = encode_object_identifier(Cindex1, [<<6>>]), %%------------------------------------------------- %% attribute contextValues(2) with type SET OF %%------------------------------------------------- {EncBytes2,EncLen2} = 'enc_Context_contextValues'(Cindex2, [<<49>>], ObjcontextType), %%------------------------------------------------- %% attribute fallback(3) with type BOOLEAN DEFAULT = false %%------------------------------------------------- {EncBytes3,EncLen3} = case Cindex3 of asn1_DEFAULT -> {<<>>,0}; _ when Cindex3 =:= false -> {<<>>,0}; _ -> encode_boolean(Cindex3, [<<1>>]) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3], LenSoFar = EncLen1 + EncLen2 + EncLen3, encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% Context_contextValues %%================================ enc_Context_contextValues(Val, TagIn, ObjFun) -> {EncBytes,EncLen} = 'enc_Context_contextValues_components'(Val, ObjFun,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_Context_contextValues_components'([], _, AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_Context_contextValues_components'([H|T], ObjFun,AccBytes, AccLen) -> {TmpBytes,_} = ObjFun('Type', H, []), {EncBytes,EncLen} = encode_open_type(TmpBytes, []) , 'enc_Context_contextValues_components'(T, ObjFun,[EncBytes|AccBytes], AccLen + EncLen). dec_Context(Tlv) -> dec_Context(Tlv, [16]). dec_Context(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- %% attribute contextType(1) with type OBJECT IDENTIFIER %%------------------------------------------------- [V1|Tlv2] = Tlv1, Term1 = decode_object_identifier(V1, [6]), ObjFun = 'InformationFramework':'getdec_SupportedContexts'(Term1), %%------------------------------------------------- %% attribute contextValues(2) with type SET OF %%------------------------------------------------- [V2|Tlv3] = Tlv2, Term2 = 'dec_Context_contextValues'(V2, [17], ObjFun), %%------------------------------------------------- %% attribute fallback(3) with type BOOLEAN DEFAULT = false %%------------------------------------------------- {Term3,Tlv4} = case Tlv3 of [{1,V3}|TempTlv4] -> {decode_boolean(V3, []), TempTlv4}; _ -> {false,Tlv3} end, case Tlv4 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowed end, Res1 = {'Context',Term1,Term2,Term3}, Res1. 'dec_Context_contextValues'(Tlv, TagIn, ObjFun) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), [ begin Tmptlv1 = decode_open_type(V1, []), case (catch ObjFun('Type', Tmptlv1, [])) of {'EXIT',Reason1} -> exit({'Type not compatible with table constraint', Reason1}); Tmpterm1 -> Tmpterm1 end end || V1 <- Tlv1]. %%================================ %% AttributeValueAssertion %%================================ enc_AttributeValueAssertion(Val) -> enc_AttributeValueAssertion(Val, [<<48>>]). enc_AttributeValueAssertion(Val, TagIn) -> {_,Cindex1,Cindex2,Cindex3} = Val, Objtype = 'InformationFramework':'getenc_SupportedAttributes'( Cindex1), %%------------------------------------------------- %% attribute type(1) with type OBJECT IDENTIFIER %%------------------------------------------------- {EncBytes1,EncLen1} = encode_object_identifier(Cindex1, [<<6>>]), %%------------------------------------------------- %% attribute assertion(2) with type typefieldAssertionType %%------------------------------------------------- {TmpBytes2,_} = Objtype('equality-match', Cindex2, ['AssertionType']), {EncBytes2,EncLen2} = encode_open_type(TmpBytes2, []) , %%------------------------------------------------- %% attribute assertedContexts(3) with type CHOICE OPTIONAL %%------------------------------------------------- {EncBytes3,EncLen3} = case Cindex3 of asn1_NOVALUE -> {<<>>,0}; _ -> 'enc_AttributeValueAssertion_assertedContexts'(Cindex3, []) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3], LenSoFar = EncLen1 + EncLen2 + EncLen3, encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% AttributeValueAssertion_assertedContexts %%================================ enc_AttributeValueAssertion_assertedContexts(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of allContexts -> encode_null(element(2,Val), [<<5>>,<<160>>]); selectedContexts -> 'enc_AttributeValueAssertion_assertedContexts_selectedContexts'(element(2,Val), [<<49>>,<<161>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, encode_tags(TagIn, EncBytes, EncLen). %%================================ %% AttributeValueAssertion_assertedContexts_selectedContexts %%================================ enc_AttributeValueAssertion_assertedContexts_selectedContexts(Val, TagIn) -> {EncBytes,EncLen} = 'enc_AttributeValueAssertion_assertedContexts_selectedContexts_components'(Val,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_AttributeValueAssertion_assertedContexts_selectedContexts_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_AttributeValueAssertion_assertedContexts_selectedContexts_components'([H|T],AccBytes, AccLen) -> {EncBytes,EncLen} = 'enc_ContextAssertion'(H, [<<48>>]), 'enc_AttributeValueAssertion_assertedContexts_selectedContexts_components'(T,[EncBytes|AccBytes], AccLen + EncLen). dec_AttributeValueAssertion(Tlv) -> dec_AttributeValueAssertion(Tlv, [16]). dec_AttributeValueAssertion(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 assertion(2) with type typefieldAssertionType %%------------------------------------------------- [V2|Tlv3] = Tlv2, Tmpterm1 = decode_open_type(V2, []), %%------------------------------------------------- %% attribute assertedContexts(3) with type CHOICE OPTIONAL %%------------------------------------------------- {Term3,Tlv4} = case Tlv3 of [V3 = {131072,_}|TempTlv4] -> {'dec_AttributeValueAssertion_assertedContexts'(V3, []), TempTlv4}; [V3 = {131073,_}|TempTlv4] -> {'dec_AttributeValueAssertion_assertedContexts'(V3, []), TempTlv4}; _ -> { asn1_NOVALUE, Tlv3} end, DecObjtypeTerm1 = 'InformationFramework':'getdec_SupportedAttributes'(Term1), Term2 = case (catch DecObjtypeTerm1('equality-match', Tmpterm1, ['AssertionType'])) of {'EXIT', Reason1} -> exit({'Type not compatible with table constraint',Reason1}); Tmpterm2 -> Tmpterm2 end, case Tlv4 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowed end, Res1 = {'AttributeValueAssertion',Term1,Term2,Term3}, Res1. 'dec_AttributeValueAssertion_assertedContexts'(Tlv, TagIn) -> Tlv1 = match_tags(Tlv, TagIn), case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of %% 'allContexts' {131072, V1} -> {allContexts, decode_null(V1, [5])}; %% 'selectedContexts' {131073, V1} -> {selectedContexts, 'dec_AttributeValueAssertion_assertedContexts_selectedContexts'(V1, [17])}; Else -> exit({error,{asn1,{invalid_choice_tag,Else}}}) end . 'dec_AttributeValueAssertion_assertedContexts_selectedContexts'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), ['dec_ContextAssertion'(V1, [16]) || V1 <- Tlv1]. %%================================ %% ContextAssertion %%================================ enc_ContextAssertion(Val) -> enc_ContextAssertion(Val, [<<48>>]). enc_ContextAssertion(Val, TagIn) -> {_,Cindex1,Cindex2} = Val, ObjcontextType = 'InformationFramework':'getenc_SupportedContexts'( Cindex1), %%------------------------------------------------- %% attribute contextType(1) with type OBJECT IDENTIFIER %%------------------------------------------------- {EncBytes1,EncLen1} = encode_object_identifier(Cindex1, [<<6>>]), %%------------------------------------------------- %% attribute contextValues(2) with type SET OF %%------------------------------------------------- {EncBytes2,EncLen2} = 'enc_ContextAssertion_contextValues'(Cindex2, [<<49>>], ObjcontextType), BytesSoFar = [EncBytes1, EncBytes2], LenSoFar = EncLen1 + EncLen2, encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% ContextAssertion_contextValues %%================================ enc_ContextAssertion_contextValues(Val, TagIn, ObjFun) -> {EncBytes,EncLen} = 'enc_ContextAssertion_contextValues_components'(Val, ObjFun,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_ContextAssertion_contextValues_components'([], _, AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_ContextAssertion_contextValues_components'([H|T], ObjFun,AccBytes, AccLen) -> {TmpBytes,_} = ObjFun('Assertion', H, []), {EncBytes,EncLen} = encode_open_type(TmpBytes, []) , 'enc_ContextAssertion_contextValues_components'(T, ObjFun,[EncBytes|AccBytes], AccLen + EncLen). dec_ContextAssertion(Tlv) -> dec_ContextAssertion(Tlv, [16]). dec_ContextAssertion(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- %% attribute contextType(1) with type OBJECT IDENTIFIER %%------------------------------------------------- [V1|Tlv2] = Tlv1, Term1 = decode_object_identifier(V1, [6]), ObjFun = 'InformationFramework':'getdec_SupportedContexts'(Term1), %%------------------------------------------------- %% attribute contextValues(2) with type SET OF %%------------------------------------------------- [V2|Tlv3] = Tlv2, Term2 = 'dec_ContextAssertion_contextValues'(V2, [17], ObjFun), case Tlv3 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed end, Res1 = {'ContextAssertion',Term1,Term2}, Res1. 'dec_ContextAssertion_contextValues'(Tlv, TagIn, ObjFun) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), [ begin Tmptlv1 = decode_open_type(V1, []), case (catch ObjFun('Assertion', Tmptlv1, [])) of {'EXIT',Reason1} -> exit({'Type not compatible with table constraint', Reason1}); Tmpterm1 -> Tmpterm1 end end || V1 <- Tlv1]. %%================================ %% AttributeTypeAssertion %%================================ enc_AttributeTypeAssertion(Val) -> enc_AttributeTypeAssertion(Val, [<<48>>]). enc_AttributeTypeAssertion(Val, TagIn) -> {_,Cindex1,Cindex2} = Val, %%------------------------------------------------- %% attribute type(1) with type OBJECT IDENTIFIER %%------------------------------------------------- {EncBytes1,EncLen1} = encode_object_identifier(Cindex1, [<<6>>]), %%------------------------------------------------- %% attribute assertedContexts(2) with type SEQUENCE OF OPTIONAL %%------------------------------------------------- {EncBytes2,EncLen2} = case Cindex2 of asn1_NOVALUE -> {<<>>,0}; _ -> 'enc_AttributeTypeAssertion_assertedContexts'(Cindex2, [<<48>>]) end, BytesSoFar = [EncBytes1, EncBytes2], LenSoFar = EncLen1 + EncLen2, encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% AttributeTypeAssertion_assertedContexts %%================================ enc_AttributeTypeAssertion_assertedContexts(Val, TagIn) -> {EncBytes,EncLen} = 'enc_AttributeTypeAssertion_assertedContexts_components'(Val,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_AttributeTypeAssertion_assertedContexts_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_AttributeTypeAssertion_assertedContexts_components'([H|T],AccBytes, AccLen) -> {EncBytes,EncLen} = 'enc_ContextAssertion'(H, [<<48>>]), 'enc_AttributeTypeAssertion_assertedContexts_components'(T,[EncBytes|AccBytes], AccLen + EncLen). dec_AttributeTypeAssertion(Tlv) -> dec_AttributeTypeAssertion(Tlv, [16]). dec_AttributeTypeAssertion(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 assertedContexts(2) with type SEQUENCE OF OPTIONAL %%------------------------------------------------- {Term2,Tlv3} = case Tlv2 of [{16,V2}|TempTlv3] -> {'dec_AttributeTypeAssertion_assertedContexts'(V2, []), TempTlv3}; _ -> { asn1_NOVALUE, Tlv2} end, case Tlv3 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed end, Res1 = {'AttributeTypeAssertion',Term1,Term2}, Res1. 'dec_AttributeTypeAssertion_assertedContexts'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), ['dec_ContextAssertion'(V1, [16]) || V1 <- Tlv1]. %%================================ %% Name %%================================ enc_Name(Val) -> enc_Name(Val, []). enc_Name(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of rdnSequence -> 'enc_RDNSequence'(element(2,Val), [<<48>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, encode_tags(TagIn, EncBytes, EncLen). dec_Name(Tlv) -> dec_Name(Tlv, []). dec_Name(Tlv, TagIn) -> Tlv1 = match_tags(Tlv, TagIn), case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of %% 'rdnSequence' {16, V1} -> {rdnSequence, 'dec_RDNSequence'(V1, [])}; Else -> exit({error,{asn1,{invalid_choice_tag,Else}}}) end . %%================================ %% RDNSequence %%================================ enc_RDNSequence(Val) -> enc_RDNSequence(Val, [<<48>>]). enc_RDNSequence(Val, TagIn) -> {EncBytes,EncLen} = 'enc_RDNSequence_components'(Val,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_RDNSequence_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_RDNSequence_components'([H|T],AccBytes, AccLen) -> {EncBytes,EncLen} = 'enc_RelativeDistinguishedName'(H, [<<49>>]), 'enc_RDNSequence_components'(T,[EncBytes|AccBytes], AccLen + EncLen). dec_RDNSequence(Tlv) -> dec_RDNSequence(Tlv, [16]). dec_RDNSequence(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), ['dec_RelativeDistinguishedName'(V1, [17]) || V1 <- Tlv1]. %%================================ %% DistinguishedName %%================================ enc_DistinguishedName(Val) -> enc_DistinguishedName(Val, [<<48>>]). enc_DistinguishedName(Val, TagIn) -> enc_RDNSequence(Val, TagIn). dec_DistinguishedName(Tlv) -> dec_DistinguishedName(Tlv, [16]). dec_DistinguishedName(Tlv, TagIn) -> 'dec_RDNSequence'(Tlv, TagIn). %%================================ %% RelativeDistinguishedName %%================================ enc_RelativeDistinguishedName(Val) -> enc_RelativeDistinguishedName(Val, [<<49>>]). enc_RelativeDistinguishedName(Val, TagIn) -> {EncBytes,EncLen} = 'enc_RelativeDistinguishedName_components'(Val,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_RelativeDistinguishedName_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_RelativeDistinguishedName_components'([H|T],AccBytes, AccLen) -> {EncBytes,EncLen} = 'enc_AttributeTypeAndValue'(H, [<<48>>]), 'enc_RelativeDistinguishedName_components'(T,[EncBytes|AccBytes], AccLen + EncLen). dec_RelativeDistinguishedName(Tlv) -> dec_RelativeDistinguishedName(Tlv, [17]). dec_RelativeDistinguishedName(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), ['dec_AttributeTypeAndValue'(V1, [16]) || V1 <- Tlv1]. %%================================ %% AttributeTypeX %%================================ enc_AttributeTypeX(Val) -> enc_AttributeTypeX(Val, [<<6>>]). enc_AttributeTypeX(Val, TagIn) -> encode_object_identifier(Val, TagIn). dec_AttributeTypeX(Tlv) -> dec_AttributeTypeX(Tlv, [6]). dec_AttributeTypeX(Tlv, TagIn) -> decode_object_identifier(Tlv, TagIn). %%================================ %% AttributeValueX %%================================ enc_AttributeValueX(Val) -> enc_AttributeValueX(Val, []). enc_AttributeValueX(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of utf8 -> encode_UTF8_string(element(2,Val), [<<12>>]); printable -> encode_restricted_string(element(2,Val), [<<19>>]); 'else' -> encode_open_type(element(2,Val), []); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, encode_tags(TagIn, EncBytes, EncLen). dec_AttributeValueX(Tlv) -> dec_AttributeValueX(Tlv, []). dec_AttributeValueX(Tlv, TagIn) -> Tlv1 = match_tags(Tlv, TagIn), case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of %% 'utf8' {12, V1} -> {utf8, decode_UTF8_string(V1, [])}; %% 'printable' {19, V1} -> {printable, begin binary_to_list(decode_restricted_string(V1, [])) end }; %% 'else' Else -> exit({error,{asn1,{invalid_choice_tag,Else}}}) end . %%================================ %% AttributeTypeAndValue %%================================ enc_AttributeTypeAndValue(Val) -> enc_AttributeTypeAndValue(Val, [<<48>>]). enc_AttributeTypeAndValue(Val, TagIn) -> {_,Cindex1,Cindex2} = Val, %%------------------------------------------------- %% attribute type(1) with type OBJECT IDENTIFIER %%------------------------------------------------- {EncBytes1,EncLen1} = encode_object_identifier(Cindex1, [<<6>>]), %%------------------------------------------------- %% attribute value(2) External InformationFramework:AttributeValueX %%------------------------------------------------- {EncBytes2,EncLen2} = 'enc_AttributeValueX'(Cindex2, []), BytesSoFar = [EncBytes1, EncBytes2], LenSoFar = EncLen1 + EncLen2, encode_tags(TagIn, BytesSoFar, LenSoFar). dec_AttributeTypeAndValue(Tlv) -> dec_AttributeTypeAndValue(Tlv, [16]). dec_AttributeTypeAndValue(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) External InformationFramework:AttributeValueX %%------------------------------------------------- [V2|Tlv3] = Tlv2, Term2 = 'dec_AttributeValueX'(V2, []), case Tlv3 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed end, Res1 = {'AttributeTypeAndValue',Term1,Term2}, Res1. %%================================ %% AttributeTypeAndDistinguishedValue %%================================ enc_AttributeTypeAndDistinguishedValue(Val) -> enc_AttributeTypeAndDistinguishedValue(Val, [<<48>>]). enc_AttributeTypeAndDistinguishedValue(Val, TagIn) -> {_,Cindex1,Cindex2,Cindex3,Cindex4} = Val, Objtype = 'InformationFramework':'getenc_SupportedAttributes'( Cindex1), %%------------------------------------------------- %% attribute type(1) with type OBJECT IDENTIFIER %%------------------------------------------------- {EncBytes1,EncLen1} = encode_object_identifier(Cindex1, [<<6>>]), %%------------------------------------------------- %% attribute value(2) with type typefieldType %%------------------------------------------------- {TmpBytes2,_} = Objtype('Type', Cindex2, []), {EncBytes2,EncLen2} = encode_open_type(TmpBytes2, []) , %%------------------------------------------------- %% attribute primaryDistinguished(3) with type BOOLEAN DEFAULT = true %%------------------------------------------------- {EncBytes3,EncLen3} = case Cindex3 of asn1_DEFAULT -> {<<>>,0}; _ when Cindex3 =:= true -> {<<>>,0}; _ -> encode_boolean(Cindex3, [<<1>>]) end, %%------------------------------------------------- %% attribute valuesWithContext(4) with type SET OF OPTIONAL %%------------------------------------------------- {EncBytes4,EncLen4} = case Cindex4 of asn1_NOVALUE -> {<<>>,0}; _ -> 'enc_AttributeTypeAndDistinguishedValue_valuesWithContext'(Cindex4, [<<49>>], Objtype) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4], LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4, encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% AttributeTypeAndDistinguishedValue_valuesWithContext %%================================ enc_AttributeTypeAndDistinguishedValue_valuesWithContext(Val, TagIn, ObjFun) -> {EncBytes,EncLen} = 'enc_AttributeTypeAndDistinguishedValue_valuesWithContext_components'(Val, ObjFun,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_AttributeTypeAndDistinguishedValue_valuesWithContext_components'([], _, AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_AttributeTypeAndDistinguishedValue_valuesWithContext_components'([H|T], ObjFun,AccBytes, AccLen) -> {EncBytes,EncLen} = 'enc_AttributeTypeAndDistinguishedValue_valuesWithContext_SETOF'(H, [<<48>>], ObjFun), 'enc_AttributeTypeAndDistinguishedValue_valuesWithContext_components'(T, ObjFun,[EncBytes|AccBytes], AccLen + EncLen). %%================================ %% AttributeTypeAndDistinguishedValue_valuesWithContext_SETOF %%================================ enc_AttributeTypeAndDistinguishedValue_valuesWithContext_SETOF(Val, TagIn, ObjFun) -> {_,Cindex1,Cindex2} = Val, %%------------------------------------------------- %% attribute distingAttrValue(1) with type typefieldType OPTIONAL %%------------------------------------------------- {EncBytes1,EncLen1} = case Cindex1 of asn1_NOVALUE -> {<<>>,0}; _ -> {TmpBytes1,_ } = ObjFun('Type', Cindex1, []), encode_open_type(TmpBytes1, [<<160>>]) end, %%------------------------------------------------- %% attribute contextList(2) with type SET OF %%------------------------------------------------- {EncBytes2,EncLen2} = 'enc_AttributeTypeAndDistinguishedValue_valuesWithContext_SETOF_contextList'(Cindex2, [<<49>>]), BytesSoFar = [EncBytes1, EncBytes2], LenSoFar = EncLen1 + EncLen2, encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% AttributeTypeAndDistinguishedValue_valuesWithContext_SETOF_contextList %%================================ enc_AttributeTypeAndDistinguishedValue_valuesWithContext_SETOF_contextList(Val, TagIn) -> {EncBytes,EncLen} = 'enc_AttributeTypeAndDistinguishedValue_valuesWithContext_SETOF_contextList_components'(Val,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_AttributeTypeAndDistinguishedValue_valuesWithContext_SETOF_contextList_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_AttributeTypeAndDistinguishedValue_valuesWithContext_SETOF_contextList_components'([H|T],AccBytes, AccLen) -> {EncBytes,EncLen} = 'enc_Context'(H, [<<48>>]), 'enc_AttributeTypeAndDistinguishedValue_valuesWithContext_SETOF_contextList_components'(T,[EncBytes|AccBytes], AccLen + EncLen). dec_AttributeTypeAndDistinguishedValue(Tlv) -> dec_AttributeTypeAndDistinguishedValue(Tlv, [16]). dec_AttributeTypeAndDistinguishedValue(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]), ObjFun = 'InformationFramework':'getdec_SupportedAttributes'(Term1), %%------------------------------------------------- %% attribute value(2) with type typefieldType %%------------------------------------------------- [V2|Tlv3] = Tlv2, Tmpterm1 = decode_open_type(V2, []), %%------------------------------------------------- %% attribute primaryDistinguished(3) with type BOOLEAN DEFAULT = true %%------------------------------------------------- {Term3,Tlv4} = case Tlv3 of [{1,V3}|TempTlv4] -> {decode_boolean(V3, []), TempTlv4}; _ -> {true,Tlv3} end, %%------------------------------------------------- %% attribute valuesWithContext(4) with type SET OF OPTIONAL %%------------------------------------------------- {Term4,Tlv5} = case Tlv4 of [{17,V4}|TempTlv5] -> {'dec_AttributeTypeAndDistinguishedValue_valuesWithContext'(V4, [], ObjFun), TempTlv5}; _ -> { asn1_NOVALUE, Tlv4} end, DecObjtypeTerm1 = 'InformationFramework':'getdec_SupportedAttributes'(Term1), Term2 = case (catch DecObjtypeTerm1('Type', Tmpterm1, [])) of {'EXIT', Reason1} -> exit({'Type not compatible with table constraint',Reason1}); Tmpterm2 -> Tmpterm2 end, case Tlv5 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv5}}}) % extra fields not allowed end, Res1 = {'AttributeTypeAndDistinguishedValue',Term1,Term2,Term3,Term4}, Res1. 'dec_AttributeTypeAndDistinguishedValue_valuesWithContext'(Tlv, TagIn, ObjFun) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), ['dec_AttributeTypeAndDistinguishedValue_valuesWithContext_SETOF'(V1, [16], ObjFun) || V1 <- Tlv1]. 'dec_AttributeTypeAndDistinguishedValue_valuesWithContext_SETOF'(Tlv, TagIn, ObjFun) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- %% attribute distingAttrValue(1) with type typefieldType OPTIONAL %%------------------------------------------------- {Term1,Tlv2} = case Tlv1 of [{131072,V1}|TempTlv2] -> { begin Tmptlv1 = decode_open_type(V1, []), case (catch ObjFun('Type', Tmptlv1, [])) of {'EXIT',Reason1} -> exit({'Type not compatible with table constraint', Reason1}); Tmpterm1 -> Tmpterm1 end end , TempTlv2}; _ -> { asn1_NOVALUE, Tlv1} end, %%------------------------------------------------- %% attribute contextList(2) with type SET OF %%------------------------------------------------- [V2|Tlv3] = Tlv2, Term2 = 'dec_AttributeTypeAndDistinguishedValue_valuesWithContext_SETOF_contextList'(V2, [17]), case Tlv3 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed end, Res1 = {'AttributeTypeAndDistinguishedValue_valuesWithContext_SETOF',Term1,Term2}, Res1. 'dec_AttributeTypeAndDistinguishedValue_valuesWithContext_SETOF_contextList'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), ['dec_Context'(V1, [16]) || V1 <- Tlv1]. %%================================ %% SubtreeSpecification %%================================ enc_SubtreeSpecification(Val) -> enc_SubtreeSpecification(Val, [<<48>>]). enc_SubtreeSpecification(Val, TagIn) -> {_,Cindex1,Cindex2,Cindex3,Cindex4,Cindex5} = Val, %%------------------------------------------------- %% attribute base(1) External InformationFramework:LocalName DEFAULT = [] %%------------------------------------------------- {EncBytes1,EncLen1} = case Cindex1 of asn1_DEFAULT -> {<<>>,0}; _ when Cindex1 =:= [] -> {<<>>,0}; _ -> 'enc_LocalName'(Cindex1, [<<48>>,<<160>>]) end, %%------------------------------------------------- %% attribute specificExclusions(2) with type SET OF OPTIONAL %%------------------------------------------------- {EncBytes2,EncLen2} = case Cindex2 of asn1_NOVALUE -> {<<>>,0}; _ -> 'enc_SubtreeSpecification_specificExclusions'(Cindex2, [<<49>>,<<161>>]) end, %%------------------------------------------------- %% attribute minimum(3) with type INTEGER DEFAULT = 0 %%------------------------------------------------- {EncBytes3,EncLen3} = case Cindex3 of asn1_DEFAULT -> {<<>>,0}; _ when Cindex3 =:= 0 -> {<<>>,0}; _ -> encode_integer(Cindex3, [<<2>>,<<162>>]) end, %%------------------------------------------------- %% attribute maximum(4) with type INTEGER OPTIONAL %%------------------------------------------------- {EncBytes4,EncLen4} = case Cindex4 of asn1_NOVALUE -> {<<>>,0}; _ -> encode_integer(Cindex4, [<<2>>,<<163>>]) end, %%------------------------------------------------- %% attribute specificationFilter(5) External InformationFramework:Refinement OPTIONAL %%------------------------------------------------- {EncBytes5,EncLen5} = case Cindex5 of asn1_NOVALUE -> {<<>>,0}; _ -> 'enc_Refinement'(Cindex5, [<<164>>]) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4, EncBytes5], LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5, encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% SubtreeSpecification_specificExclusions %%================================ enc_SubtreeSpecification_specificExclusions(Val, TagIn) -> {EncBytes,EncLen} = 'enc_SubtreeSpecification_specificExclusions_components'(Val,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_SubtreeSpecification_specificExclusions_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_SubtreeSpecification_specificExclusions_components'([H|T],AccBytes, AccLen) -> {EncBytes,EncLen} = 'enc_SubtreeSpecification_specificExclusions_SETOF'(H, []), 'enc_SubtreeSpecification_specificExclusions_components'(T,[EncBytes|AccBytes], AccLen + EncLen). %%================================ %% SubtreeSpecification_specificExclusions_SETOF %%================================ enc_SubtreeSpecification_specificExclusions_SETOF(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of chopBefore -> 'enc_LocalName'(element(2,Val), [<<48>>,<<160>>]); chopAfter -> 'enc_LocalName'(element(2,Val), [<<48>>,<<161>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, encode_tags(TagIn, EncBytes, EncLen). dec_SubtreeSpecification(Tlv) -> dec_SubtreeSpecification(Tlv, [16]). dec_SubtreeSpecification(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- %% attribute base(1) External InformationFramework:LocalName DEFAULT = [] %%------------------------------------------------- {Term1,Tlv2} = case Tlv1 of [{131072,V1}|TempTlv2] -> {'dec_LocalName'(V1, [16]), TempTlv2}; _ -> {[],Tlv1} end, %%------------------------------------------------- %% attribute specificExclusions(2) with type SET OF OPTIONAL %%------------------------------------------------- {Term2,Tlv3} = case Tlv2 of [{131073,V2}|TempTlv3] -> {'dec_SubtreeSpecification_specificExclusions'(V2, [17]), TempTlv3}; _ -> { asn1_NOVALUE, Tlv2} end, %%------------------------------------------------- %% attribute minimum(3) with type INTEGER DEFAULT = 0 %%------------------------------------------------- {Term3,Tlv4} = case Tlv3 of [{131074,V3}|TempTlv4] -> {begin Val1 = decode_integer(V3, [2]), if 0 =< Val1, Val1 =< 'MAX' -> Val1; true -> exit({error,{asn1,bad_range}}) end end, TempTlv4}; _ -> {0,Tlv3} end, %%------------------------------------------------- %% attribute maximum(4) with type INTEGER OPTIONAL %%------------------------------------------------- {Term4,Tlv5} = case Tlv4 of [{131075,V4}|TempTlv5] -> {begin Val2 = decode_integer(V4, [2]), if 0 =< Val2, Val2 =< 'MAX' -> Val2; true -> exit({error,{asn1,bad_range}}) end end, TempTlv5}; _ -> { asn1_NOVALUE, Tlv4} end, %%------------------------------------------------- %% attribute specificationFilter(5) External InformationFramework:Refinement OPTIONAL %%------------------------------------------------- {Term5,Tlv6} = case Tlv5 of [{131076,V5}|TempTlv6] -> {'dec_Refinement'(V5, []), TempTlv6}; _ -> { asn1_NOVALUE, Tlv5} end, case Tlv6 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv6}}}) % extra fields not allowed end, Res1 = {'SubtreeSpecification',Term1,Term2,Term3,Term4,Term5}, Res1. 'dec_SubtreeSpecification_specificExclusions'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), ['dec_SubtreeSpecification_specificExclusions_SETOF'(V1, []) || V1 <- Tlv1]. 'dec_SubtreeSpecification_specificExclusions_SETOF'(Tlv, TagIn) -> Tlv1 = match_tags(Tlv, TagIn), case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of %% 'chopBefore' {131072, V1} -> {chopBefore, 'dec_LocalName'(V1, [16])}; %% 'chopAfter' {131073, V1} -> {chopAfter, 'dec_LocalName'(V1, [16])}; Else -> exit({error,{asn1,{invalid_choice_tag,Else}}}) end . %%================================ %% LocalName %%================================ enc_LocalName(Val) -> enc_LocalName(Val, [<<48>>]). enc_LocalName(Val, TagIn) -> enc_RDNSequence(Val, TagIn). dec_LocalName(Tlv) -> dec_LocalName(Tlv, [16]). dec_LocalName(Tlv, TagIn) -> 'dec_RDNSequence'(Tlv, TagIn). %%================================ %% ChopSpecification %%================================ enc_ChopSpecification(Val) -> enc_ChopSpecification(Val, [<<48>>]). enc_ChopSpecification(Val, TagIn) -> {_,Cindex1,Cindex2,Cindex3} = Val, %%------------------------------------------------- %% attribute specificExclusions(1) with type SET OF OPTIONAL %%------------------------------------------------- {EncBytes1,EncLen1} = case Cindex1 of asn1_NOVALUE -> {<<>>,0}; _ -> 'enc_ChopSpecification_specificExclusions'(Cindex1, [<<49>>,<<161>>]) end, %%------------------------------------------------- %% attribute minimum(2) with type INTEGER DEFAULT = 0 %%------------------------------------------------- {EncBytes2,EncLen2} = case Cindex2 of asn1_DEFAULT -> {<<>>,0}; _ when Cindex2 =:= 0 -> {<<>>,0}; _ -> encode_integer(Cindex2, [<<2>>,<<162>>]) end, %%------------------------------------------------- %% attribute maximum(3) with type INTEGER OPTIONAL %%------------------------------------------------- {EncBytes3,EncLen3} = case Cindex3 of asn1_NOVALUE -> {<<>>,0}; _ -> encode_integer(Cindex3, [<<2>>,<<163>>]) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3], LenSoFar = EncLen1 + EncLen2 + EncLen3, encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% ChopSpecification_specificExclusions %%================================ enc_ChopSpecification_specificExclusions(Val, TagIn) -> {EncBytes,EncLen} = 'enc_ChopSpecification_specificExclusions_components'(Val,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_ChopSpecification_specificExclusions_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_ChopSpecification_specificExclusions_components'([H|T],AccBytes, AccLen) -> {EncBytes,EncLen} = 'enc_ChopSpecification_specificExclusions_SETOF'(H, []), 'enc_ChopSpecification_specificExclusions_components'(T,[EncBytes|AccBytes], AccLen + EncLen). %%================================ %% ChopSpecification_specificExclusions_SETOF %%================================ enc_ChopSpecification_specificExclusions_SETOF(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of chopBefore -> 'enc_LocalName'(element(2,Val), [<<48>>,<<160>>]); chopAfter -> 'enc_LocalName'(element(2,Val), [<<48>>,<<161>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, encode_tags(TagIn, EncBytes, EncLen). dec_ChopSpecification(Tlv) -> dec_ChopSpecification(Tlv, [16]). dec_ChopSpecification(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- %% attribute specificExclusions(1) with type SET OF OPTIONAL %%------------------------------------------------- {Term1,Tlv2} = case Tlv1 of [{131073,V1}|TempTlv2] -> {'dec_ChopSpecification_specificExclusions'(V1, [17]), TempTlv2}; _ -> { asn1_NOVALUE, Tlv1} end, %%------------------------------------------------- %% attribute minimum(2) with type INTEGER DEFAULT = 0 %%------------------------------------------------- {Term2,Tlv3} = case Tlv2 of [{131074,V2}|TempTlv3] -> {begin Val1 = decode_integer(V2, [2]), if 0 =< Val1, Val1 =< 'MAX' -> Val1; true -> exit({error,{asn1,bad_range}}) end end, TempTlv3}; _ -> {0,Tlv2} end, %%------------------------------------------------- %% attribute maximum(3) with type INTEGER OPTIONAL %%------------------------------------------------- {Term3,Tlv4} = case Tlv3 of [{131075,V3}|TempTlv4] -> {begin Val2 = decode_integer(V3, [2]), if 0 =< Val2, Val2 =< 'MAX' -> Val2; true -> exit({error,{asn1,bad_range}}) end end, TempTlv4}; _ -> { asn1_NOVALUE, Tlv3} end, case Tlv4 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowed end, Res1 = {'ChopSpecification',Term1,Term2,Term3}, Res1. 'dec_ChopSpecification_specificExclusions'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), ['dec_ChopSpecification_specificExclusions_SETOF'(V1, []) || V1 <- Tlv1]. 'dec_ChopSpecification_specificExclusions_SETOF'(Tlv, TagIn) -> Tlv1 = match_tags(Tlv, TagIn), case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of %% 'chopBefore' {131072, V1} -> {chopBefore, 'dec_LocalName'(V1, [16])}; %% 'chopAfter' {131073, V1} -> {chopAfter, 'dec_LocalName'(V1, [16])}; Else -> exit({error,{asn1,{invalid_choice_tag,Else}}}) end . %%================================ %% BaseDistance %%================================ enc_BaseDistance(Val) -> enc_BaseDistance(Val, [<<2>>]). enc_BaseDistance(Val, TagIn) -> encode_integer(Val, TagIn). dec_BaseDistance(Tlv) -> dec_BaseDistance(Tlv, [2]). dec_BaseDistance(Tlv, TagIn) -> begin Val1 = decode_integer(Tlv, TagIn), if 0 =< Val1, Val1 =< 'MAX' -> Val1; true -> exit({error,{asn1,bad_range}}) end end. %%================================ %% Refinement %%================================ enc_Refinement(Val) -> enc_Refinement(Val, []). enc_Refinement(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of item -> encode_object_identifier(element(2,Val), [<<6>>,<<160>>]); 'and' -> 'enc_Refinement_and'(element(2,Val), [<<49>>,<<161>>]); 'or' -> 'enc_Refinement_or'(element(2,Val), [<<49>>,<<162>>]); 'not' -> 'enc_Refinement'(element(2,Val), [<<163>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, encode_tags(TagIn, EncBytes, EncLen). %%================================ %% Refinement_and %%================================ enc_Refinement_and(Val, TagIn) -> {EncBytes,EncLen} = 'enc_Refinement_and_components'(Val,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_Refinement_and_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_Refinement_and_components'([H|T],AccBytes, AccLen) -> {EncBytes,EncLen} = 'enc_Refinement'(H, []), 'enc_Refinement_and_components'(T,[EncBytes|AccBytes], AccLen + EncLen). %%================================ %% Refinement_or %%================================ enc_Refinement_or(Val, TagIn) -> {EncBytes,EncLen} = 'enc_Refinement_or_components'(Val,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_Refinement_or_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_Refinement_or_components'([H|T],AccBytes, AccLen) -> {EncBytes,EncLen} = 'enc_Refinement'(H, []), 'enc_Refinement_or_components'(T,[EncBytes|AccBytes], AccLen + EncLen). dec_Refinement(Tlv) -> dec_Refinement(Tlv, []). dec_Refinement(Tlv, TagIn) -> Tlv1 = match_tags(Tlv, TagIn), case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of %% 'item' {131072, V1} -> {item, decode_object_identifier(V1, [6])}; %% 'and' {131073, V1} -> {'and', 'dec_Refinement_and'(V1, [17])}; %% 'or' {131074, V1} -> {'or', 'dec_Refinement_or'(V1, [17])}; %% 'not' {131075, V1} -> {'not', 'dec_Refinement'(V1, [])}; Else -> exit({error,{asn1,{invalid_choice_tag,Else}}}) end . 'dec_Refinement_and'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), ['dec_Refinement'(V1, []) || V1 <- Tlv1]. 'dec_Refinement_or'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), ['dec_Refinement'(V1, []) || V1 <- Tlv1]. %%================================ %% ObjectClassKind %%================================ enc_ObjectClassKind(Val) -> enc_ObjectClassKind(Val, [<<10>>]). enc_ObjectClassKind(Val, TagIn) -> case Val of abstract -> encode_tags(TagIn, [0], 1); structural -> encode_tags(TagIn, [1], 1); auxiliary -> encode_tags(TagIn, [2], 1); Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}}) end. dec_ObjectClassKind(Tlv) -> dec_ObjectClassKind(Tlv, [10]). dec_ObjectClassKind(Tlv, TagIn) -> case decode_integer(Tlv, TagIn) of 0 -> abstract; 1 -> structural; 2 -> auxiliary; Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) end. %%================================ %% AttributeUsage %%================================ enc_AttributeUsage(Val) -> enc_AttributeUsage(Val, [<<10>>]). enc_AttributeUsage(Val, TagIn) -> case Val of userApplications -> encode_tags(TagIn, [0], 1); directoryOperation -> encode_tags(TagIn, [1], 1); distributedOperation -> encode_tags(TagIn, [2], 1); dSAOperation -> encode_tags(TagIn, [3], 1); Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}}) end. dec_AttributeUsage(Tlv) -> dec_AttributeUsage(Tlv, [10]). dec_AttributeUsage(Tlv, TagIn) -> case decode_integer(Tlv, TagIn) of 0 -> userApplications; 1 -> directoryOperation; 2 -> distributedOperation; 3 -> dSAOperation; Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) end. %%================================ %% DITStructureRule %%================================ enc_DITStructureRule(Val) -> enc_DITStructureRule(Val, [<<48>>]). enc_DITStructureRule(Val, TagIn) -> {_,Cindex1,Cindex2,Cindex3} = Val, %%------------------------------------------------- %% attribute ruleIdentifier(1) with type INTEGER %%------------------------------------------------- {EncBytes1,EncLen1} = encode_integer(Cindex1, [<<2>>]), %%------------------------------------------------- %% attribute nameForm(2) with type OBJECT IDENTIFIER %%------------------------------------------------- {EncBytes2,EncLen2} = encode_object_identifier(Cindex2, [<<6>>]), %%------------------------------------------------- %% attribute superiorStructureRules(3) with type SET OF OPTIONAL %%------------------------------------------------- {EncBytes3,EncLen3} = case Cindex3 of asn1_NOVALUE -> {<<>>,0}; _ -> 'enc_DITStructureRule_superiorStructureRules'(Cindex3, [<<49>>]) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3], LenSoFar = EncLen1 + EncLen2 + EncLen3, encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% DITStructureRule_superiorStructureRules %%================================ enc_DITStructureRule_superiorStructureRules(Val, TagIn) -> {EncBytes,EncLen} = 'enc_DITStructureRule_superiorStructureRules_components'(Val,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_DITStructureRule_superiorStructureRules_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_DITStructureRule_superiorStructureRules_components'([H|T],AccBytes, AccLen) -> {EncBytes,EncLen} = encode_integer(H, [<<2>>]), 'enc_DITStructureRule_superiorStructureRules_components'(T,[EncBytes|AccBytes], AccLen + EncLen). dec_DITStructureRule(Tlv) -> dec_DITStructureRule(Tlv, [16]). dec_DITStructureRule(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- %% attribute ruleIdentifier(1) with type INTEGER %%------------------------------------------------- [V1|Tlv2] = Tlv1, Term1 = decode_integer(V1, [2]), %%------------------------------------------------- %% attribute nameForm(2) with type OBJECT IDENTIFIER %%------------------------------------------------- [V2|Tlv3] = Tlv2, Term2 = decode_object_identifier(V2, [6]), %%------------------------------------------------- %% attribute superiorStructureRules(3) with type SET OF OPTIONAL %%------------------------------------------------- {Term3,Tlv4} = case Tlv3 of [{17,V3}|TempTlv4] -> {'dec_DITStructureRule_superiorStructureRules'(V3, []), TempTlv4}; _ -> { asn1_NOVALUE, Tlv3} end, case Tlv4 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowed end, Res1 = {'DITStructureRule',Term1,Term2,Term3}, Res1. 'dec_DITStructureRule_superiorStructureRules'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), [decode_integer(V1, [2]) || V1 <- Tlv1]. %%================================ %% RuleIdentifier %%================================ enc_RuleIdentifier(Val) -> enc_RuleIdentifier(Val, [<<2>>]). enc_RuleIdentifier(Val, TagIn) -> encode_integer(Val, TagIn). dec_RuleIdentifier(Tlv) -> dec_RuleIdentifier(Tlv, [2]). dec_RuleIdentifier(Tlv, TagIn) -> decode_integer(Tlv, TagIn). %%================================ %% DITContentRule %%================================ enc_DITContentRule(Val) -> enc_DITContentRule(Val, [<<48>>]). enc_DITContentRule(Val, TagIn) -> {_,Cindex1,Cindex2,Cindex3,Cindex4,Cindex5} = Val, %%------------------------------------------------- %% attribute structuralObjectClass(1) with type OBJECT IDENTIFIER %%------------------------------------------------- {EncBytes1,EncLen1} = encode_object_identifier(Cindex1, [<<6>>]), %%------------------------------------------------- %% attribute auxiliaries(2) with type SET OF OPTIONAL %%------------------------------------------------- {EncBytes2,EncLen2} = case Cindex2 of asn1_NOVALUE -> {<<>>,0}; _ -> 'enc_DITContentRule_auxiliaries'(Cindex2, [<<49>>]) end, %%------------------------------------------------- %% attribute mandatory(3) with type SET OF OPTIONAL %%------------------------------------------------- {EncBytes3,EncLen3} = case Cindex3 of asn1_NOVALUE -> {<<>>,0}; _ -> 'enc_DITContentRule_mandatory'(Cindex3, [<<49>>,<<161>>]) end, %%------------------------------------------------- %% attribute optional(4) with type SET OF OPTIONAL %%------------------------------------------------- {EncBytes4,EncLen4} = case Cindex4 of asn1_NOVALUE -> {<<>>,0}; _ -> 'enc_DITContentRule_optional'(Cindex4, [<<49>>,<<162>>]) end, %%------------------------------------------------- %% attribute precluded(5) with type SET OF OPTIONAL %%------------------------------------------------- {EncBytes5,EncLen5} = case Cindex5 of asn1_NOVALUE -> {<<>>,0}; _ -> 'enc_DITContentRule_precluded'(Cindex5, [<<49>>,<<163>>]) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4, EncBytes5], LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5, encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% DITContentRule_auxiliaries %%================================ enc_DITContentRule_auxiliaries(Val, TagIn) -> {EncBytes,EncLen} = 'enc_DITContentRule_auxiliaries_components'(Val,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_DITContentRule_auxiliaries_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_DITContentRule_auxiliaries_components'([H|T],AccBytes, AccLen) -> {EncBytes,EncLen} = encode_object_identifier(H, [<<6>>]), 'enc_DITContentRule_auxiliaries_components'(T,[EncBytes|AccBytes], AccLen + EncLen). %%================================ %% DITContentRule_mandatory %%================================ enc_DITContentRule_mandatory(Val, TagIn) -> {EncBytes,EncLen} = 'enc_DITContentRule_mandatory_components'(Val,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_DITContentRule_mandatory_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_DITContentRule_mandatory_components'([H|T],AccBytes, AccLen) -> {EncBytes,EncLen} = encode_object_identifier(H, [<<6>>]), 'enc_DITContentRule_mandatory_components'(T,[EncBytes|AccBytes], AccLen + EncLen). %%================================ %% DITContentRule_optional %%================================ enc_DITContentRule_optional(Val, TagIn) -> {EncBytes,EncLen} = 'enc_DITContentRule_optional_components'(Val,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_DITContentRule_optional_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_DITContentRule_optional_components'([H|T],AccBytes, AccLen) -> {EncBytes,EncLen} = encode_object_identifier(H, [<<6>>]), 'enc_DITContentRule_optional_components'(T,[EncBytes|AccBytes], AccLen + EncLen). %%================================ %% DITContentRule_precluded %%================================ enc_DITContentRule_precluded(Val, TagIn) -> {EncBytes,EncLen} = 'enc_DITContentRule_precluded_components'(Val,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_DITContentRule_precluded_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_DITContentRule_precluded_components'([H|T],AccBytes, AccLen) -> {EncBytes,EncLen} = encode_object_identifier(H, [<<6>>]), 'enc_DITContentRule_precluded_components'(T,[EncBytes|AccBytes], AccLen + EncLen). dec_DITContentRule(Tlv) -> dec_DITContentRule(Tlv, [16]). dec_DITContentRule(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- %% attribute structuralObjectClass(1) with type OBJECT IDENTIFIER %%------------------------------------------------- [V1|Tlv2] = Tlv1, Term1 = decode_object_identifier(V1, [6]), %%------------------------------------------------- %% attribute auxiliaries(2) with type SET OF OPTIONAL %%------------------------------------------------- {Term2,Tlv3} = case Tlv2 of [{17,V2}|TempTlv3] -> {'dec_DITContentRule_auxiliaries'(V2, []), TempTlv3}; _ -> { asn1_NOVALUE, Tlv2} end, %%------------------------------------------------- %% attribute mandatory(3) with type SET OF OPTIONAL %%------------------------------------------------- {Term3,Tlv4} = case Tlv3 of [{131073,V3}|TempTlv4] -> {'dec_DITContentRule_mandatory'(V3, [17]), TempTlv4}; _ -> { asn1_NOVALUE, Tlv3} end, %%------------------------------------------------- %% attribute optional(4) with type SET OF OPTIONAL %%------------------------------------------------- {Term4,Tlv5} = case Tlv4 of [{131074,V4}|TempTlv5] -> {'dec_DITContentRule_optional'(V4, [17]), TempTlv5}; _ -> { asn1_NOVALUE, Tlv4} end, %%------------------------------------------------- %% attribute precluded(5) with type SET OF OPTIONAL %%------------------------------------------------- {Term5,Tlv6} = case Tlv5 of [{131075,V5}|TempTlv6] -> {'dec_DITContentRule_precluded'(V5, [17]), TempTlv6}; _ -> { asn1_NOVALUE, Tlv5} end, case Tlv6 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv6}}}) % extra fields not allowed end, Res1 = {'DITContentRule',Term1,Term2,Term3,Term4,Term5}, Res1. 'dec_DITContentRule_auxiliaries'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), [decode_object_identifier(V1, [6]) || V1 <- Tlv1]. 'dec_DITContentRule_mandatory'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), [decode_object_identifier(V1, [6]) || V1 <- Tlv1]. 'dec_DITContentRule_optional'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), [decode_object_identifier(V1, [6]) || V1 <- Tlv1]. 'dec_DITContentRule_precluded'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), [decode_object_identifier(V1, [6]) || V1 <- Tlv1]. %%================================ %% DITContextUse %%================================ enc_DITContextUse(Val) -> enc_DITContextUse(Val, [<<48>>]). enc_DITContextUse(Val, TagIn) -> {_,Cindex1,Cindex2,Cindex3} = Val, %%------------------------------------------------- %% attribute attributeType(1) with type OBJECT IDENTIFIER %%------------------------------------------------- {EncBytes1,EncLen1} = encode_object_identifier(Cindex1, [<<6>>]), %%------------------------------------------------- %% attribute mandatoryContexts(2) with type SET OF OPTIONAL %%------------------------------------------------- {EncBytes2,EncLen2} = case Cindex2 of asn1_NOVALUE -> {<<>>,0}; _ -> 'enc_DITContextUse_mandatoryContexts'(Cindex2, [<<49>>,<<161>>]) end, %%------------------------------------------------- %% attribute optionalContexts(3) with type SET OF OPTIONAL %%------------------------------------------------- {EncBytes3,EncLen3} = case Cindex3 of asn1_NOVALUE -> {<<>>,0}; _ -> 'enc_DITContextUse_optionalContexts'(Cindex3, [<<49>>,<<162>>]) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3], LenSoFar = EncLen1 + EncLen2 + EncLen3, encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% DITContextUse_mandatoryContexts %%================================ enc_DITContextUse_mandatoryContexts(Val, TagIn) -> {EncBytes,EncLen} = 'enc_DITContextUse_mandatoryContexts_components'(Val,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_DITContextUse_mandatoryContexts_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_DITContextUse_mandatoryContexts_components'([H|T],AccBytes, AccLen) -> {EncBytes,EncLen} = encode_object_identifier(H, [<<6>>]), 'enc_DITContextUse_mandatoryContexts_components'(T,[EncBytes|AccBytes], AccLen + EncLen). %%================================ %% DITContextUse_optionalContexts %%================================ enc_DITContextUse_optionalContexts(Val, TagIn) -> {EncBytes,EncLen} = 'enc_DITContextUse_optionalContexts_components'(Val,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_DITContextUse_optionalContexts_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_DITContextUse_optionalContexts_components'([H|T],AccBytes, AccLen) -> {EncBytes,EncLen} = encode_object_identifier(H, [<<6>>]), 'enc_DITContextUse_optionalContexts_components'(T,[EncBytes|AccBytes], AccLen + EncLen). dec_DITContextUse(Tlv) -> dec_DITContextUse(Tlv, [16]). dec_DITContextUse(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- %% attribute attributeType(1) with type OBJECT IDENTIFIER %%------------------------------------------------- [V1|Tlv2] = Tlv1, Term1 = decode_object_identifier(V1, [6]), %%------------------------------------------------- %% attribute mandatoryContexts(2) with type SET OF OPTIONAL %%------------------------------------------------- {Term2,Tlv3} = case Tlv2 of [{131073,V2}|TempTlv3] -> {'dec_DITContextUse_mandatoryContexts'(V2, [17]), TempTlv3}; _ -> { asn1_NOVALUE, Tlv2} end, %%------------------------------------------------- %% attribute optionalContexts(3) with type SET OF OPTIONAL %%------------------------------------------------- {Term3,Tlv4} = case Tlv3 of [{131074,V3}|TempTlv4] -> {'dec_DITContextUse_optionalContexts'(V3, [17]), TempTlv4}; _ -> { asn1_NOVALUE, Tlv3} end, case Tlv4 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowed end, Res1 = {'DITContextUse',Term1,Term2,Term3}, Res1. 'dec_DITContextUse_mandatoryContexts'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), [decode_object_identifier(V1, [6]) || V1 <- Tlv1]. 'dec_DITContextUse_optionalContexts'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), [decode_object_identifier(V1, [6]) || V1 <- Tlv1]. %%================================ %% SearchRuleDescription %%================================ enc_SearchRuleDescription(Val) -> enc_SearchRuleDescription(Val, [<<48>>]). enc_SearchRuleDescription(Val, TagIn) -> {_,Cindex1,Cindex2,Cindex3,Cindex4,Cindex5,Cindex6,Cindex7,Cindex8,Cindex9,Cindex10,Cindex11,Cindex12,Cindex13,Cindex14,Cindex15,Cindex16,Cindex17,Cindex18,Cindex19,Cindex20} = Val, %%------------------------------------------------- %% attribute id(1) with type INTEGER %%------------------------------------------------- {EncBytes1,EncLen1} = encode_integer(Cindex1, [<<2>>]), %%------------------------------------------------- %% attribute dmdId(2) with type OBJECT IDENTIFIER %%------------------------------------------------- {EncBytes2,EncLen2} = encode_object_identifier(Cindex2, [<<6>>,<<160>>]), %%------------------------------------------------- %% attribute serviceType(3) with type OBJECT IDENTIFIER OPTIONAL %%------------------------------------------------- {EncBytes3,EncLen3} = case Cindex3 of asn1_NOVALUE -> {<<>>,0}; _ -> encode_object_identifier(Cindex3, [<<6>>,<<161>>]) end, %%------------------------------------------------- %% attribute userClass(4) with type INTEGER OPTIONAL %%------------------------------------------------- {EncBytes4,EncLen4} = case Cindex4 of asn1_NOVALUE -> {<<>>,0}; _ -> encode_integer(Cindex4, [<<2>>,<<162>>]) end, %%------------------------------------------------- %% attribute inputAttributeTypes(5) with type SEQUENCE OF OPTIONAL %%------------------------------------------------- {EncBytes5,EncLen5} = case Cindex5 of asn1_NOVALUE -> {<<>>,0}; _ -> 'enc_SearchRuleDescription_inputAttributeTypes'(Cindex5, [<<48>>,<<163>>]) end, %%------------------------------------------------- %% attribute attributeCombination(6) External InformationFramework:AttributeCombination DEFAULT = {'and',[]} %%------------------------------------------------- {EncBytes6,EncLen6} = case Cindex6 of asn1_DEFAULT -> {<<>>,0}; _ when Cindex6 =:= {'and',[]} -> {<<>>,0}; _ -> 'enc_AttributeCombination'(Cindex6, [<<164>>]) end, %%------------------------------------------------- %% attribute outputAttributeTypes(7) with type SEQUENCE OF OPTIONAL %%------------------------------------------------- {EncBytes7,EncLen7} = case Cindex7 of asn1_NOVALUE -> {<<>>,0}; _ -> 'enc_SearchRuleDescription_outputAttributeTypes'(Cindex7, [<<48>>,<<165>>]) end, %%------------------------------------------------- %% attribute defaultControls(8) External InformationFramework:ControlOptions OPTIONAL %%------------------------------------------------- {EncBytes8,EncLen8} = case Cindex8 of asn1_NOVALUE -> {<<>>,0}; _ -> 'enc_ControlOptions'(Cindex8, [<<48>>,<<166>>]) end, %%------------------------------------------------- %% attribute mandatoryControls(9) External InformationFramework:ControlOptions OPTIONAL %%------------------------------------------------- {EncBytes9,EncLen9} = case Cindex9 of asn1_NOVALUE -> {<<>>,0}; _ -> 'enc_ControlOptions'(Cindex9, [<<48>>,<<167>>]) end, %%------------------------------------------------- %% attribute searchRuleControls(10) External InformationFramework:ControlOptions OPTIONAL %%------------------------------------------------- {EncBytes10,EncLen10} = case Cindex10 of asn1_NOVALUE -> {<<>>,0}; _ -> 'enc_ControlOptions'(Cindex10, [<<48>>,<<168>>]) end, %%------------------------------------------------- %% attribute familyGrouping(11) with type ENUMERATED OPTIONAL %%------------------------------------------------- {EncBytes11,EncLen11} = case Cindex11 of asn1_NOVALUE -> {<<>>,0}; _ -> case Cindex11 of entryOnly -> encode_tags([<<10>>,<<169>>], [1], 1); compoundEntry -> encode_tags([<<10>>,<<169>>], [2], 1); strands -> encode_tags([<<10>>,<<169>>], [3], 1); multiStrand -> encode_tags([<<10>>,<<169>>], [4], 1); Enumval5 -> exit({error,{asn1, {enumerated_not_in_range,Enumval5}}}) end end, %%------------------------------------------------- %% attribute familyReturn(12) External DirectoryAbstractService:FamilyReturn OPTIONAL %%------------------------------------------------- {EncBytes12,EncLen12} = case Cindex12 of asn1_NOVALUE -> {<<>>,0}; _ -> 'DirectoryAbstractService':'enc_FamilyReturn'(Cindex12, [<<48>>,<<170>>]) end, %%------------------------------------------------- %% attribute relaxation(13) External InformationFramework:RelaxationPolicy OPTIONAL %%------------------------------------------------- {EncBytes13,EncLen13} = case Cindex13 of asn1_NOVALUE -> {<<>>,0}; _ -> 'enc_RelaxationPolicy'(Cindex13, [<<48>>,<<171>>]) end, %%------------------------------------------------- %% attribute additionalControl(14) with type SEQUENCE OF OPTIONAL %%------------------------------------------------- {EncBytes14,EncLen14} = case Cindex14 of asn1_NOVALUE -> {<<>>,0}; _ -> 'enc_SearchRuleDescription_additionalControl'(Cindex14, [<<48>>,<<172>>]) end, %%------------------------------------------------- %% attribute allowedSubset(15) with type BIT STRING DEFAULT = <<7:3>> %%------------------------------------------------- {EncBytes15,EncLen15} = case Cindex15 of asn1_DEFAULT -> {<<>>,0}; _ when Cindex15 =:= <<7:3>> -> {<<>>,0}; _ -> encode_named_bit_string(Cindex15, [{baseObject,0},{oneLevel,1},{wholeSubtree,2}], [<<3>>,<<173>>]) end, %%------------------------------------------------- %% attribute imposedSubset(16) with type ENUMERATED OPTIONAL %%------------------------------------------------- {EncBytes16,EncLen16} = case Cindex16 of asn1_NOVALUE -> {<<>>,0}; _ -> case Cindex16 of baseObject -> encode_tags([<<10>>,<<174>>], [0], 1); oneLevel -> encode_tags([<<10>>,<<174>>], [1], 1); wholeSubtree -> encode_tags([<<10>>,<<174>>], [2], 1); Enumval7 -> exit({error,{asn1, {enumerated_not_in_range,Enumval7}}}) end end, %%------------------------------------------------- %% attribute entryLimit(17) External InformationFramework:EntryLimit OPTIONAL %%------------------------------------------------- {EncBytes17,EncLen17} = case Cindex17 of asn1_NOVALUE -> {<<>>,0}; _ -> 'enc_EntryLimit'(Cindex17, [<<48>>,<<175>>]) end, %%------------------------------------------------- %% attribute name(18) with type SET OF OPTIONAL %%------------------------------------------------- {EncBytes18,EncLen18} = case Cindex18 of asn1_NOVALUE -> {<<>>,0}; _ -> 'enc_SearchRuleDescription_name'(Cindex18, [<<49>>,<<188>>]) end, %%------------------------------------------------- %% attribute description(19) with type CHOICE OPTIONAL %%------------------------------------------------- {EncBytes19,EncLen19} = case Cindex19 of asn1_NOVALUE -> {<<>>,0}; _ -> 'enc_SearchRuleDescription_description'(Cindex19, [<<189>>]) end, %%------------------------------------------------- %% attribute obsolete(20) with type BOOLEAN DEFAULT = false %%------------------------------------------------- {EncBytes20,EncLen20} = case Cindex20 of asn1_DEFAULT -> {<<>>,0}; _ when Cindex20 =:= false -> {<<>>,0}; _ -> encode_boolean(Cindex20, [<<1>>,<<190>>]) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4, EncBytes5, EncBytes6, EncBytes7, EncBytes8, EncBytes9, EncBytes10, EncBytes11, EncBytes12, EncBytes13, EncBytes14, EncBytes15, EncBytes16, EncBytes17, EncBytes18, EncBytes19, EncBytes20], LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5 + EncLen6 + EncLen7 + EncLen8 + EncLen9 + EncLen10 + EncLen11 + EncLen12 + EncLen13 + EncLen14 + EncLen15 + EncLen16 + EncLen17 + EncLen18 + EncLen19 + EncLen20, encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% SearchRuleDescription_inputAttributeTypes %%================================ enc_SearchRuleDescription_inputAttributeTypes(Val, TagIn) -> {EncBytes,EncLen} = 'enc_SearchRuleDescription_inputAttributeTypes_components'(Val,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_SearchRuleDescription_inputAttributeTypes_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_SearchRuleDescription_inputAttributeTypes_components'([H|T],AccBytes, AccLen) -> {EncBytes,EncLen} = 'enc_RequestAttribute'(H, [<<48>>]), 'enc_SearchRuleDescription_inputAttributeTypes_components'(T,[EncBytes|AccBytes], AccLen + EncLen). %%================================ %% SearchRuleDescription_outputAttributeTypes %%================================ enc_SearchRuleDescription_outputAttributeTypes(Val, TagIn) -> {EncBytes,EncLen} = 'enc_SearchRuleDescription_outputAttributeTypes_components'(Val,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_SearchRuleDescription_outputAttributeTypes_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_SearchRuleDescription_outputAttributeTypes_components'([H|T],AccBytes, AccLen) -> {EncBytes,EncLen} = 'enc_ResultAttribute'(H, [<<48>>]), 'enc_SearchRuleDescription_outputAttributeTypes_components'(T,[EncBytes|AccBytes], AccLen + EncLen). %%================================ %% SearchRuleDescription_additionalControl %%================================ enc_SearchRuleDescription_additionalControl(Val, TagIn) -> {EncBytes,EncLen} = 'enc_SearchRuleDescription_additionalControl_components'(Val,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_SearchRuleDescription_additionalControl_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_SearchRuleDescription_additionalControl_components'([H|T],AccBytes, AccLen) -> {EncBytes,EncLen} = encode_object_identifier(H, [<<6>>]), 'enc_SearchRuleDescription_additionalControl_components'(T,[EncBytes|AccBytes], AccLen + EncLen). %%================================ %% SearchRuleDescription_name %%================================ enc_SearchRuleDescription_name(Val, TagIn) -> {EncBytes,EncLen} = 'enc_SearchRuleDescription_name_components'(Val,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_SearchRuleDescription_name_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_SearchRuleDescription_name_components'([H|T],AccBytes, AccLen) -> {EncBytes,EncLen} = 'enc_SearchRuleDescription_name_SETOF'(H, []), 'enc_SearchRuleDescription_name_components'(T,[EncBytes|AccBytes], AccLen + EncLen). %%================================ %% SearchRuleDescription_name_SETOF %%================================ enc_SearchRuleDescription_name_SETOF(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of teletexString -> encode_restricted_string(element(2,Val), [<<20>>]); printableString -> encode_restricted_string(element(2,Val), [<<19>>]); universalString -> encode_universal_string(element(2,Val), [<<28>>]); bmpString -> encode_BMP_string(element(2,Val), [<<30>>]); uTF8String -> encode_UTF8_string(element(2,Val), [<<12>>]); utf8String -> encode_UTF8_string(element(2,Val), [<<12>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, encode_tags(TagIn, EncBytes, EncLen). %%================================ %% SearchRuleDescription_description %%================================ enc_SearchRuleDescription_description(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of teletexString -> encode_restricted_string(element(2,Val), [<<20>>]); printableString -> encode_restricted_string(element(2,Val), [<<19>>]); universalString -> encode_universal_string(element(2,Val), [<<28>>]); bmpString -> encode_BMP_string(element(2,Val), [<<30>>]); uTF8String -> encode_UTF8_string(element(2,Val), [<<12>>]); utf8String -> encode_UTF8_string(element(2,Val), [<<12>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, encode_tags(TagIn, EncBytes, EncLen). dec_SearchRuleDescription(Tlv) -> dec_SearchRuleDescription(Tlv, [16]). dec_SearchRuleDescription(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- %% attribute id(1) with type INTEGER %%------------------------------------------------- [V1|Tlv2] = Tlv1, Term1 = decode_integer(V1, [2]), %%------------------------------------------------- %% attribute dmdId(2) with type OBJECT IDENTIFIER %%------------------------------------------------- [V2|Tlv3] = Tlv2, Term2 = decode_object_identifier(V2, [131072,6]), %%------------------------------------------------- %% attribute serviceType(3) with type OBJECT IDENTIFIER OPTIONAL %%------------------------------------------------- {Term3,Tlv4} = case Tlv3 of [{131073,V3}|TempTlv4] -> {decode_object_identifier(V3, [6]), TempTlv4}; _ -> { asn1_NOVALUE, Tlv3} end, %%------------------------------------------------- %% attribute userClass(4) with type INTEGER OPTIONAL %%------------------------------------------------- {Term4,Tlv5} = case Tlv4 of [{131074,V4}|TempTlv5] -> {decode_integer(V4, [2]), TempTlv5}; _ -> { asn1_NOVALUE, Tlv4} end, %%------------------------------------------------- %% attribute inputAttributeTypes(5) with type SEQUENCE OF OPTIONAL %%------------------------------------------------- {Term5,Tlv6} = case Tlv5 of [{131075,V5}|TempTlv6] -> {'dec_SearchRuleDescription_inputAttributeTypes'(V5, [16]), TempTlv6}; _ -> { asn1_NOVALUE, Tlv5} end, %%------------------------------------------------- %% attribute attributeCombination(6) External InformationFramework:AttributeCombination DEFAULT = {'and',[]} %%------------------------------------------------- {Term6,Tlv7} = case Tlv6 of [{131076,V6}|TempTlv7] -> {'dec_AttributeCombination'(V6, []), TempTlv7}; _ -> {{'and',[]},Tlv6} end, %%------------------------------------------------- %% attribute outputAttributeTypes(7) with type SEQUENCE OF OPTIONAL %%------------------------------------------------- {Term7,Tlv8} = case Tlv7 of [{131077,V7}|TempTlv8] -> {'dec_SearchRuleDescription_outputAttributeTypes'(V7, [16]), TempTlv8}; _ -> { asn1_NOVALUE, Tlv7} end, %%------------------------------------------------- %% attribute defaultControls(8) External InformationFramework:ControlOptions OPTIONAL %%------------------------------------------------- {Term8,Tlv9} = case Tlv8 of [{131078,V8}|TempTlv9] -> {'dec_ControlOptions'(V8, [16]), TempTlv9}; _ -> { asn1_NOVALUE, Tlv8} end, %%------------------------------------------------- %% attribute mandatoryControls(9) External InformationFramework:ControlOptions OPTIONAL %%------------------------------------------------- {Term9,Tlv10} = case Tlv9 of [{131079,V9}|TempTlv10] -> {'dec_ControlOptions'(V9, [16]), TempTlv10}; _ -> { asn1_NOVALUE, Tlv9} end, %%------------------------------------------------- %% attribute searchRuleControls(10) External InformationFramework:ControlOptions OPTIONAL %%------------------------------------------------- {Term10,Tlv11} = case Tlv10 of [{131080,V10}|TempTlv11] -> {'dec_ControlOptions'(V10, [16]), TempTlv11}; _ -> { asn1_NOVALUE, Tlv10} end, %%------------------------------------------------- %% attribute familyGrouping(11) with type ENUMERATED OPTIONAL %%------------------------------------------------- {Term11,Tlv12} = case Tlv11 of [{131081,V11}|TempTlv12] -> {case decode_integer(V11, [10]) of 1 -> entryOnly; 2 -> compoundEntry; 3 -> strands; 4 -> multiStrand; Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) end, TempTlv12}; _ -> { asn1_NOVALUE, Tlv11} end, %%------------------------------------------------- %% attribute familyReturn(12) External DirectoryAbstractService:FamilyReturn OPTIONAL %%------------------------------------------------- {Term12,Tlv13} = case Tlv12 of [{131082,V12}|TempTlv13] -> {'DirectoryAbstractService':'dec_FamilyReturn'(V12, [16]), TempTlv13}; _ -> { asn1_NOVALUE, Tlv12} end, %%------------------------------------------------- %% attribute relaxation(13) External InformationFramework:RelaxationPolicy OPTIONAL %%------------------------------------------------- {Term13,Tlv14} = case Tlv13 of [{131083,V13}|TempTlv14] -> {'dec_RelaxationPolicy'(V13, [16]), TempTlv14}; _ -> { asn1_NOVALUE, Tlv13} end, %%------------------------------------------------- %% attribute additionalControl(14) with type SEQUENCE OF OPTIONAL %%------------------------------------------------- {Term14,Tlv15} = case Tlv14 of [{131084,V14}|TempTlv15] -> {'dec_SearchRuleDescription_additionalControl'(V14, [16]), TempTlv15}; _ -> { asn1_NOVALUE, Tlv14} end, %%------------------------------------------------- %% attribute allowedSubset(15) with type BIT STRING DEFAULT = <<7:3>> %%------------------------------------------------- {Term15,Tlv16} = case Tlv15 of [{131085,V15}|TempTlv16] -> {decode_named_bit_string(V15, [{baseObject,0},{oneLevel,1},{wholeSubtree,2}], [3]), TempTlv16}; _ -> {<<7:3>>,Tlv15} end, %%------------------------------------------------- %% attribute imposedSubset(16) with type ENUMERATED OPTIONAL %%------------------------------------------------- {Term16,Tlv17} = case Tlv16 of [{131086,V16}|TempTlv17] -> {case decode_integer(V16, [10]) of 0 -> baseObject; 1 -> oneLevel; 2 -> wholeSubtree; Default2 -> exit({error,{asn1,{illegal_enumerated,Default2}}}) end, TempTlv17}; _ -> { asn1_NOVALUE, Tlv16} end, %%------------------------------------------------- %% attribute entryLimit(17) External InformationFramework:EntryLimit OPTIONAL %%------------------------------------------------- {Term17,Tlv18} = case Tlv17 of [{131087,V17}|TempTlv18] -> {'dec_EntryLimit'(V17, [16]), TempTlv18}; _ -> { asn1_NOVALUE, Tlv17} end, %%------------------------------------------------- %% attribute name(18) with type SET OF OPTIONAL %%------------------------------------------------- {Term18,Tlv19} = case Tlv18 of [{131100,V18}|TempTlv19] -> {'dec_SearchRuleDescription_name'(V18, [17]), TempTlv19}; _ -> { asn1_NOVALUE, Tlv18} end, %%------------------------------------------------- %% attribute description(19) with type CHOICE OPTIONAL %%------------------------------------------------- {Term19,Tlv20} = case Tlv19 of [{131101,V19}|TempTlv20] -> {'dec_SearchRuleDescription_description'(V19, []), TempTlv20}; _ -> { asn1_NOVALUE, Tlv19} end, %%------------------------------------------------- %% attribute obsolete(20) with type BOOLEAN DEFAULT = false %%------------------------------------------------- {Term20,Tlv21} = case Tlv20 of [{131102,V20}|TempTlv21] -> {decode_boolean(V20, [1]), TempTlv21}; _ -> {false,Tlv20} end, case Tlv21 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv21}}}) % extra fields not allowed end, Res1 = {'SearchRuleDescription',Term1,Term2,Term3,Term4,Term5,Term6,Term7,Term8,Term9,Term10,Term11,Term12,Term13,Term14,Term15,Term16,Term17,Term18,Term19,Term20}, Res1. 'dec_SearchRuleDescription_inputAttributeTypes'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), ['dec_RequestAttribute'(V1, [16]) || V1 <- Tlv1]. 'dec_SearchRuleDescription_outputAttributeTypes'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), ['dec_ResultAttribute'(V1, [16]) || V1 <- Tlv1]. 'dec_SearchRuleDescription_additionalControl'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), [decode_object_identifier(V1, [6]) || V1 <- Tlv1]. 'dec_SearchRuleDescription_name'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), ['dec_SearchRuleDescription_name_SETOF'(V1, []) || V1 <- Tlv1]. 'dec_SearchRuleDescription_name_SETOF'(Tlv, TagIn) -> Tlv1 = match_tags(Tlv, TagIn), case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of %% 'teletexString' {20, V1} -> {teletexString, begin Val1 = decode_restricted_string(V1, []), C1 = byte_size(Val1), if 1 =< C1, C1 =< 17 -> binary_to_list(Val1); true -> exit({error,{asn1,bad_range}}) end end}; %% 'printableString' {19, V1} -> {printableString, begin Val2 = decode_restricted_string(V1, []), C2 = byte_size(Val2), if 1 =< C2, C2 =< 17 -> binary_to_list(Val2); true -> exit({error,{asn1,bad_range}}) end end}; %% 'universalString' {28, V1} -> {universalString, begin Val3 = decode_universal_string(V1, []), C3 = length(Val3), if 1 =< C3, C3 =< 17 -> Val3; true -> exit({error,{asn1,bad_range}}) end end}; %% 'bmpString' {30, V1} -> {bmpString, begin Val4 = decode_BMP_string(V1, []), C4 = length(Val4), if 1 =< C4, C4 =< 17 -> Val4; true -> exit({error,{asn1,bad_range}}) end end}; %% 'uTF8String' {12, V1} -> {uTF8String, decode_UTF8_string(V1, [])}; Else -> exit({error,{asn1,{invalid_choice_tag,Else}}}) end . 'dec_SearchRuleDescription_description'(Tlv, TagIn) -> Tlv1 = match_tags(Tlv, TagIn), case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of %% 'teletexString' {20, V1} -> {teletexString, begin Val1 = decode_restricted_string(V1, []), C1 = byte_size(Val1), if 1 =< C1, C1 =< 17 -> binary_to_list(Val1); true -> exit({error,{asn1,bad_range}}) end end}; %% 'printableString' {19, V1} -> {printableString, begin Val2 = decode_restricted_string(V1, []), C2 = byte_size(Val2), if 1 =< C2, C2 =< 17 -> binary_to_list(Val2); true -> exit({error,{asn1,bad_range}}) end end}; %% 'universalString' {28, V1} -> {universalString, begin Val3 = decode_universal_string(V1, []), C3 = length(Val3), if 1 =< C3, C3 =< 17 -> Val3; true -> exit({error,{asn1,bad_range}}) end end}; %% 'bmpString' {30, V1} -> {bmpString, begin Val4 = decode_BMP_string(V1, []), C4 = length(Val4), if 1 =< C4, C4 =< 17 -> Val4; true -> exit({error,{asn1,bad_range}}) end end}; %% 'uTF8String' {12, V1} -> {uTF8String, decode_UTF8_string(V1, [])}; Else -> exit({error,{asn1,{invalid_choice_tag,Else}}}) end . %%================================ %% SearchRule %%================================ enc_SearchRule(Val) -> enc_SearchRule(Val, [<<48>>]). enc_SearchRule(Val, TagIn) -> {_,Cindex1,Cindex2,Cindex3,Cindex4,Cindex5,Cindex6,Cindex7,Cindex8,Cindex9,Cindex10,Cindex11,Cindex12,Cindex13,Cindex14,Cindex15,Cindex16,Cindex17} = Val, %%------------------------------------------------- %% attribute id(1) with type INTEGER %%------------------------------------------------- {EncBytes1,EncLen1} = encode_integer(Cindex1, [<<2>>]), %%------------------------------------------------- %% attribute dmdId(2) with type OBJECT IDENTIFIER %%------------------------------------------------- {EncBytes2,EncLen2} = encode_object_identifier(Cindex2, [<<6>>,<<160>>]), %%------------------------------------------------- %% attribute serviceType(3) with type OBJECT IDENTIFIER OPTIONAL %%------------------------------------------------- {EncBytes3,EncLen3} = case Cindex3 of asn1_NOVALUE -> {<<>>,0}; _ -> encode_object_identifier(Cindex3, [<<6>>,<<161>>]) end, %%------------------------------------------------- %% attribute userClass(4) with type INTEGER OPTIONAL %%------------------------------------------------- {EncBytes4,EncLen4} = case Cindex4 of asn1_NOVALUE -> {<<>>,0}; _ -> encode_integer(Cindex4, [<<2>>,<<162>>]) end, %%------------------------------------------------- %% attribute inputAttributeTypes(5) with type SEQUENCE OF OPTIONAL %%------------------------------------------------- {EncBytes5,EncLen5} = case Cindex5 of asn1_NOVALUE -> {<<>>,0}; _ -> 'enc_SearchRule_inputAttributeTypes'(Cindex5, [<<48>>,<<163>>]) end, %%------------------------------------------------- %% attribute attributeCombination(6) External InformationFramework:AttributeCombination DEFAULT = {'and',[]} %%------------------------------------------------- {EncBytes6,EncLen6} = case Cindex6 of asn1_DEFAULT -> {<<>>,0}; _ when Cindex6 =:= {'and',[]} -> {<<>>,0}; _ -> 'enc_AttributeCombination'(Cindex6, [<<164>>]) end, %%------------------------------------------------- %% attribute outputAttributeTypes(7) with type SEQUENCE OF OPTIONAL %%------------------------------------------------- {EncBytes7,EncLen7} = case Cindex7 of asn1_NOVALUE -> {<<>>,0}; _ -> 'enc_SearchRule_outputAttributeTypes'(Cindex7, [<<48>>,<<165>>]) end, %%------------------------------------------------- %% attribute defaultControls(8) External InformationFramework:ControlOptions OPTIONAL %%------------------------------------------------- {EncBytes8,EncLen8} = case Cindex8 of asn1_NOVALUE -> {<<>>,0}; _ -> 'enc_ControlOptions'(Cindex8, [<<48>>,<<166>>]) end, %%------------------------------------------------- %% attribute mandatoryControls(9) External InformationFramework:ControlOptions OPTIONAL %%------------------------------------------------- {EncBytes9,EncLen9} = case Cindex9 of asn1_NOVALUE -> {<<>>,0}; _ -> 'enc_ControlOptions'(Cindex9, [<<48>>,<<167>>]) end, %%------------------------------------------------- %% attribute searchRuleControls(10) External InformationFramework:ControlOptions OPTIONAL %%------------------------------------------------- {EncBytes10,EncLen10} = case Cindex10 of asn1_NOVALUE -> {<<>>,0}; _ -> 'enc_ControlOptions'(Cindex10, [<<48>>,<<168>>]) end, %%------------------------------------------------- %% attribute familyGrouping(11) with type ENUMERATED OPTIONAL %%------------------------------------------------- {EncBytes11,EncLen11} = case Cindex11 of asn1_NOVALUE -> {<<>>,0}; _ -> case Cindex11 of entryOnly -> encode_tags([<<10>>,<<169>>], [1], 1); compoundEntry -> encode_tags([<<10>>,<<169>>], [2], 1); strands -> encode_tags([<<10>>,<<169>>], [3], 1); multiStrand -> encode_tags([<<10>>,<<169>>], [4], 1); Enumval5 -> exit({error,{asn1, {enumerated_not_in_range,Enumval5}}}) end end, %%------------------------------------------------- %% attribute familyReturn(12) External DirectoryAbstractService:FamilyReturn OPTIONAL %%------------------------------------------------- {EncBytes12,EncLen12} = case Cindex12 of asn1_NOVALUE -> {<<>>,0}; _ -> 'DirectoryAbstractService':'enc_FamilyReturn'(Cindex12, [<<48>>,<<170>>]) end, %%------------------------------------------------- %% attribute relaxation(13) External InformationFramework:RelaxationPolicy OPTIONAL %%------------------------------------------------- {EncBytes13,EncLen13} = case Cindex13 of asn1_NOVALUE -> {<<>>,0}; _ -> 'enc_RelaxationPolicy'(Cindex13, [<<48>>,<<171>>]) end, %%------------------------------------------------- %% attribute additionalControl(14) with type SEQUENCE OF OPTIONAL %%------------------------------------------------- {EncBytes14,EncLen14} = case Cindex14 of asn1_NOVALUE -> {<<>>,0}; _ -> 'enc_SearchRule_additionalControl'(Cindex14, [<<48>>,<<172>>]) end, %%------------------------------------------------- %% attribute allowedSubset(15) with type BIT STRING DEFAULT = <<7:3>> %%------------------------------------------------- {EncBytes15,EncLen15} = case Cindex15 of asn1_DEFAULT -> {<<>>,0}; _ when Cindex15 =:= <<7:3>> -> {<<>>,0}; _ -> encode_named_bit_string(Cindex15, [{baseObject,0},{oneLevel,1},{wholeSubtree,2}], [<<3>>,<<173>>]) end, %%------------------------------------------------- %% attribute imposedSubset(16) with type ENUMERATED OPTIONAL %%------------------------------------------------- {EncBytes16,EncLen16} = case Cindex16 of asn1_NOVALUE -> {<<>>,0}; _ -> case Cindex16 of baseObject -> encode_tags([<<10>>,<<174>>], [0], 1); oneLevel -> encode_tags([<<10>>,<<174>>], [1], 1); wholeSubtree -> encode_tags([<<10>>,<<174>>], [2], 1); Enumval7 -> exit({error,{asn1, {enumerated_not_in_range,Enumval7}}}) end end, %%------------------------------------------------- %% attribute entryLimit(17) External InformationFramework:EntryLimit OPTIONAL %%------------------------------------------------- {EncBytes17,EncLen17} = case Cindex17 of asn1_NOVALUE -> {<<>>,0}; _ -> 'enc_EntryLimit'(Cindex17, [<<48>>,<<175>>]) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4, EncBytes5, EncBytes6, EncBytes7, EncBytes8, EncBytes9, EncBytes10, EncBytes11, EncBytes12, EncBytes13, EncBytes14, EncBytes15, EncBytes16, EncBytes17], LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5 + EncLen6 + EncLen7 + EncLen8 + EncLen9 + EncLen10 + EncLen11 + EncLen12 + EncLen13 + EncLen14 + EncLen15 + EncLen16 + EncLen17, encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% SearchRule_inputAttributeTypes %%================================ enc_SearchRule_inputAttributeTypes(Val, TagIn) -> {EncBytes,EncLen} = 'enc_SearchRule_inputAttributeTypes_components'(Val,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_SearchRule_inputAttributeTypes_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_SearchRule_inputAttributeTypes_components'([H|T],AccBytes, AccLen) -> {EncBytes,EncLen} = 'enc_RequestAttribute'(H, [<<48>>]), 'enc_SearchRule_inputAttributeTypes_components'(T,[EncBytes|AccBytes], AccLen + EncLen). %%================================ %% SearchRule_outputAttributeTypes %%================================ enc_SearchRule_outputAttributeTypes(Val, TagIn) -> {EncBytes,EncLen} = 'enc_SearchRule_outputAttributeTypes_components'(Val,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_SearchRule_outputAttributeTypes_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_SearchRule_outputAttributeTypes_components'([H|T],AccBytes, AccLen) -> {EncBytes,EncLen} = 'enc_ResultAttribute'(H, [<<48>>]), 'enc_SearchRule_outputAttributeTypes_components'(T,[EncBytes|AccBytes], AccLen + EncLen). %%================================ %% SearchRule_additionalControl %%================================ enc_SearchRule_additionalControl(Val, TagIn) -> {EncBytes,EncLen} = 'enc_SearchRule_additionalControl_components'(Val,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_SearchRule_additionalControl_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_SearchRule_additionalControl_components'([H|T],AccBytes, AccLen) -> {EncBytes,EncLen} = encode_object_identifier(H, [<<6>>]), 'enc_SearchRule_additionalControl_components'(T,[EncBytes|AccBytes], AccLen + EncLen). dec_SearchRule(Tlv) -> dec_SearchRule(Tlv, [16]). dec_SearchRule(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- %% attribute id(1) with type INTEGER %%------------------------------------------------- [V1|Tlv2] = Tlv1, Term1 = decode_integer(V1, [2]), %%------------------------------------------------- %% attribute dmdId(2) with type OBJECT IDENTIFIER %%------------------------------------------------- [V2|Tlv3] = Tlv2, Term2 = decode_object_identifier(V2, [131072,6]), %%------------------------------------------------- %% attribute serviceType(3) with type OBJECT IDENTIFIER OPTIONAL %%------------------------------------------------- {Term3,Tlv4} = case Tlv3 of [{131073,V3}|TempTlv4] -> {decode_object_identifier(V3, [6]), TempTlv4}; _ -> { asn1_NOVALUE, Tlv3} end, %%------------------------------------------------- %% attribute userClass(4) with type INTEGER OPTIONAL %%------------------------------------------------- {Term4,Tlv5} = case Tlv4 of [{131074,V4}|TempTlv5] -> {decode_integer(V4, [2]), TempTlv5}; _ -> { asn1_NOVALUE, Tlv4} end, %%------------------------------------------------- %% attribute inputAttributeTypes(5) with type SEQUENCE OF OPTIONAL %%------------------------------------------------- {Term5,Tlv6} = case Tlv5 of [{131075,V5}|TempTlv6] -> {'dec_SearchRule_inputAttributeTypes'(V5, [16]), TempTlv6}; _ -> { asn1_NOVALUE, Tlv5} end, %%------------------------------------------------- %% attribute attributeCombination(6) External InformationFramework:AttributeCombination DEFAULT = {'and',[]} %%------------------------------------------------- {Term6,Tlv7} = case Tlv6 of [{131076,V6}|TempTlv7] -> {'dec_AttributeCombination'(V6, []), TempTlv7}; _ -> {{'and',[]},Tlv6} end, %%------------------------------------------------- %% attribute outputAttributeTypes(7) with type SEQUENCE OF OPTIONAL %%------------------------------------------------- {Term7,Tlv8} = case Tlv7 of [{131077,V7}|TempTlv8] -> {'dec_SearchRule_outputAttributeTypes'(V7, [16]), TempTlv8}; _ -> { asn1_NOVALUE, Tlv7} end, %%------------------------------------------------- %% attribute defaultControls(8) External InformationFramework:ControlOptions OPTIONAL %%------------------------------------------------- {Term8,Tlv9} = case Tlv8 of [{131078,V8}|TempTlv9] -> {'dec_ControlOptions'(V8, [16]), TempTlv9}; _ -> { asn1_NOVALUE, Tlv8} end, %%------------------------------------------------- %% attribute mandatoryControls(9) External InformationFramework:ControlOptions OPTIONAL %%------------------------------------------------- {Term9,Tlv10} = case Tlv9 of [{131079,V9}|TempTlv10] -> {'dec_ControlOptions'(V9, [16]), TempTlv10}; _ -> { asn1_NOVALUE, Tlv9} end, %%------------------------------------------------- %% attribute searchRuleControls(10) External InformationFramework:ControlOptions OPTIONAL %%------------------------------------------------- {Term10,Tlv11} = case Tlv10 of [{131080,V10}|TempTlv11] -> {'dec_ControlOptions'(V10, [16]), TempTlv11}; _ -> { asn1_NOVALUE, Tlv10} end, %%------------------------------------------------- %% attribute familyGrouping(11) with type ENUMERATED OPTIONAL %%------------------------------------------------- {Term11,Tlv12} = case Tlv11 of [{131081,V11}|TempTlv12] -> {case decode_integer(V11, [10]) of 1 -> entryOnly; 2 -> compoundEntry; 3 -> strands; 4 -> multiStrand; Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) end, TempTlv12}; _ -> { asn1_NOVALUE, Tlv11} end, %%------------------------------------------------- %% attribute familyReturn(12) External DirectoryAbstractService:FamilyReturn OPTIONAL %%------------------------------------------------- {Term12,Tlv13} = case Tlv12 of [{131082,V12}|TempTlv13] -> {'DirectoryAbstractService':'dec_FamilyReturn'(V12, [16]), TempTlv13}; _ -> { asn1_NOVALUE, Tlv12} end, %%------------------------------------------------- %% attribute relaxation(13) External InformationFramework:RelaxationPolicy OPTIONAL %%------------------------------------------------- {Term13,Tlv14} = case Tlv13 of [{131083,V13}|TempTlv14] -> {'dec_RelaxationPolicy'(V13, [16]), TempTlv14}; _ -> { asn1_NOVALUE, Tlv13} end, %%------------------------------------------------- %% attribute additionalControl(14) with type SEQUENCE OF OPTIONAL %%------------------------------------------------- {Term14,Tlv15} = case Tlv14 of [{131084,V14}|TempTlv15] -> {'dec_SearchRule_additionalControl'(V14, [16]), TempTlv15}; _ -> { asn1_NOVALUE, Tlv14} end, %%------------------------------------------------- %% attribute allowedSubset(15) with type BIT STRING DEFAULT = <<7:3>> %%------------------------------------------------- {Term15,Tlv16} = case Tlv15 of [{131085,V15}|TempTlv16] -> {decode_named_bit_string(V15, [{baseObject,0},{oneLevel,1},{wholeSubtree,2}], [3]), TempTlv16}; _ -> {<<7:3>>,Tlv15} end, %%------------------------------------------------- %% attribute imposedSubset(16) with type ENUMERATED OPTIONAL %%------------------------------------------------- {Term16,Tlv17} = case Tlv16 of [{131086,V16}|TempTlv17] -> {case decode_integer(V16, [10]) of 0 -> baseObject; 1 -> oneLevel; 2 -> wholeSubtree; Default2 -> exit({error,{asn1,{illegal_enumerated,Default2}}}) end, TempTlv17}; _ -> { asn1_NOVALUE, Tlv16} end, %%------------------------------------------------- %% attribute entryLimit(17) External InformationFramework:EntryLimit OPTIONAL %%------------------------------------------------- {Term17,Tlv18} = case Tlv17 of [{131087,V17}|TempTlv18] -> {'dec_EntryLimit'(V17, [16]), TempTlv18}; _ -> { asn1_NOVALUE, Tlv17} end, case Tlv18 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv18}}}) % extra fields not allowed end, Res1 = {'SearchRule',Term1,Term2,Term3,Term4,Term5,Term6,Term7,Term8,Term9,Term10,Term11,Term12,Term13,Term14,Term15,Term16,Term17}, Res1. 'dec_SearchRule_inputAttributeTypes'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), ['dec_RequestAttribute'(V1, [16]) || V1 <- Tlv1]. 'dec_SearchRule_outputAttributeTypes'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), ['dec_ResultAttribute'(V1, [16]) || V1 <- Tlv1]. 'dec_SearchRule_additionalControl'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), [decode_object_identifier(V1, [6]) || V1 <- Tlv1]. %%================================ %% SearchRuleId %%================================ enc_SearchRuleId(Val) -> enc_SearchRuleId(Val, [<<48>>]). enc_SearchRuleId(Val, TagIn) -> {_,Cindex1,Cindex2} = Val, %%------------------------------------------------- %% attribute id(1) with type INTEGER %%------------------------------------------------- {EncBytes1,EncLen1} = encode_integer(Cindex1, [<<2>>]), %%------------------------------------------------- %% attribute dmdId(2) with type OBJECT IDENTIFIER %%------------------------------------------------- {EncBytes2,EncLen2} = encode_object_identifier(Cindex2, [<<6>>,<<160>>]), BytesSoFar = [EncBytes1, EncBytes2], LenSoFar = EncLen1 + EncLen2, encode_tags(TagIn, BytesSoFar, LenSoFar). dec_SearchRuleId(Tlv) -> dec_SearchRuleId(Tlv, [16]). dec_SearchRuleId(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- %% attribute id(1) with type INTEGER %%------------------------------------------------- [V1|Tlv2] = Tlv1, Term1 = decode_integer(V1, [2]), %%------------------------------------------------- %% attribute dmdId(2) with type OBJECT IDENTIFIER %%------------------------------------------------- [V2|Tlv3] = Tlv2, Term2 = decode_object_identifier(V2, [131072,6]), case Tlv3 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed end, Res1 = {'SearchRuleId',Term1,Term2}, Res1. %%================================ %% AllowedSubset %%================================ enc_AllowedSubset(Val) -> enc_AllowedSubset(Val, [<<3>>]). enc_AllowedSubset(Val, TagIn) -> encode_named_bit_string(Val, [{baseObject,0},{oneLevel,1},{wholeSubtree,2}], TagIn). dec_AllowedSubset(Tlv) -> dec_AllowedSubset(Tlv, [3]). dec_AllowedSubset(Tlv, TagIn) -> decode_named_bit_string(Tlv, [{baseObject,0},{oneLevel,1},{wholeSubtree,2}], TagIn). %%================================ %% ImposedSubset %%================================ enc_ImposedSubset(Val) -> enc_ImposedSubset(Val, [<<10>>]). enc_ImposedSubset(Val, TagIn) -> case Val of baseObject -> encode_tags(TagIn, [0], 1); oneLevel -> encode_tags(TagIn, [1], 1); wholeSubtree -> encode_tags(TagIn, [2], 1); Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}}) end. dec_ImposedSubset(Tlv) -> dec_ImposedSubset(Tlv, [10]). dec_ImposedSubset(Tlv, TagIn) -> case decode_integer(Tlv, TagIn) of 0 -> baseObject; 1 -> oneLevel; 2 -> wholeSubtree; Default1 -> exit({error,{asn1,{illegal_enumerated,Default1}}}) end. %%================================ %% RequestAttribute %%================================ enc_RequestAttribute(Val) -> enc_RequestAttribute(Val, [<<48>>]). enc_RequestAttribute(Val, TagIn) -> {_,Cindex1,Cindex2,Cindex3,Cindex4,Cindex5,Cindex6,Cindex7} = Val, ObjattributeType = 'InformationFramework':'getenc_SupportedAttributes'( Cindex1), %%------------------------------------------------- %% attribute attributeType(1) with type OBJECT IDENTIFIER %%------------------------------------------------- {EncBytes1,EncLen1} = encode_object_identifier(Cindex1, [<<6>>]), %%------------------------------------------------- %% attribute includeSubtypes(2) with type BOOLEAN DEFAULT = false %%------------------------------------------------- {EncBytes2,EncLen2} = case Cindex2 of asn1_DEFAULT -> {<<>>,0}; _ when Cindex2 =:= false -> {<<>>,0}; _ -> encode_boolean(Cindex2, [<<1>>,<<160>>]) end, %%------------------------------------------------- %% attribute selectedValues(3) with type SEQUENCE OF OPTIONAL %%------------------------------------------------- {EncBytes3,EncLen3} = case Cindex3 of asn1_NOVALUE -> {<<>>,0}; _ -> 'enc_RequestAttribute_selectedValues'(Cindex3, [<<48>>,<<161>>], ObjattributeType) end, %%------------------------------------------------- %% attribute defaultValues(4) with type SEQUENCE OF OPTIONAL %%------------------------------------------------- {EncBytes4,EncLen4} = case Cindex4 of asn1_NOVALUE -> {<<>>,0}; _ -> 'enc_RequestAttribute_defaultValues'(Cindex4, [<<48>>,<<162>>], ObjattributeType) end, %%------------------------------------------------- %% attribute contexts(5) with type SEQUENCE OF OPTIONAL %%------------------------------------------------- {EncBytes5,EncLen5} = case Cindex5 of asn1_NOVALUE -> {<<>>,0}; _ -> 'enc_RequestAttribute_contexts'(Cindex5, [<<48>>,<<163>>]) end, %%------------------------------------------------- %% attribute contextCombination(6) External InformationFramework:ContextCombination DEFAULT = {'and',[]} %%------------------------------------------------- {EncBytes6,EncLen6} = case Cindex6 of asn1_DEFAULT -> {<<>>,0}; _ when Cindex6 =:= {'and',[]} -> {<<>>,0}; _ -> 'enc_ContextCombination'(Cindex6, [<<164>>]) end, %%------------------------------------------------- %% attribute matchingUse(7) with type SEQUENCE OF OPTIONAL %%------------------------------------------------- {EncBytes7,EncLen7} = case Cindex7 of asn1_NOVALUE -> {<<>>,0}; _ -> 'enc_RequestAttribute_matchingUse'(Cindex7, [<<48>>,<<165>>]) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4, EncBytes5, EncBytes6, EncBytes7], LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5 + EncLen6 + EncLen7, encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% RequestAttribute_selectedValues %%================================ enc_RequestAttribute_selectedValues(Val, TagIn, ObjFun) -> {EncBytes,EncLen} = 'enc_RequestAttribute_selectedValues_components'(Val, ObjFun,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_RequestAttribute_selectedValues_components'([], _, AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_RequestAttribute_selectedValues_components'([H|T], ObjFun,AccBytes, AccLen) -> {TmpBytes,_} = ObjFun('Type', H, []), {EncBytes,EncLen} = encode_open_type(TmpBytes, []) , 'enc_RequestAttribute_selectedValues_components'(T, ObjFun,[EncBytes|AccBytes], AccLen + EncLen). %%================================ %% RequestAttribute_defaultValues %%================================ enc_RequestAttribute_defaultValues(Val, TagIn, ObjFun) -> {EncBytes,EncLen} = 'enc_RequestAttribute_defaultValues_components'(Val, ObjFun,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_RequestAttribute_defaultValues_components'([], _, AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_RequestAttribute_defaultValues_components'([H|T], ObjFun,AccBytes, AccLen) -> {EncBytes,EncLen} = 'enc_RequestAttribute_defaultValues_SEQOF'(H, [<<48>>], ObjFun), 'enc_RequestAttribute_defaultValues_components'(T, ObjFun,[EncBytes|AccBytes], AccLen + EncLen). %%================================ %% RequestAttribute_defaultValues_SEQOF %%================================ enc_RequestAttribute_defaultValues_SEQOF(Val, TagIn, ObjFun) -> {_,Cindex1,Cindex2} = Val, %%------------------------------------------------- %% attribute entryType(1) with type OBJECT IDENTIFIER OPTIONAL %%------------------------------------------------- {EncBytes1,EncLen1} = case Cindex1 of asn1_NOVALUE -> {<<>>,0}; _ -> encode_object_identifier(Cindex1, [<<6>>]) end, %%------------------------------------------------- %% attribute values(2) with type SEQUENCE OF %%------------------------------------------------- {EncBytes2,EncLen2} = 'enc_RequestAttribute_defaultValues_SEQOF_values'(Cindex2, [<<48>>], ObjFun), BytesSoFar = [EncBytes1, EncBytes2], LenSoFar = EncLen1 + EncLen2, encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% RequestAttribute_defaultValues_SEQOF_values %%================================ enc_RequestAttribute_defaultValues_SEQOF_values(Val, TagIn, ObjFun) -> {EncBytes,EncLen} = 'enc_RequestAttribute_defaultValues_SEQOF_values_components'(Val, ObjFun,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_RequestAttribute_defaultValues_SEQOF_values_components'([], _, AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_RequestAttribute_defaultValues_SEQOF_values_components'([H|T], ObjFun,AccBytes, AccLen) -> {TmpBytes,_} = ObjFun('Type', H, []), {EncBytes,EncLen} = encode_open_type(TmpBytes, []) , 'enc_RequestAttribute_defaultValues_SEQOF_values_components'(T, ObjFun,[EncBytes|AccBytes], AccLen + EncLen). %%================================ %% RequestAttribute_contexts %%================================ enc_RequestAttribute_contexts(Val, TagIn) -> {EncBytes,EncLen} = 'enc_RequestAttribute_contexts_components'(Val,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_RequestAttribute_contexts_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_RequestAttribute_contexts_components'([H|T],AccBytes, AccLen) -> {EncBytes,EncLen} = 'enc_ContextProfile'(H, [<<48>>]), 'enc_RequestAttribute_contexts_components'(T,[EncBytes|AccBytes], AccLen + EncLen). %%================================ %% RequestAttribute_matchingUse %%================================ enc_RequestAttribute_matchingUse(Val, TagIn) -> {EncBytes,EncLen} = 'enc_RequestAttribute_matchingUse_components'(Val,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_RequestAttribute_matchingUse_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_RequestAttribute_matchingUse_components'([H|T],AccBytes, AccLen) -> {EncBytes,EncLen} = 'enc_MatchingUse'(H, [<<48>>]), 'enc_RequestAttribute_matchingUse_components'(T,[EncBytes|AccBytes], AccLen + EncLen). dec_RequestAttribute(Tlv) -> dec_RequestAttribute(Tlv, [16]). dec_RequestAttribute(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- %% attribute attributeType(1) with type OBJECT IDENTIFIER %%------------------------------------------------- [V1|Tlv2] = Tlv1, Term1 = decode_object_identifier(V1, [6]), ObjFun = 'InformationFramework':'getdec_SupportedAttributes'(Term1), %%------------------------------------------------- %% attribute includeSubtypes(2) with type BOOLEAN DEFAULT = false %%------------------------------------------------- {Term2,Tlv3} = case Tlv2 of [{131072,V2}|TempTlv3] -> {decode_boolean(V2, [1]), TempTlv3}; _ -> {false,Tlv2} end, %%------------------------------------------------- %% attribute selectedValues(3) with type SEQUENCE OF OPTIONAL %%------------------------------------------------- {Term3,Tlv4} = case Tlv3 of [{131073,V3}|TempTlv4] -> {'dec_RequestAttribute_selectedValues'(V3, [16], ObjFun), TempTlv4}; _ -> { asn1_NOVALUE, Tlv3} end, %%------------------------------------------------- %% attribute defaultValues(4) with type SEQUENCE OF OPTIONAL %%------------------------------------------------- {Term4,Tlv5} = case Tlv4 of [{131074,V4}|TempTlv5] -> {'dec_RequestAttribute_defaultValues'(V4, [16], ObjFun), TempTlv5}; _ -> { asn1_NOVALUE, Tlv4} end, %%------------------------------------------------- %% attribute contexts(5) with type SEQUENCE OF OPTIONAL %%------------------------------------------------- {Term5,Tlv6} = case Tlv5 of [{131075,V5}|TempTlv6] -> {'dec_RequestAttribute_contexts'(V5, [16]), TempTlv6}; _ -> { asn1_NOVALUE, Tlv5} end, %%------------------------------------------------- %% attribute contextCombination(6) External InformationFramework:ContextCombination DEFAULT = {'and',[]} %%------------------------------------------------- {Term6,Tlv7} = case Tlv6 of [{131076,V6}|TempTlv7] -> {'dec_ContextCombination'(V6, []), TempTlv7}; _ -> {{'and',[]},Tlv6} end, %%------------------------------------------------- %% attribute matchingUse(7) with type SEQUENCE OF OPTIONAL %%------------------------------------------------- {Term7,Tlv8} = case Tlv7 of [{131077,V7}|TempTlv8] -> {'dec_RequestAttribute_matchingUse'(V7, [16]), TempTlv8}; _ -> { asn1_NOVALUE, Tlv7} end, case Tlv8 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv8}}}) % extra fields not allowed end, Res1 = {'RequestAttribute',Term1,Term2,Term3,Term4,Term5,Term6,Term7}, Res1. 'dec_RequestAttribute_selectedValues'(Tlv, TagIn, ObjFun) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), [ begin Tmptlv1 = decode_open_type(V1, []), case (catch ObjFun('Type', Tmptlv1, [])) of {'EXIT',Reason1} -> exit({'Type not compatible with table constraint', Reason1}); Tmpterm1 -> Tmpterm1 end end || V1 <- Tlv1]. 'dec_RequestAttribute_defaultValues'(Tlv, TagIn, ObjFun) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), ['dec_RequestAttribute_defaultValues_SEQOF'(V1, [16], ObjFun) || V1 <- Tlv1]. 'dec_RequestAttribute_defaultValues_SEQOF'(Tlv, TagIn, ObjFun) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- %% attribute entryType(1) with type OBJECT IDENTIFIER OPTIONAL %%------------------------------------------------- {Term1,Tlv2} = case Tlv1 of [{6,V1}|TempTlv2] -> {decode_object_identifier(V1, []), TempTlv2}; _ -> { asn1_NOVALUE, Tlv1} end, %%------------------------------------------------- %% attribute values(2) with type SEQUENCE OF %%------------------------------------------------- [V2|Tlv3] = Tlv2, Term2 = 'dec_RequestAttribute_defaultValues_SEQOF_values'(V2, [16], ObjFun), case Tlv3 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed end, Res1 = {'RequestAttribute_defaultValues_SEQOF',Term1,Term2}, Res1. 'dec_RequestAttribute_defaultValues_SEQOF_values'(Tlv, TagIn, ObjFun) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), [ begin Tmptlv1 = decode_open_type(V1, []), case (catch ObjFun('Type', Tmptlv1, [])) of {'EXIT',Reason1} -> exit({'Type not compatible with table constraint', Reason1}); Tmpterm1 -> Tmpterm1 end end || V1 <- Tlv1]. 'dec_RequestAttribute_contexts'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), ['dec_ContextProfile'(V1, [16]) || V1 <- Tlv1]. 'dec_RequestAttribute_matchingUse'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), ['dec_MatchingUse'(V1, [16]) || V1 <- Tlv1]. %%================================ %% ContextProfile %%================================ enc_ContextProfile(Val) -> enc_ContextProfile(Val, [<<48>>]). enc_ContextProfile(Val, TagIn) -> {_,Cindex1,Cindex2} = Val, ObjcontextType = 'InformationFramework':'getenc_SupportedContexts'( Cindex1), %%------------------------------------------------- %% attribute contextType(1) with type OBJECT IDENTIFIER %%------------------------------------------------- {EncBytes1,EncLen1} = encode_object_identifier(Cindex1, [<<6>>]), %%------------------------------------------------- %% attribute contextValue(2) with type SEQUENCE OF OPTIONAL %%------------------------------------------------- {EncBytes2,EncLen2} = case Cindex2 of asn1_NOVALUE -> {<<>>,0}; _ -> 'enc_ContextProfile_contextValue'(Cindex2, [<<48>>], ObjcontextType) end, BytesSoFar = [EncBytes1, EncBytes2], LenSoFar = EncLen1 + EncLen2, encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% ContextProfile_contextValue %%================================ enc_ContextProfile_contextValue(Val, TagIn, ObjFun) -> {EncBytes,EncLen} = 'enc_ContextProfile_contextValue_components'(Val, ObjFun,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_ContextProfile_contextValue_components'([], _, AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_ContextProfile_contextValue_components'([H|T], ObjFun,AccBytes, AccLen) -> {TmpBytes,_} = ObjFun('Assertion', H, []), {EncBytes,EncLen} = encode_open_type(TmpBytes, []) , 'enc_ContextProfile_contextValue_components'(T, ObjFun,[EncBytes|AccBytes], AccLen + EncLen). dec_ContextProfile(Tlv) -> dec_ContextProfile(Tlv, [16]). dec_ContextProfile(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- %% attribute contextType(1) with type OBJECT IDENTIFIER %%------------------------------------------------- [V1|Tlv2] = Tlv1, Term1 = decode_object_identifier(V1, [6]), ObjFun = 'InformationFramework':'getdec_SupportedContexts'(Term1), %%------------------------------------------------- %% attribute contextValue(2) with type SEQUENCE OF OPTIONAL %%------------------------------------------------- {Term2,Tlv3} = case Tlv2 of [{16,V2}|TempTlv3] -> {'dec_ContextProfile_contextValue'(V2, [], ObjFun), TempTlv3}; _ -> { asn1_NOVALUE, Tlv2} end, case Tlv3 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed end, Res1 = {'ContextProfile',Term1,Term2}, Res1. 'dec_ContextProfile_contextValue'(Tlv, TagIn, ObjFun) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), [ begin Tmptlv1 = decode_open_type(V1, []), case (catch ObjFun('Assertion', Tmptlv1, [])) of {'EXIT',Reason1} -> exit({'Type not compatible with table constraint', Reason1}); Tmpterm1 -> Tmpterm1 end end || V1 <- Tlv1]. %%================================ %% ContextCombination %%================================ enc_ContextCombination(Val) -> enc_ContextCombination(Val, []). enc_ContextCombination(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of context -> encode_object_identifier(element(2,Val), [<<6>>,<<160>>]); 'and' -> 'enc_ContextCombination_and'(element(2,Val), [<<48>>,<<161>>]); 'or' -> 'enc_ContextCombination_or'(element(2,Val), [<<48>>,<<162>>]); 'not' -> 'enc_ContextCombination'(element(2,Val), [<<163>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, encode_tags(TagIn, EncBytes, EncLen). %%================================ %% ContextCombination_and %%================================ enc_ContextCombination_and(Val, TagIn) -> {EncBytes,EncLen} = 'enc_ContextCombination_and_components'(Val,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_ContextCombination_and_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_ContextCombination_and_components'([H|T],AccBytes, AccLen) -> {EncBytes,EncLen} = 'enc_ContextCombination'(H, []), 'enc_ContextCombination_and_components'(T,[EncBytes|AccBytes], AccLen + EncLen). %%================================ %% ContextCombination_or %%================================ enc_ContextCombination_or(Val, TagIn) -> {EncBytes,EncLen} = 'enc_ContextCombination_or_components'(Val,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_ContextCombination_or_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_ContextCombination_or_components'([H|T],AccBytes, AccLen) -> {EncBytes,EncLen} = 'enc_ContextCombination'(H, []), 'enc_ContextCombination_or_components'(T,[EncBytes|AccBytes], AccLen + EncLen). dec_ContextCombination(Tlv) -> dec_ContextCombination(Tlv, []). dec_ContextCombination(Tlv, TagIn) -> Tlv1 = match_tags(Tlv, TagIn), case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of %% 'context' {131072, V1} -> {context, decode_object_identifier(V1, [6])}; %% 'and' {131073, V1} -> {'and', 'dec_ContextCombination_and'(V1, [16])}; %% 'or' {131074, V1} -> {'or', 'dec_ContextCombination_or'(V1, [16])}; %% 'not' {131075, V1} -> {'not', 'dec_ContextCombination'(V1, [])}; Else -> exit({error,{asn1,{invalid_choice_tag,Else}}}) end . 'dec_ContextCombination_and'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), ['dec_ContextCombination'(V1, []) || V1 <- Tlv1]. 'dec_ContextCombination_or'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), ['dec_ContextCombination'(V1, []) || V1 <- Tlv1]. %%================================ %% MatchingUse %%================================ enc_MatchingUse(Val) -> enc_MatchingUse(Val, [<<48>>]). enc_MatchingUse(Val, TagIn) -> {_,Cindex1,Cindex2} = Val, ObjrestrictionType = 'InformationFramework':'getenc_SupportedMatchingRestrictions'( Cindex1), %%------------------------------------------------- %% attribute restrictionType(1) with type OBJECT IDENTIFIER %%------------------------------------------------- {EncBytes1,EncLen1} = encode_object_identifier(Cindex1, [<<6>>]), %%------------------------------------------------- %% attribute restrictionValue(2) with type typefieldRestriction %%------------------------------------------------- {TmpBytes2,_} = ObjrestrictionType('Restriction', Cindex2, []), {EncBytes2,EncLen2} = encode_open_type(TmpBytes2, []) , BytesSoFar = [EncBytes1, EncBytes2], LenSoFar = EncLen1 + EncLen2, encode_tags(TagIn, BytesSoFar, LenSoFar). dec_MatchingUse(Tlv) -> dec_MatchingUse(Tlv, [16]). dec_MatchingUse(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- %% attribute restrictionType(1) with type OBJECT IDENTIFIER %%------------------------------------------------- [V1|Tlv2] = Tlv1, Term1 = decode_object_identifier(V1, [6]), %%------------------------------------------------- %% attribute restrictionValue(2) with type typefieldRestriction %%------------------------------------------------- [V2|Tlv3] = Tlv2, Tmpterm1 = decode_open_type(V2, []), DecObjrestrictionTypeTerm1 = 'InformationFramework':'getdec_SupportedMatchingRestrictions'(Term1), Term2 = case (catch DecObjrestrictionTypeTerm1('Restriction', Tmpterm1, [])) of {'EXIT', Reason1} -> exit({'Type not compatible with table constraint',Reason1}); Tmpterm2 -> Tmpterm2 end, case Tlv3 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed end, Res1 = {'MatchingUse',Term1,Term2}, Res1. %%================================ %% AttributeCombination %%================================ enc_AttributeCombination(Val) -> enc_AttributeCombination(Val, []). enc_AttributeCombination(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of attribute -> encode_object_identifier(element(2,Val), [<<6>>,<<160>>]); 'and' -> 'enc_AttributeCombination_and'(element(2,Val), [<<48>>,<<161>>]); 'or' -> 'enc_AttributeCombination_or'(element(2,Val), [<<48>>,<<162>>]); 'not' -> 'enc_AttributeCombination'(element(2,Val), [<<163>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, encode_tags(TagIn, EncBytes, EncLen). %%================================ %% AttributeCombination_and %%================================ enc_AttributeCombination_and(Val, TagIn) -> {EncBytes,EncLen} = 'enc_AttributeCombination_and_components'(Val,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_AttributeCombination_and_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_AttributeCombination_and_components'([H|T],AccBytes, AccLen) -> {EncBytes,EncLen} = 'enc_AttributeCombination'(H, []), 'enc_AttributeCombination_and_components'(T,[EncBytes|AccBytes], AccLen + EncLen). %%================================ %% AttributeCombination_or %%================================ enc_AttributeCombination_or(Val, TagIn) -> {EncBytes,EncLen} = 'enc_AttributeCombination_or_components'(Val,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_AttributeCombination_or_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_AttributeCombination_or_components'([H|T],AccBytes, AccLen) -> {EncBytes,EncLen} = 'enc_AttributeCombination'(H, []), 'enc_AttributeCombination_or_components'(T,[EncBytes|AccBytes], AccLen + EncLen). dec_AttributeCombination(Tlv) -> dec_AttributeCombination(Tlv, []). dec_AttributeCombination(Tlv, TagIn) -> Tlv1 = match_tags(Tlv, TagIn), case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of %% 'attribute' {131072, V1} -> {attribute, decode_object_identifier(V1, [6])}; %% 'and' {131073, V1} -> {'and', 'dec_AttributeCombination_and'(V1, [16])}; %% 'or' {131074, V1} -> {'or', 'dec_AttributeCombination_or'(V1, [16])}; %% 'not' {131075, V1} -> {'not', 'dec_AttributeCombination'(V1, [])}; Else -> exit({error,{asn1,{invalid_choice_tag,Else}}}) end . 'dec_AttributeCombination_and'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), ['dec_AttributeCombination'(V1, []) || V1 <- Tlv1]. 'dec_AttributeCombination_or'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), ['dec_AttributeCombination'(V1, []) || V1 <- Tlv1]. %%================================ %% ResultAttribute %%================================ enc_ResultAttribute(Val) -> enc_ResultAttribute(Val, [<<48>>]). enc_ResultAttribute(Val, TagIn) -> {_,Cindex1,Cindex2,Cindex3} = Val, ObjattributeType = 'InformationFramework':'getenc_SupportedAttributes'( Cindex1), %%------------------------------------------------- %% attribute attributeType(1) with type OBJECT IDENTIFIER %%------------------------------------------------- {EncBytes1,EncLen1} = encode_object_identifier(Cindex1, [<<6>>]), %%------------------------------------------------- %% attribute outputValues(2) with type CHOICE OPTIONAL %%------------------------------------------------- {EncBytes2,EncLen2} = case Cindex2 of asn1_NOVALUE -> {<<>>,0}; _ -> 'enc_ResultAttribute_outputValues'(Cindex2, [], ObjattributeType) end, %%------------------------------------------------- %% attribute contexts(3) with type SEQUENCE OF OPTIONAL %%------------------------------------------------- {EncBytes3,EncLen3} = case Cindex3 of asn1_NOVALUE -> {<<>>,0}; _ -> 'enc_ResultAttribute_contexts'(Cindex3, [<<48>>,<<160>>]) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3], LenSoFar = EncLen1 + EncLen2 + EncLen3, encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% ResultAttribute_outputValues %%================================ enc_ResultAttribute_outputValues(Val, TagIn, ObjFun) -> {EncBytes,EncLen} = case element(1,Val) of selectedValues -> 'enc_ResultAttribute_outputValues_selectedValues'(element(2,Val), [<<48>>], ObjFun); matchedValuesOnly -> encode_null(element(2,Val), [<<5>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, encode_tags(TagIn, EncBytes, EncLen). %%================================ %% ResultAttribute_outputValues_selectedValues %%================================ enc_ResultAttribute_outputValues_selectedValues(Val, TagIn, ObjFun) -> {EncBytes,EncLen} = 'enc_ResultAttribute_outputValues_selectedValues_components'(Val, ObjFun,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_ResultAttribute_outputValues_selectedValues_components'([], _, AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_ResultAttribute_outputValues_selectedValues_components'([H|T], ObjFun,AccBytes, AccLen) -> {TmpBytes,_} = ObjFun('Type', H, []), {EncBytes,EncLen} = encode_open_type(TmpBytes, []) , 'enc_ResultAttribute_outputValues_selectedValues_components'(T, ObjFun,[EncBytes|AccBytes], AccLen + EncLen). %%================================ %% ResultAttribute_contexts %%================================ enc_ResultAttribute_contexts(Val, TagIn) -> {EncBytes,EncLen} = 'enc_ResultAttribute_contexts_components'(Val,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_ResultAttribute_contexts_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_ResultAttribute_contexts_components'([H|T],AccBytes, AccLen) -> {EncBytes,EncLen} = 'enc_ContextProfile'(H, [<<48>>]), 'enc_ResultAttribute_contexts_components'(T,[EncBytes|AccBytes], AccLen + EncLen). dec_ResultAttribute(Tlv) -> dec_ResultAttribute(Tlv, [16]). dec_ResultAttribute(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- %% attribute attributeType(1) with type OBJECT IDENTIFIER %%------------------------------------------------- [V1|Tlv2] = Tlv1, Term1 = decode_object_identifier(V1, [6]), ObjFun = 'InformationFramework':'getdec_SupportedAttributes'(Term1), %%------------------------------------------------- %% attribute outputValues(2) with type CHOICE OPTIONAL %%------------------------------------------------- {Term2,Tlv3} = case Tlv2 of [V2 = {16,_}|TempTlv3] -> {'dec_ResultAttribute_outputValues'(V2, [], ObjFun), TempTlv3}; [V2 = {5,_}|TempTlv3] -> {'dec_ResultAttribute_outputValues'(V2, [], ObjFun), TempTlv3}; _ -> { asn1_NOVALUE, Tlv2} end, %%------------------------------------------------- %% attribute contexts(3) with type SEQUENCE OF OPTIONAL %%------------------------------------------------- {Term3,Tlv4} = case Tlv3 of [{131072,V3}|TempTlv4] -> {'dec_ResultAttribute_contexts'(V3, [16]), TempTlv4}; _ -> { asn1_NOVALUE, Tlv3} end, case Tlv4 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowed end, Res1 = {'ResultAttribute',Term1,Term2,Term3}, Res1. 'dec_ResultAttribute_outputValues'(Tlv, TagIn, ObjFun) -> Tlv1 = match_tags(Tlv, TagIn), case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of %% 'selectedValues' {16, V1} -> {selectedValues, 'dec_ResultAttribute_outputValues_selectedValues'(V1, [], ObjFun)}; %% 'matchedValuesOnly' {5, V1} -> {matchedValuesOnly, decode_null(V1, [])}; Else -> exit({error,{asn1,{invalid_choice_tag,Else}}}) end . 'dec_ResultAttribute_outputValues_selectedValues'(Tlv, TagIn, ObjFun) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), [ begin Tmptlv1 = decode_open_type(V1, []), case (catch ObjFun('Type', Tmptlv1, [])) of {'EXIT',Reason1} -> exit({'Type not compatible with table constraint', Reason1}); Tmpterm1 -> Tmpterm1 end end || V1 <- Tlv1]. 'dec_ResultAttribute_contexts'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), ['dec_ContextProfile'(V1, [16]) || V1 <- Tlv1]. %%================================ %% OutputValues %%================================ enc_OutputValues(Val) -> enc_OutputValues(Val, []). enc_OutputValues(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of selectedValues -> 'enc_OutputValues_selectedValues'(element(2,Val), [<<48>>]); matchedValuesOnly -> encode_null(element(2,Val), [<<5>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, encode_tags(TagIn, EncBytes, EncLen). %%================================ %% OutputValues_selectedValues %%================================ enc_OutputValues_selectedValues(Val, TagIn) -> {EncBytes,EncLen} = 'enc_OutputValues_selectedValues_components'(Val,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_OutputValues_selectedValues_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_OutputValues_selectedValues_components'([H|T],AccBytes, AccLen) -> {EncBytes,EncLen} = encode_open_type(H, []), 'enc_OutputValues_selectedValues_components'(T,[EncBytes|AccBytes], AccLen + EncLen). dec_OutputValues(Tlv) -> dec_OutputValues(Tlv, []). dec_OutputValues(Tlv, TagIn) -> Tlv1 = match_tags(Tlv, TagIn), case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of %% 'selectedValues' {16, V1} -> {selectedValues, 'dec_OutputValues_selectedValues'(V1, [])}; %% 'matchedValuesOnly' {5, V1} -> {matchedValuesOnly, decode_null(V1, [])}; Else -> exit({error,{asn1,{invalid_choice_tag,Else}}}) end . 'dec_OutputValues_selectedValues'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), [decode_open_type_as_binary(V1, []) || V1 <- Tlv1]. %%================================ %% ControlOptions %%================================ enc_ControlOptions(Val) -> enc_ControlOptions(Val, [<<48>>]). enc_ControlOptions(Val, TagIn) -> {_,Cindex1,Cindex2,Cindex3} = Val, %%------------------------------------------------- %% attribute serviceControls(1) with type BIT STRING DEFAULT = [] %%------------------------------------------------- {EncBytes1,EncLen1} = case Cindex1 of asn1_DEFAULT -> {<<>>,0}; _ when Cindex1 =:= [] -> {<<>>,0}; _ -> encode_named_bit_string(Cindex1, [{preferChaining,0},{chainingProhibited,1},{localScope,2},{dontUseCopy,3},{dontDereferenceAliases,4},{subentries,5},{copyShallDo,6},{partialNameResolution,7},{manageDSAIT,8},{noSubtypeMatch,9},{noSubtypeSelection,10},{countFamily,11}], [<<3>>,<<160>>]) end, %%------------------------------------------------- %% attribute searchOptions(2) with type BIT STRING DEFAULT = [searchAliases] %%------------------------------------------------- {EncBytes2,EncLen2} = case Cindex2 of asn1_DEFAULT -> {<<>>,0}; _ when Cindex2 =:= [searchAliases] -> {<<>>,0}; _ -> encode_named_bit_string(Cindex2, [{searchAliases,0},{matchedValuesOnly,1},{checkOverspecified,2},{performExactly,3},{includeAllAreas,4},{noSystemRelaxation,5},{dnAttribute,6},{matchOnResidualName,7},{entryCount,8},{useSubset,9},{separateFamilyMembers,10},{searchFamily,11}], [<<3>>,<<161>>]) end, %%------------------------------------------------- %% attribute hierarchyOptions(3) with type BIT STRING OPTIONAL %%------------------------------------------------- {EncBytes3,EncLen3} = case Cindex3 of asn1_NOVALUE -> {<<>>,0}; _ -> encode_named_bit_string(Cindex3, [{self,0},{children,1},{parent,2},{hierarchy,3},{top,4},{subtree,5},{siblings,6},{siblingChildren,7},{siblingSubtree,8},{all,9}], [<<3>>,<<162>>]) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3], LenSoFar = EncLen1 + EncLen2 + EncLen3, encode_tags(TagIn, BytesSoFar, LenSoFar). dec_ControlOptions(Tlv) -> dec_ControlOptions(Tlv, [16]). dec_ControlOptions(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- %% attribute serviceControls(1) with type BIT STRING DEFAULT = [] %%------------------------------------------------- {Term1,Tlv2} = case Tlv1 of [{131072,V1}|TempTlv2] -> {decode_named_bit_string(V1, [{preferChaining,0},{chainingProhibited,1},{localScope,2},{dontUseCopy,3},{dontDereferenceAliases,4},{subentries,5},{copyShallDo,6},{partialNameResolution,7},{manageDSAIT,8},{noSubtypeMatch,9},{noSubtypeSelection,10},{countFamily,11}], [3]), TempTlv2}; _ -> {[],Tlv1} end, %%------------------------------------------------- %% attribute searchOptions(2) with type BIT STRING DEFAULT = [searchAliases] %%------------------------------------------------- {Term2,Tlv3} = case Tlv2 of [{131073,V2}|TempTlv3] -> {decode_named_bit_string(V2, [{searchAliases,0},{matchedValuesOnly,1},{checkOverspecified,2},{performExactly,3},{includeAllAreas,4},{noSystemRelaxation,5},{dnAttribute,6},{matchOnResidualName,7},{entryCount,8},{useSubset,9},{separateFamilyMembers,10},{searchFamily,11}], [3]), TempTlv3}; _ -> {[searchAliases],Tlv2} end, %%------------------------------------------------- %% attribute hierarchyOptions(3) with type BIT STRING OPTIONAL %%------------------------------------------------- {Term3,Tlv4} = case Tlv3 of [{131074,V3}|TempTlv4] -> {decode_named_bit_string(V3, [{self,0},{children,1},{parent,2},{hierarchy,3},{top,4},{subtree,5},{siblings,6},{siblingChildren,7},{siblingSubtree,8},{all,9}], [3]), TempTlv4}; _ -> { asn1_NOVALUE, Tlv3} end, case Tlv4 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowed end, Res1 = {'ControlOptions',Term1,Term2,Term3}, Res1. %%================================ %% EntryLimit %%================================ enc_EntryLimit(Val) -> enc_EntryLimit(Val, [<<48>>]). enc_EntryLimit(Val, TagIn) -> {_,Cindex1,Cindex2} = Val, %%------------------------------------------------- %% attribute default(1) with type INTEGER %%------------------------------------------------- {EncBytes1,EncLen1} = encode_integer(Cindex1, [<<2>>]), %%------------------------------------------------- %% attribute max(2) with type INTEGER %%------------------------------------------------- {EncBytes2,EncLen2} = encode_integer(Cindex2, [<<2>>]), BytesSoFar = [EncBytes1, EncBytes2], LenSoFar = EncLen1 + EncLen2, encode_tags(TagIn, BytesSoFar, LenSoFar). dec_EntryLimit(Tlv) -> dec_EntryLimit(Tlv, [16]). dec_EntryLimit(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- %% attribute default(1) with type INTEGER %%------------------------------------------------- [V1|Tlv2] = Tlv1, Term1 = decode_integer(V1, [2]), %%------------------------------------------------- %% attribute max(2) with type INTEGER %%------------------------------------------------- [V2|Tlv3] = Tlv2, Term2 = decode_integer(V2, [2]), case Tlv3 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed end, Res1 = {'EntryLimit',Term1,Term2}, Res1. %%================================ %% RelaxationPolicy %%================================ enc_RelaxationPolicy(Val) -> enc_RelaxationPolicy(Val, [<<48>>]). enc_RelaxationPolicy(Val, TagIn) -> {_,Cindex1,Cindex2,Cindex3,Cindex4,Cindex5} = Val, %%------------------------------------------------- %% attribute basic(1) External InformationFramework:MRMapping DEFAULT = {'MRMapping',asn1_NOVALUE,asn1_NOVALUE} %%------------------------------------------------- {EncBytes1,EncLen1} = case Cindex1 of asn1_DEFAULT -> {<<>>,0}; _ when Cindex1 =:= {'MRMapping',asn1_NOVALUE,asn1_NOVALUE} -> {<<>>,0}; _ -> 'enc_MRMapping'(Cindex1, [<<48>>,<<160>>]) end, %%------------------------------------------------- %% attribute tightenings(2) with type SEQUENCE OF OPTIONAL %%------------------------------------------------- {EncBytes2,EncLen2} = case Cindex2 of asn1_NOVALUE -> {<<>>,0}; _ -> 'enc_RelaxationPolicy_tightenings'(Cindex2, [<<48>>,<<161>>]) end, %%------------------------------------------------- %% attribute relaxations(3) with type SEQUENCE OF OPTIONAL %%------------------------------------------------- {EncBytes3,EncLen3} = case Cindex3 of asn1_NOVALUE -> {<<>>,0}; _ -> 'enc_RelaxationPolicy_relaxations'(Cindex3, [<<48>>,<<162>>]) end, %%------------------------------------------------- %% attribute maximum(4) with type INTEGER OPTIONAL %%------------------------------------------------- {EncBytes4,EncLen4} = case Cindex4 of asn1_NOVALUE -> {<<>>,0}; _ -> encode_integer(Cindex4, [<<2>>,<<163>>]) end, %%------------------------------------------------- %% attribute minimum(5) with type INTEGER DEFAULT = 1 %%------------------------------------------------- {EncBytes5,EncLen5} = case Cindex5 of asn1_DEFAULT -> {<<>>,0}; _ when Cindex5 =:= 1 -> {<<>>,0}; _ -> encode_integer(Cindex5, [<<2>>,<<164>>]) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4, EncBytes5], LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5, encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% RelaxationPolicy_tightenings %%================================ enc_RelaxationPolicy_tightenings(Val, TagIn) -> {EncBytes,EncLen} = 'enc_RelaxationPolicy_tightenings_components'(Val,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_RelaxationPolicy_tightenings_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_RelaxationPolicy_tightenings_components'([H|T],AccBytes, AccLen) -> {EncBytes,EncLen} = 'enc_MRMapping'(H, [<<48>>]), 'enc_RelaxationPolicy_tightenings_components'(T,[EncBytes|AccBytes], AccLen + EncLen). %%================================ %% RelaxationPolicy_relaxations %%================================ enc_RelaxationPolicy_relaxations(Val, TagIn) -> {EncBytes,EncLen} = 'enc_RelaxationPolicy_relaxations_components'(Val,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_RelaxationPolicy_relaxations_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_RelaxationPolicy_relaxations_components'([H|T],AccBytes, AccLen) -> {EncBytes,EncLen} = 'enc_MRMapping'(H, [<<48>>]), 'enc_RelaxationPolicy_relaxations_components'(T,[EncBytes|AccBytes], AccLen + EncLen). dec_RelaxationPolicy(Tlv) -> dec_RelaxationPolicy(Tlv, [16]). dec_RelaxationPolicy(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- %% attribute basic(1) External InformationFramework:MRMapping DEFAULT = {'MRMapping',asn1_NOVALUE,asn1_NOVALUE} %%------------------------------------------------- {Term1,Tlv2} = case Tlv1 of [{131072,V1}|TempTlv2] -> {'dec_MRMapping'(V1, [16]), TempTlv2}; _ -> {{'MRMapping',asn1_NOVALUE,asn1_NOVALUE},Tlv1} end, %%------------------------------------------------- %% attribute tightenings(2) with type SEQUENCE OF OPTIONAL %%------------------------------------------------- {Term2,Tlv3} = case Tlv2 of [{131073,V2}|TempTlv3] -> {'dec_RelaxationPolicy_tightenings'(V2, [16]), TempTlv3}; _ -> { asn1_NOVALUE, Tlv2} end, %%------------------------------------------------- %% attribute relaxations(3) with type SEQUENCE OF OPTIONAL %%------------------------------------------------- {Term3,Tlv4} = case Tlv3 of [{131074,V3}|TempTlv4] -> {'dec_RelaxationPolicy_relaxations'(V3, [16]), TempTlv4}; _ -> { asn1_NOVALUE, Tlv3} end, %%------------------------------------------------- %% attribute maximum(4) with type INTEGER OPTIONAL %%------------------------------------------------- {Term4,Tlv5} = case Tlv4 of [{131075,V4}|TempTlv5] -> {decode_integer(V4, [2]), TempTlv5}; _ -> { asn1_NOVALUE, Tlv4} end, %%------------------------------------------------- %% attribute minimum(5) with type INTEGER DEFAULT = 1 %%------------------------------------------------- {Term5,Tlv6} = case Tlv5 of [{131076,V5}|TempTlv6] -> {decode_integer(V5, [2]), TempTlv6}; _ -> {1,Tlv5} end, case Tlv6 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv6}}}) % extra fields not allowed end, Res1 = {'RelaxationPolicy',Term1,Term2,Term3,Term4,Term5}, Res1. 'dec_RelaxationPolicy_tightenings'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), ['dec_MRMapping'(V1, [16]) || V1 <- Tlv1]. 'dec_RelaxationPolicy_relaxations'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), ['dec_MRMapping'(V1, [16]) || V1 <- Tlv1]. %%================================ %% MRMapping %%================================ enc_MRMapping(Val) -> enc_MRMapping(Val, [<<48>>]). enc_MRMapping(Val, TagIn) -> {_,Cindex1,Cindex2} = Val, %%------------------------------------------------- %% attribute mapping(1) with type SEQUENCE OF OPTIONAL %%------------------------------------------------- {EncBytes1,EncLen1} = case Cindex1 of asn1_NOVALUE -> {<<>>,0}; _ -> 'enc_MRMapping_mapping'(Cindex1, [<<48>>,<<160>>]) end, %%------------------------------------------------- %% attribute substitution(2) with type SEQUENCE OF OPTIONAL %%------------------------------------------------- {EncBytes2,EncLen2} = case Cindex2 of asn1_NOVALUE -> {<<>>,0}; _ -> 'enc_MRMapping_substitution'(Cindex2, [<<48>>,<<161>>]) end, BytesSoFar = [EncBytes1, EncBytes2], LenSoFar = EncLen1 + EncLen2, encode_tags(TagIn, BytesSoFar, LenSoFar). %%================================ %% MRMapping_mapping %%================================ enc_MRMapping_mapping(Val, TagIn) -> {EncBytes,EncLen} = 'enc_MRMapping_mapping_components'(Val,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_MRMapping_mapping_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_MRMapping_mapping_components'([H|T],AccBytes, AccLen) -> {EncBytes,EncLen} = 'enc_Mapping'(H, [<<48>>]), 'enc_MRMapping_mapping_components'(T,[EncBytes|AccBytes], AccLen + EncLen). %%================================ %% MRMapping_substitution %%================================ enc_MRMapping_substitution(Val, TagIn) -> {EncBytes,EncLen} = 'enc_MRMapping_substitution_components'(Val,[],0), encode_tags(TagIn, EncBytes, EncLen). 'enc_MRMapping_substitution_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_MRMapping_substitution_components'([H|T],AccBytes, AccLen) -> {EncBytes,EncLen} = 'enc_MRSubstitution'(H, [<<48>>]), 'enc_MRMapping_substitution_components'(T,[EncBytes|AccBytes], AccLen + EncLen). dec_MRMapping(Tlv) -> dec_MRMapping(Tlv, [16]). dec_MRMapping(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- %% attribute mapping(1) with type SEQUENCE OF OPTIONAL %%------------------------------------------------- {Term1,Tlv2} = case Tlv1 of [{131072,V1}|TempTlv2] -> {'dec_MRMapping_mapping'(V1, [16]), TempTlv2}; _ -> { asn1_NOVALUE, Tlv1} end, %%------------------------------------------------- %% attribute substitution(2) with type SEQUENCE OF OPTIONAL %%------------------------------------------------- {Term2,Tlv3} = case Tlv2 of [{131073,V2}|TempTlv3] -> {'dec_MRMapping_substitution'(V2, [16]), TempTlv3}; _ -> { asn1_NOVALUE, Tlv2} end, case Tlv3 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed end, Res1 = {'MRMapping',Term1,Term2}, Res1. 'dec_MRMapping_mapping'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), ['dec_Mapping'(V1, [16]) || V1 <- Tlv1]. 'dec_MRMapping_substitution'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), ['dec_MRSubstitution'(V1, [16]) || V1 <- Tlv1]. %%================================ %% Mapping %%================================ enc_Mapping(Val) -> enc_Mapping(Val, [<<48>>]). enc_Mapping(Val, TagIn) -> {_,Cindex1,Cindex2} = Val, %%------------------------------------------------- %% attribute mappingFunction(1) with type OBJECT IDENTIFIER %%------------------------------------------------- {EncBytes1,EncLen1} = encode_object_identifier(Cindex1, [<<6>>]), %%------------------------------------------------- %% attribute level(2) with type INTEGER DEFAULT = 0 %%------------------------------------------------- {EncBytes2,EncLen2} = case Cindex2 of asn1_DEFAULT -> {<<>>,0}; _ when Cindex2 =:= 0 -> {<<>>,0}; _ -> encode_integer(Cindex2, [<<2>>]) end, BytesSoFar = [EncBytes1, EncBytes2], LenSoFar = EncLen1 + EncLen2, encode_tags(TagIn, BytesSoFar, LenSoFar). dec_Mapping(Tlv) -> dec_Mapping(Tlv, [16]). dec_Mapping(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- %% attribute mappingFunction(1) with type OBJECT IDENTIFIER %%------------------------------------------------- [V1|Tlv2] = Tlv1, Term1 = decode_object_identifier(V1, [6]), %%------------------------------------------------- %% attribute level(2) with type INTEGER DEFAULT = 0 %%------------------------------------------------- {Term2,Tlv3} = case Tlv2 of [{2,V2}|TempTlv3] -> {decode_integer(V2, []), TempTlv3}; _ -> {0,Tlv2} end, case Tlv3 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed end, Res1 = {'Mapping',Term1,Term2}, Res1. %%================================ %% MRSubstitution %%================================ enc_MRSubstitution(Val) -> enc_MRSubstitution(Val, [<<48>>]). enc_MRSubstitution(Val, TagIn) -> {_,Cindex1,Cindex2,Cindex3} = Val, %%------------------------------------------------- %% attribute attribute(1) with type OBJECT IDENTIFIER %%------------------------------------------------- {EncBytes1,EncLen1} = encode_object_identifier(Cindex1, [<<6>>]), %%------------------------------------------------- %% attribute oldMatchingRule(2) with type OBJECT IDENTIFIER OPTIONAL %%------------------------------------------------- {EncBytes2,EncLen2} = case Cindex2 of asn1_NOVALUE -> {<<>>,0}; _ -> encode_object_identifier(Cindex2, [<<6>>,<<160>>]) end, %%------------------------------------------------- %% attribute newMatchingRule(3) with type OBJECT IDENTIFIER OPTIONAL %%------------------------------------------------- {EncBytes3,EncLen3} = case Cindex3 of asn1_NOVALUE -> {<<>>,0}; _ -> encode_object_identifier(Cindex3, [<<6>>,<<161>>]) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3], LenSoFar = EncLen1 + EncLen2 + EncLen3, encode_tags(TagIn, BytesSoFar, LenSoFar). dec_MRSubstitution(Tlv) -> dec_MRSubstitution(Tlv, [16]). dec_MRSubstitution(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- %% attribute attribute(1) with type OBJECT IDENTIFIER %%------------------------------------------------- [V1|Tlv2] = Tlv1, Term1 = decode_object_identifier(V1, [6]), %%------------------------------------------------- %% attribute oldMatchingRule(2) with type OBJECT IDENTIFIER OPTIONAL %%------------------------------------------------- {Term2,Tlv3} = case Tlv2 of [{131072,V2}|TempTlv3] -> {decode_object_identifier(V2, [6]), TempTlv3}; _ -> { asn1_NOVALUE, Tlv2} end, %%------------------------------------------------- %% attribute newMatchingRule(3) with type OBJECT IDENTIFIER OPTIONAL %%------------------------------------------------- {Term3,Tlv4} = case Tlv3 of [{131073,V3}|TempTlv4] -> {decode_object_identifier(V3, [6]), TempTlv4}; _ -> { asn1_NOVALUE, Tlv3} end, case Tlv4 of [] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowed end, Res1 = {'MRSubstitution',Term1,Term2,Term3}, Res1. %%================================ %% subentryNameForm_DirectoryString %%================================ enc_subentryNameForm_DirectoryString(Val) -> enc_subentryNameForm_DirectoryString(Val, []). enc_subentryNameForm_DirectoryString(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of teletexString -> encode_restricted_string(element(2,Val), [<<20>>]); printableString -> encode_restricted_string(element(2,Val), [<<19>>]); universalString -> encode_universal_string(element(2,Val), [<<28>>]); bmpString -> encode_BMP_string(element(2,Val), [<<30>>]); uTF8String -> encode_UTF8_string(element(2,Val), [<<12>>]); utf8String -> encode_UTF8_string(element(2,Val), [<<12>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, encode_tags(TagIn, EncBytes, EncLen). dec_subentryNameForm_DirectoryString(Tlv) -> dec_subentryNameForm_DirectoryString(Tlv, []). dec_subentryNameForm_DirectoryString(Tlv, TagIn) -> Tlv1 = match_tags(Tlv, TagIn), case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of %% 'teletexString' {20, V1} -> {teletexString, begin Val1 = decode_restricted_string(V1, []), C1 = byte_size(Val1), if 1 =< C1, C1 =< 128 -> binary_to_list(Val1); true -> exit({error,{asn1,bad_range}}) end end}; %% 'printableString' {19, V1} -> {printableString, begin Val2 = decode_restricted_string(V1, []), C2 = byte_size(Val2), if 1 =< C2, C2 =< 128 -> binary_to_list(Val2); true -> exit({error,{asn1,bad_range}}) end end}; %% 'universalString' {28, V1} -> {universalString, begin Val3 = decode_universal_string(V1, []), C3 = length(Val3), if 1 =< C3, C3 =< 128 -> Val3; true -> exit({error,{asn1,bad_range}}) end end}; %% 'bmpString' {30, V1} -> {bmpString, begin Val4 = decode_BMP_string(V1, []), C4 = length(Val4), if 1 =< C4, C4 =< 128 -> Val4; true -> exit({error,{asn1,bad_range}}) end end}; %% 'uTF8String' {12, V1} -> {uTF8String, decode_UTF8_string(V1, [])}; Else -> exit({error,{asn1,{invalid_choice_tag,Else}}}) end . %%================================ %% subentry_DirectoryString %%================================ enc_subentry_DirectoryString(Val) -> enc_subentry_DirectoryString(Val, []). enc_subentry_DirectoryString(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of teletexString -> encode_restricted_string(element(2,Val), [<<20>>]); printableString -> encode_restricted_string(element(2,Val), [<<19>>]); universalString -> encode_universal_string(element(2,Val), [<<28>>]); bmpString -> encode_BMP_string(element(2,Val), [<<30>>]); uTF8String -> encode_UTF8_string(element(2,Val), [<<12>>]); utf8String -> encode_UTF8_string(element(2,Val), [<<12>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, encode_tags(TagIn, EncBytes, EncLen). dec_subentry_DirectoryString(Tlv) -> dec_subentry_DirectoryString(Tlv, []). dec_subentry_DirectoryString(Tlv, TagIn) -> Tlv1 = match_tags(Tlv, TagIn), case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of %% 'teletexString' {20, V1} -> {teletexString, begin Val1 = decode_restricted_string(V1, []), C1 = byte_size(Val1), if 1 =< C1, C1 =< 128 -> binary_to_list(Val1); true -> exit({error,{asn1,bad_range}}) end end}; %% 'printableString' {19, V1} -> {printableString, begin Val2 = decode_restricted_string(V1, []), C2 = byte_size(Val2), if 1 =< C2, C2 =< 128 -> binary_to_list(Val2); true -> exit({error,{asn1,bad_range}}) end end}; %% 'universalString' {28, V1} -> {universalString, begin Val3 = decode_universal_string(V1, []), C3 = length(Val3), if 1 =< C3, C3 =< 128 -> Val3; true -> exit({error,{asn1,bad_range}}) end end}; %% 'bmpString' {30, V1} -> {bmpString, begin Val4 = decode_BMP_string(V1, []), C4 = length(Val4), if 1 =< C4, C4 =< 128 -> Val4; true -> exit({error,{asn1,bad_range}}) end end}; %% 'uTF8String' {12, V1} -> {uTF8String, decode_UTF8_string(V1, [])}; Else -> exit({error,{asn1,{invalid_choice_tag,Else}}}) end . 'id-oc-top'() -> {2,5,6,0}. 'id-oc-alias'() -> {2,5,6,1}. 'id-oc-parent'() -> {2,5,6,28}. 'id-oc-child'() -> {2,5,6,29}. 'id-at-objectClass'() -> {2,5,4,0}. 'id-at-aliasedEntryName'() -> {2,5,4,1}. 'id-mr-objectIdentifierMatch'() -> {2,5,13,0}. 'id-mr-distinguishedNameMatch'() -> {2,5,13,1}. 'id-oa-excludeAllCollectiveAttributes'() -> {2,5,18,0}. 'id-oa-createTimestamp'() -> {2,5,18,1}. 'id-oa-modifyTimestamp'() -> {2,5,18,2}. 'id-oa-creatorsName'() -> {2,5,18,3}. 'id-oa-modifiersName'() -> {2,5,18,4}. 'id-oa-administrativeRole'() -> {2,5,18,5}. 'id-oa-subtreeSpecification'() -> {2,5,18,6}. 'id-oa-collectiveExclusions'() -> {2,5,18,7}. 'id-oa-subschemaTimestamp'() -> {2,5,18,8}. 'id-oa-hasSubordinates'() -> {2,5,18,9}. 'id-oa-subschemaSubentryList'() -> {2,5,18,10}. 'id-oa-accessControlSubentryList'() -> {2,5,18,11}. 'id-oa-collectiveAttributeSubentryList'() -> {2,5,18,12}. 'id-oa-contextDefaultSubentryList'() -> {2,5,18,13}. 'id-oa-contextAssertionDefault'() -> {2,5,18,14}. 'id-oa-serviceAdminSubentryList'() -> {2,5,18,15}. 'id-oa-searchRules'() -> {2,5,18,16}. 'id-oa-hierarchyLevel'() -> {2,5,18,17}. 'id-oa-hierarchyBelow'() -> {2,5,18,18}. 'id-oa-hierarchyParent'() -> {2,5,18,19}. 'id-sc-subentry'() -> {2,5,17,0}. 'id-sc-accessControlSubentry'() -> {2,5,17,1}. 'id-sc-collectiveAttributeSubentry'() -> {2,5,17,2}. 'id-sc-contextAssertionSubentry'() -> {2,5,17,3}. 'id-sc-serviceAdminSubentry'() -> {2,5,17,4}. 'id-nf-subentryNameForm'() -> {2,5,15,16}. 'id-ar-autonomousArea'() -> {2,5,23,1}. 'id-ar-accessControlSpecificArea'() -> {2,5,23,2}. 'id-ar-accessControlInnerArea'() -> {2,5,23,3}. 'id-ar-subschemaAdminSpecificArea'() -> {2,5,23,4}. 'id-ar-collectiveAttributeSpecificArea'() -> {2,5,23,5}. 'id-ar-collectiveAttributeInnerArea'() -> {2,5,23,6}. 'id-ar-contextDefaultSpecificArea'() -> {2,5,23,7}. 'id-ar-serviceSpecificArea'() -> {2,5,23,8}. 'id-at'() -> {2,5,4}. 'id-at-countryName'() -> {2,5,4,6}. 'id-at-organizationName'() -> {2,5,4,10}. 'id-at-serialNumber'() -> {2,5,4,5}. 'id-at-stateOrProvinceName'() -> {2,5,4,8}. 'id-at-localityName'() -> {2,5,4,7}. 'id-at-commonName'() -> {2,5,4,3}. 'id-at-organizationalUnitName'() -> {2,5,4,11}. %%================================ %% objectClass %%================================ enc_objectClass(derivation, _,_) -> exit({error,{'use of missing field in object', derivation}}); enc_objectClass('Type', Val, _RestPrimFieldName) -> encode_object_identifier(Val, [<<6>>]); enc_objectClass('equality-match', Val, [H|T]) -> enc_objectIdentifierMatch(H, Val, T); enc_objectClass('ordering-match', _,_) -> exit({error,{'use of missing field in object', 'ordering-match'}}); enc_objectClass('substrings-match', _,_) -> exit({error,{'use of missing field in object', 'substrings-match'}}). dec_objectClass(derivation, _,_) -> exit({error,{'illegal use of missing field in object', derivation}}); dec_objectClass('Type', Bytes,_) -> Tlv = tlv_format(Bytes), decode_object_identifier(Tlv, [6]); dec_objectClass('equality-match', Bytes,[H|T]) -> dec_objectIdentifierMatch(H, Bytes, T); dec_objectClass('ordering-match', _,_) -> exit({error,{'illegal use of missing field in object', 'ordering-match'}}); dec_objectClass('substrings-match', _,_) -> exit({error,{'illegal use of missing field in object', 'substrings-match'}}). tlv_format(Bytes) when is_binary(Bytes) -> {Tlv,_} = ber_decode_nif(Bytes), Tlv; tlv_format(Bytes) -> Bytes. %%================================ %% aliasedEntryName %%================================ enc_aliasedEntryName(derivation, _,_) -> exit({error,{'use of missing field in object', derivation}}); enc_aliasedEntryName('Type', Val, _RestPrimFieldName) -> enc_DistinguishedName(Val, [<<48>>]); enc_aliasedEntryName('equality-match', Val, [H|T]) -> enc_distinguishedNameMatch(H, Val, T); enc_aliasedEntryName('ordering-match', _,_) -> exit({error,{'use of missing field in object', 'ordering-match'}}); enc_aliasedEntryName('substrings-match', _,_) -> exit({error,{'use of missing field in object', 'substrings-match'}}). dec_aliasedEntryName(derivation, _,_) -> exit({error,{'illegal use of missing field in object', derivation}}); dec_aliasedEntryName('Type', Bytes,_) -> Tlv = tlv_format(Bytes), dec_DistinguishedName(Tlv, [16]); dec_aliasedEntryName('equality-match', Bytes,[H|T]) -> dec_distinguishedNameMatch(H, Bytes, T); dec_aliasedEntryName('ordering-match', _,_) -> exit({error,{'illegal use of missing field in object', 'ordering-match'}}); dec_aliasedEntryName('substrings-match', _,_) -> exit({error,{'illegal use of missing field in object', 'substrings-match'}}). %%================================ %% objectIdentifierMatch %%================================ enc_objectIdentifierMatch('AssertionType', Val, _RestPrimFieldName) -> encode_object_identifier(Val, [<<6>>]). dec_objectIdentifierMatch('AssertionType', Bytes,_) -> Tlv = tlv_format(Bytes), decode_object_identifier(Tlv, [6]). %%================================ %% distinguishedNameMatch %%================================ enc_distinguishedNameMatch('AssertionType', Val, _RestPrimFieldName) -> enc_DistinguishedName(Val, [<<48>>]). dec_distinguishedNameMatch('AssertionType', Bytes,_) -> Tlv = tlv_format(Bytes), dec_DistinguishedName(Tlv, [16]). %%================================ %% createTimestamp %%================================ enc_createTimestamp(derivation, _,_) -> exit({error,{'use of missing field in object', derivation}}); enc_createTimestamp('Type', Val, _RestPrimFieldName) -> encode_restricted_string(Val, [<<24>>]); enc_createTimestamp('equality-match', Val, [H|T]) -> 'SelectedAttributeTypes':enc_generalizedTimeMatch(H, Val, T); enc_createTimestamp('ordering-match', Val, [H|T]) -> 'SelectedAttributeTypes':enc_generalizedTimeOrderingMatch(H, Val, T); enc_createTimestamp('substrings-match', _,_) -> exit({error,{'use of missing field in object', 'substrings-match'}}). dec_createTimestamp(derivation, _,_) -> exit({error,{'illegal use of missing field in object', derivation}}); dec_createTimestamp('Type', Bytes,_) -> Tlv = tlv_format(Bytes), begin binary_to_list(decode_restricted_string(Tlv, [24])) end ; dec_createTimestamp('equality-match', Bytes,[H|T]) -> 'SelectedAttributeTypes':dec_generalizedTimeMatch(H, Bytes, T); dec_createTimestamp('ordering-match', Bytes,[H|T]) -> 'SelectedAttributeTypes':dec_generalizedTimeOrderingMatch(H, Bytes, T); dec_createTimestamp('substrings-match', _,_) -> exit({error,{'illegal use of missing field in object', 'substrings-match'}}). %%================================ %% modifyTimestamp %%================================ enc_modifyTimestamp(derivation, _,_) -> exit({error,{'use of missing field in object', derivation}}); enc_modifyTimestamp('Type', Val, _RestPrimFieldName) -> encode_restricted_string(Val, [<<24>>]); enc_modifyTimestamp('equality-match', Val, [H|T]) -> 'SelectedAttributeTypes':enc_generalizedTimeMatch(H, Val, T); enc_modifyTimestamp('ordering-match', Val, [H|T]) -> 'SelectedAttributeTypes':enc_generalizedTimeOrderingMatch(H, Val, T); enc_modifyTimestamp('substrings-match', _,_) -> exit({error,{'use of missing field in object', 'substrings-match'}}). dec_modifyTimestamp(derivation, _,_) -> exit({error,{'illegal use of missing field in object', derivation}}); dec_modifyTimestamp('Type', Bytes,_) -> Tlv = tlv_format(Bytes), begin binary_to_list(decode_restricted_string(Tlv, [24])) end ; dec_modifyTimestamp('equality-match', Bytes,[H|T]) -> 'SelectedAttributeTypes':dec_generalizedTimeMatch(H, Bytes, T); dec_modifyTimestamp('ordering-match', Bytes,[H|T]) -> 'SelectedAttributeTypes':dec_generalizedTimeOrderingMatch(H, Bytes, T); dec_modifyTimestamp('substrings-match', _,_) -> exit({error,{'illegal use of missing field in object', 'substrings-match'}}). %%================================ %% subschemaTimestamp %%================================ enc_subschemaTimestamp(derivation, _,_) -> exit({error,{'use of missing field in object', derivation}}); enc_subschemaTimestamp('Type', Val, _RestPrimFieldName) -> encode_restricted_string(Val, [<<24>>]); enc_subschemaTimestamp('equality-match', Val, [H|T]) -> 'SelectedAttributeTypes':enc_generalizedTimeMatch(H, Val, T); enc_subschemaTimestamp('ordering-match', Val, [H|T]) -> 'SelectedAttributeTypes':enc_generalizedTimeOrderingMatch(H, Val, T); enc_subschemaTimestamp('substrings-match', _,_) -> exit({error,{'use of missing field in object', 'substrings-match'}}). dec_subschemaTimestamp(derivation, _,_) -> exit({error,{'illegal use of missing field in object', derivation}}); dec_subschemaTimestamp('Type', Bytes,_) -> Tlv = tlv_format(Bytes), begin binary_to_list(decode_restricted_string(Tlv, [24])) end ; dec_subschemaTimestamp('equality-match', Bytes,[H|T]) -> 'SelectedAttributeTypes':dec_generalizedTimeMatch(H, Bytes, T); dec_subschemaTimestamp('ordering-match', Bytes,[H|T]) -> 'SelectedAttributeTypes':dec_generalizedTimeOrderingMatch(H, Bytes, T); dec_subschemaTimestamp('substrings-match', _,_) -> exit({error,{'illegal use of missing field in object', 'substrings-match'}}). %%================================ %% creatorsName %%================================ enc_creatorsName(derivation, _,_) -> exit({error,{'use of missing field in object', derivation}}); enc_creatorsName('Type', Val, _RestPrimFieldName) -> enc_DistinguishedName(Val, [<<48>>]); enc_creatorsName('equality-match', Val, [H|T]) -> enc_distinguishedNameMatch(H, Val, T); enc_creatorsName('ordering-match', _,_) -> exit({error,{'use of missing field in object', 'ordering-match'}}); enc_creatorsName('substrings-match', _,_) -> exit({error,{'use of missing field in object', 'substrings-match'}}). dec_creatorsName(derivation, _,_) -> exit({error,{'illegal use of missing field in object', derivation}}); dec_creatorsName('Type', Bytes,_) -> Tlv = tlv_format(Bytes), dec_DistinguishedName(Tlv, [16]); dec_creatorsName('equality-match', Bytes,[H|T]) -> dec_distinguishedNameMatch(H, Bytes, T); dec_creatorsName('ordering-match', _,_) -> exit({error,{'illegal use of missing field in object', 'ordering-match'}}); dec_creatorsName('substrings-match', _,_) -> exit({error,{'illegal use of missing field in object', 'substrings-match'}}). %%================================ %% modifiersName %%================================ enc_modifiersName(derivation, _,_) -> exit({error,{'use of missing field in object', derivation}}); enc_modifiersName('Type', Val, _RestPrimFieldName) -> enc_DistinguishedName(Val, [<<48>>]); enc_modifiersName('equality-match', Val, [H|T]) -> enc_distinguishedNameMatch(H, Val, T); enc_modifiersName('ordering-match', _,_) -> exit({error,{'use of missing field in object', 'ordering-match'}}); enc_modifiersName('substrings-match', _,_) -> exit({error,{'use of missing field in object', 'substrings-match'}}). dec_modifiersName(derivation, _,_) -> exit({error,{'illegal use of missing field in object', derivation}}); dec_modifiersName('Type', Bytes,_) -> Tlv = tlv_format(Bytes), dec_DistinguishedName(Tlv, [16]); dec_modifiersName('equality-match', Bytes,[H|T]) -> dec_distinguishedNameMatch(H, Bytes, T); dec_modifiersName('ordering-match', _,_) -> exit({error,{'illegal use of missing field in object', 'ordering-match'}}); dec_modifiersName('substrings-match', _,_) -> exit({error,{'illegal use of missing field in object', 'substrings-match'}}). %%================================ %% subschemaSubentryList %%================================ enc_subschemaSubentryList(derivation, _,_) -> exit({error,{'use of missing field in object', derivation}}); enc_subschemaSubentryList('Type', Val, _RestPrimFieldName) -> enc_DistinguishedName(Val, [<<48>>]); enc_subschemaSubentryList('equality-match', Val, [H|T]) -> enc_distinguishedNameMatch(H, Val, T); enc_subschemaSubentryList('ordering-match', _,_) -> exit({error,{'use of missing field in object', 'ordering-match'}}); enc_subschemaSubentryList('substrings-match', _,_) -> exit({error,{'use of missing field in object', 'substrings-match'}}). dec_subschemaSubentryList(derivation, _,_) -> exit({error,{'illegal use of missing field in object', derivation}}); dec_subschemaSubentryList('Type', Bytes,_) -> Tlv = tlv_format(Bytes), dec_DistinguishedName(Tlv, [16]); dec_subschemaSubentryList('equality-match', Bytes,[H|T]) -> dec_distinguishedNameMatch(H, Bytes, T); dec_subschemaSubentryList('ordering-match', _,_) -> exit({error,{'illegal use of missing field in object', 'ordering-match'}}); dec_subschemaSubentryList('substrings-match', _,_) -> exit({error,{'illegal use of missing field in object', 'substrings-match'}}). %%================================ %% accessControlSubentryList %%================================ enc_accessControlSubentryList(derivation, _,_) -> exit({error,{'use of missing field in object', derivation}}); enc_accessControlSubentryList('Type', Val, _RestPrimFieldName) -> enc_DistinguishedName(Val, [<<48>>]); enc_accessControlSubentryList('equality-match', Val, [H|T]) -> enc_distinguishedNameMatch(H, Val, T); enc_accessControlSubentryList('ordering-match', _,_) -> exit({error,{'use of missing field in object', 'ordering-match'}}); enc_accessControlSubentryList('substrings-match', _,_) -> exit({error,{'use of missing field in object', 'substrings-match'}}). dec_accessControlSubentryList(derivation, _,_) -> exit({error,{'illegal use of missing field in object', derivation}}); dec_accessControlSubentryList('Type', Bytes,_) -> Tlv = tlv_format(Bytes), dec_DistinguishedName(Tlv, [16]); dec_accessControlSubentryList('equality-match', Bytes,[H|T]) -> dec_distinguishedNameMatch(H, Bytes, T); dec_accessControlSubentryList('ordering-match', _,_) -> exit({error,{'illegal use of missing field in object', 'ordering-match'}}); dec_accessControlSubentryList('substrings-match', _,_) -> exit({error,{'illegal use of missing field in object', 'substrings-match'}}). %%================================ %% collectiveAttributeSubentryList %%================================ enc_collectiveAttributeSubentryList(derivation, _,_) -> exit({error,{'use of missing field in object', derivation}}); enc_collectiveAttributeSubentryList('Type', Val, _RestPrimFieldName) -> enc_DistinguishedName(Val, [<<48>>]); enc_collectiveAttributeSubentryList('equality-match', Val, [H|T]) -> enc_distinguishedNameMatch(H, Val, T); enc_collectiveAttributeSubentryList('ordering-match', _,_) -> exit({error,{'use of missing field in object', 'ordering-match'}}); enc_collectiveAttributeSubentryList('substrings-match', _,_) -> exit({error,{'use of missing field in object', 'substrings-match'}}). dec_collectiveAttributeSubentryList(derivation, _,_) -> exit({error,{'illegal use of missing field in object', derivation}}); dec_collectiveAttributeSubentryList('Type', Bytes,_) -> Tlv = tlv_format(Bytes), dec_DistinguishedName(Tlv, [16]); dec_collectiveAttributeSubentryList('equality-match', Bytes,[H|T]) -> dec_distinguishedNameMatch(H, Bytes, T); dec_collectiveAttributeSubentryList('ordering-match', _,_) -> exit({error,{'illegal use of missing field in object', 'ordering-match'}}); dec_collectiveAttributeSubentryList('substrings-match', _,_) -> exit({error,{'illegal use of missing field in object', 'substrings-match'}}). %%================================ %% contextDefaultSubentryList %%================================ enc_contextDefaultSubentryList(derivation, _,_) -> exit({error,{'use of missing field in object', derivation}}); enc_contextDefaultSubentryList('Type', Val, _RestPrimFieldName) -> enc_DistinguishedName(Val, [<<48>>]); enc_contextDefaultSubentryList('equality-match', Val, [H|T]) -> enc_distinguishedNameMatch(H, Val, T); enc_contextDefaultSubentryList('ordering-match', _,_) -> exit({error,{'use of missing field in object', 'ordering-match'}}); enc_contextDefaultSubentryList('substrings-match', _,_) -> exit({error,{'use of missing field in object', 'substrings-match'}}). dec_contextDefaultSubentryList(derivation, _,_) -> exit({error,{'illegal use of missing field in object', derivation}}); dec_contextDefaultSubentryList('Type', Bytes,_) -> Tlv = tlv_format(Bytes), dec_DistinguishedName(Tlv, [16]); dec_contextDefaultSubentryList('equality-match', Bytes,[H|T]) -> dec_distinguishedNameMatch(H, Bytes, T); dec_contextDefaultSubentryList('ordering-match', _,_) -> exit({error,{'illegal use of missing field in object', 'ordering-match'}}); dec_contextDefaultSubentryList('substrings-match', _,_) -> exit({error,{'illegal use of missing field in object', 'substrings-match'}}). %%================================ %% serviceAdminSubentryList %%================================ enc_serviceAdminSubentryList(derivation, _,_) -> exit({error,{'use of missing field in object', derivation}}); enc_serviceAdminSubentryList('Type', Val, _RestPrimFieldName) -> enc_DistinguishedName(Val, [<<48>>]); enc_serviceAdminSubentryList('equality-match', Val, [H|T]) -> enc_distinguishedNameMatch(H, Val, T); enc_serviceAdminSubentryList('ordering-match', _,_) -> exit({error,{'use of missing field in object', 'ordering-match'}}); enc_serviceAdminSubentryList('substrings-match', _,_) -> exit({error,{'use of missing field in object', 'substrings-match'}}). dec_serviceAdminSubentryList(derivation, _,_) -> exit({error,{'illegal use of missing field in object', derivation}}); dec_serviceAdminSubentryList('Type', Bytes,_) -> Tlv = tlv_format(Bytes), dec_DistinguishedName(Tlv, [16]); dec_serviceAdminSubentryList('equality-match', Bytes,[H|T]) -> dec_distinguishedNameMatch(H, Bytes, T); dec_serviceAdminSubentryList('ordering-match', _,_) -> exit({error,{'illegal use of missing field in object', 'ordering-match'}}); dec_serviceAdminSubentryList('substrings-match', _,_) -> exit({error,{'illegal use of missing field in object', 'substrings-match'}}). %%================================ %% hasSubordinates %%================================ enc_hasSubordinates(derivation, _,_) -> exit({error,{'use of missing field in object', derivation}}); enc_hasSubordinates('Type', Val, _RestPrimFieldName) -> encode_boolean(Val, [<<1>>]); enc_hasSubordinates('equality-match', Val, [H|T]) -> 'SelectedAttributeTypes':enc_booleanMatch(H, Val, T); enc_hasSubordinates('ordering-match', _,_) -> exit({error,{'use of missing field in object', 'ordering-match'}}); enc_hasSubordinates('substrings-match', _,_) -> exit({error,{'use of missing field in object', 'substrings-match'}}). dec_hasSubordinates(derivation, _,_) -> exit({error,{'illegal use of missing field in object', derivation}}); dec_hasSubordinates('Type', Bytes,_) -> Tlv = tlv_format(Bytes), decode_boolean(Tlv, [1]); dec_hasSubordinates('equality-match', Bytes,[H|T]) -> 'SelectedAttributeTypes':dec_booleanMatch(H, Bytes, T); dec_hasSubordinates('ordering-match', _,_) -> exit({error,{'illegal use of missing field in object', 'ordering-match'}}); dec_hasSubordinates('substrings-match', _,_) -> exit({error,{'illegal use of missing field in object', 'substrings-match'}}). %%================================ %% administrativeRole %%================================ enc_administrativeRole(derivation, _,_) -> exit({error,{'use of missing field in object', derivation}}); enc_administrativeRole('Type', Val, _RestPrimFieldName) -> encode_object_identifier(Val, [<<6>>]); enc_administrativeRole('equality-match', Val, [H|T]) -> enc_objectIdentifierMatch(H, Val, T); enc_administrativeRole('ordering-match', _,_) -> exit({error,{'use of missing field in object', 'ordering-match'}}); enc_administrativeRole('substrings-match', _,_) -> exit({error,{'use of missing field in object', 'substrings-match'}}). dec_administrativeRole(derivation, _,_) -> exit({error,{'illegal use of missing field in object', derivation}}); dec_administrativeRole('Type', Bytes,_) -> Tlv = tlv_format(Bytes), decode_object_identifier(Tlv, [6]); dec_administrativeRole('equality-match', Bytes,[H|T]) -> dec_objectIdentifierMatch(H, Bytes, T); dec_administrativeRole('ordering-match', _,_) -> exit({error,{'illegal use of missing field in object', 'ordering-match'}}); dec_administrativeRole('substrings-match', _,_) -> exit({error,{'illegal use of missing field in object', 'substrings-match'}}). %%================================ %% subtreeSpecification %%================================ enc_subtreeSpecification(derivation, _,_) -> exit({error,{'use of missing field in object', derivation}}); enc_subtreeSpecification('Type', Val, _RestPrimFieldName) -> enc_SubtreeSpecification(Val, [<<48>>]); enc_subtreeSpecification('equality-match', _,_) -> exit({error,{'use of missing field in object', 'equality-match'}}); enc_subtreeSpecification('ordering-match', _,_) -> exit({error,{'use of missing field in object', 'ordering-match'}}); enc_subtreeSpecification('substrings-match', _,_) -> exit({error,{'use of missing field in object', 'substrings-match'}}). dec_subtreeSpecification(derivation, _,_) -> exit({error,{'illegal use of missing field in object', derivation}}); dec_subtreeSpecification('Type', Bytes,_) -> Tlv = tlv_format(Bytes), dec_SubtreeSpecification(Tlv, [16]); dec_subtreeSpecification('equality-match', _,_) -> exit({error,{'illegal use of missing field in object', 'equality-match'}}); dec_subtreeSpecification('ordering-match', _,_) -> exit({error,{'illegal use of missing field in object', 'ordering-match'}}); dec_subtreeSpecification('substrings-match', _,_) -> exit({error,{'illegal use of missing field in object', 'substrings-match'}}). %%================================ %% collectiveExclusions %%================================ enc_collectiveExclusions(derivation, _,_) -> exit({error,{'use of missing field in object', derivation}}); enc_collectiveExclusions('Type', Val, _RestPrimFieldName) -> encode_object_identifier(Val, [<<6>>]); enc_collectiveExclusions('equality-match', Val, [H|T]) -> enc_objectIdentifierMatch(H, Val, T); enc_collectiveExclusions('ordering-match', _,_) -> exit({error,{'use of missing field in object', 'ordering-match'}}); enc_collectiveExclusions('substrings-match', _,_) -> exit({error,{'use of missing field in object', 'substrings-match'}}). dec_collectiveExclusions(derivation, _,_) -> exit({error,{'illegal use of missing field in object', derivation}}); dec_collectiveExclusions('Type', Bytes,_) -> Tlv = tlv_format(Bytes), decode_object_identifier(Tlv, [6]); dec_collectiveExclusions('equality-match', Bytes,[H|T]) -> dec_objectIdentifierMatch(H, Bytes, T); dec_collectiveExclusions('ordering-match', _,_) -> exit({error,{'illegal use of missing field in object', 'ordering-match'}}); dec_collectiveExclusions('substrings-match', _,_) -> exit({error,{'illegal use of missing field in object', 'substrings-match'}}). %%================================ %% contextAssertionDefaults %%================================ enc_contextAssertionDefaults(derivation, _,_) -> exit({error,{'use of missing field in object', derivation}}); enc_contextAssertionDefaults('Type', Val, _RestPrimFieldName) -> 'DirectoryAbstractService':enc_TypeAndContextAssertion(Val, [<<48>>]); enc_contextAssertionDefaults('equality-match', Val, [H|T]) -> 'SelectedAttributeTypes':enc_objectIdentifierFirstComponentMatch(H, Val, T); enc_contextAssertionDefaults('ordering-match', _,_) -> exit({error,{'use of missing field in object', 'ordering-match'}}); enc_contextAssertionDefaults('substrings-match', _,_) -> exit({error,{'use of missing field in object', 'substrings-match'}}). dec_contextAssertionDefaults(derivation, _,_) -> exit({error,{'illegal use of missing field in object', derivation}}); dec_contextAssertionDefaults('Type', Bytes,_) -> Tlv = tlv_format(Bytes), 'DirectoryAbstractService':dec_TypeAndContextAssertion(Tlv, [16]); dec_contextAssertionDefaults('equality-match', Bytes,[H|T]) -> 'SelectedAttributeTypes':dec_objectIdentifierFirstComponentMatch(H, Bytes, T); dec_contextAssertionDefaults('ordering-match', _,_) -> exit({error,{'illegal use of missing field in object', 'ordering-match'}}); dec_contextAssertionDefaults('substrings-match', _,_) -> exit({error,{'illegal use of missing field in object', 'substrings-match'}}). %%================================ %% searchRules %%================================ enc_searchRules(derivation, _,_) -> exit({error,{'use of missing field in object', derivation}}); enc_searchRules('Type', Val, _RestPrimFieldName) -> enc_SearchRuleDescription(Val, [<<48>>]); enc_searchRules('equality-match', Val, [H|T]) -> 'SelectedAttributeTypes':enc_integerFirstComponentMatch(H, Val, T); enc_searchRules('ordering-match', _,_) -> exit({error,{'use of missing field in object', 'ordering-match'}}); enc_searchRules('substrings-match', _,_) -> exit({error,{'use of missing field in object', 'substrings-match'}}). dec_searchRules(derivation, _,_) -> exit({error,{'illegal use of missing field in object', derivation}}); dec_searchRules('Type', Bytes,_) -> Tlv = tlv_format(Bytes), dec_SearchRuleDescription(Tlv, [16]); dec_searchRules('equality-match', Bytes,[H|T]) -> 'SelectedAttributeTypes':dec_integerFirstComponentMatch(H, Bytes, T); dec_searchRules('ordering-match', _,_) -> exit({error,{'illegal use of missing field in object', 'ordering-match'}}); dec_searchRules('substrings-match', _,_) -> exit({error,{'illegal use of missing field in object', 'substrings-match'}}). %%================================ %% hierarchyLevel %%================================ enc_hierarchyLevel(derivation, _,_) -> exit({error,{'use of missing field in object', derivation}}); enc_hierarchyLevel('Type', Val, _RestPrimFieldName) -> encode_integer(Val, [<<2>>]); enc_hierarchyLevel('equality-match', Val, [H|T]) -> 'SelectedAttributeTypes':enc_integerMatch(H, Val, T); enc_hierarchyLevel('ordering-match', Val, [H|T]) -> 'SelectedAttributeTypes':enc_integerOrderingMatch(H, Val, T); enc_hierarchyLevel('substrings-match', _,_) -> exit({error,{'use of missing field in object', 'substrings-match'}}). dec_hierarchyLevel(derivation, _,_) -> exit({error,{'illegal use of missing field in object', derivation}}); dec_hierarchyLevel('Type', Bytes,_) -> Tlv = tlv_format(Bytes), decode_integer(Tlv, [2]); dec_hierarchyLevel('equality-match', Bytes,[H|T]) -> 'SelectedAttributeTypes':dec_integerMatch(H, Bytes, T); dec_hierarchyLevel('ordering-match', Bytes,[H|T]) -> 'SelectedAttributeTypes':dec_integerOrderingMatch(H, Bytes, T); dec_hierarchyLevel('substrings-match', _,_) -> exit({error,{'illegal use of missing field in object', 'substrings-match'}}). %%================================ %% hierarchyBelow %%================================ enc_hierarchyBelow(derivation, _,_) -> exit({error,{'use of missing field in object', derivation}}); enc_hierarchyBelow('Type', Val, _RestPrimFieldName) -> encode_boolean(Val, [<<1>>]); enc_hierarchyBelow('equality-match', Val, [H|T]) -> 'SelectedAttributeTypes':enc_booleanMatch(H, Val, T); enc_hierarchyBelow('ordering-match', _,_) -> exit({error,{'use of missing field in object', 'ordering-match'}}); enc_hierarchyBelow('substrings-match', _,_) -> exit({error,{'use of missing field in object', 'substrings-match'}}). dec_hierarchyBelow(derivation, _,_) -> exit({error,{'illegal use of missing field in object', derivation}}); dec_hierarchyBelow('Type', Bytes,_) -> Tlv = tlv_format(Bytes), decode_boolean(Tlv, [1]); dec_hierarchyBelow('equality-match', Bytes,[H|T]) -> 'SelectedAttributeTypes':dec_booleanMatch(H, Bytes, T); dec_hierarchyBelow('ordering-match', _,_) -> exit({error,{'illegal use of missing field in object', 'ordering-match'}}); dec_hierarchyBelow('substrings-match', _,_) -> exit({error,{'illegal use of missing field in object', 'substrings-match'}}). %%================================ %% hierarchyParent %%================================ enc_hierarchyParent(derivation, _,_) -> exit({error,{'use of missing field in object', derivation}}); enc_hierarchyParent('Type', Val, _RestPrimFieldName) -> enc_DistinguishedName(Val, [<<48>>]); enc_hierarchyParent('equality-match', Val, [H|T]) -> enc_distinguishedNameMatch(H, Val, T); enc_hierarchyParent('ordering-match', _,_) -> exit({error,{'use of missing field in object', 'ordering-match'}}); enc_hierarchyParent('substrings-match', _,_) -> exit({error,{'use of missing field in object', 'substrings-match'}}). dec_hierarchyParent(derivation, _,_) -> exit({error,{'illegal use of missing field in object', derivation}}); dec_hierarchyParent('Type', Bytes,_) -> Tlv = tlv_format(Bytes), dec_DistinguishedName(Tlv, [16]); dec_hierarchyParent('equality-match', Bytes,[H|T]) -> dec_distinguishedNameMatch(H, Bytes, T); dec_hierarchyParent('ordering-match', _,_) -> exit({error,{'illegal use of missing field in object', 'ordering-match'}}); dec_hierarchyParent('substrings-match', _,_) -> exit({error,{'illegal use of missing field in object', 'substrings-match'}}). %%================================ %% SupportedAttributes %%================================ getenc_SupportedAttributes(Id) when Id =:= {2,5,4,0} -> fun enc_objectClass/3; getenc_SupportedAttributes(Id) when Id =:= {2,5,4,1} -> fun enc_aliasedEntryName/3; getenc_SupportedAttributes(_) -> fun(_, Val, _RestPrimFieldName) -> case Val of {asn1_OPENTYPE,Bin} when is_binary(Bin) -> {Bin,byte_size(Bin)} end end. getdec_SupportedAttributes(Id) when Id =:= {2,5,4,0} -> fun 'dec_objectClass'/3; getdec_SupportedAttributes(Id) when Id =:= {2,5,4,1} -> fun 'dec_aliasedEntryName'/3; getdec_SupportedAttributes(_) -> fun(_,Bytes, _RestPrimFieldName) -> case Bytes of Bin when is_binary(Bin) -> {asn1_OPENTYPE,Bin}; _ -> {asn1_OPENTYPE,ber_encode(Bytes)} end end. %%================================ %% SupportedContexts %%================================ getenc_SupportedContexts(_) -> fun(_, Val, _RestPrimFieldName) -> case Val of {asn1_OPENTYPE,Bin} when is_binary(Bin) -> {Bin,byte_size(Bin)} end end. getdec_SupportedContexts(_) -> fun(_,Bytes, _RestPrimFieldName) -> case Bytes of Bin when is_binary(Bin) -> {asn1_OPENTYPE,Bin}; _ -> {asn1_OPENTYPE,ber_encode(Bytes)} end end. %%================================ %% SupportedMatchingRestrictions %%================================ getenc_SupportedMatchingRestrictions(_) -> fun(_, Val, _RestPrimFieldName) -> case Val of {asn1_OPENTYPE,Bin} when is_binary(Bin) -> {Bin,byte_size(Bin)} end end. getdec_SupportedMatchingRestrictions(_) -> 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_BMP_string(Buffer, Tags) -> Bin = match_and_collect(Buffer, Tags), mk_BMP_string(binary_to_list(Bin)). decode_UTF8_string(Tlv, TagsIn) -> Val = match_tags(Tlv, TagsIn), case Val of [_ | _] = PartList -> collect_parts(PartList); Bin -> Bin end. decode_bitstring2(1, Unused, <>) -> lists:sublist([B7, B6, B5, B4, B3, B2, B1, B0], 8 - Unused); decode_bitstring2(Len, Unused, <>) -> [B7, B6, B5, B4, B3, B2, B1, B0 | decode_bitstring2(Len - 1, Unused, Buffer)]. decode_bitstring_NNL(BitList, NamedNumberList) -> decode_bitstring_NNL(BitList, NamedNumberList, 0, []). decode_bitstring_NNL([], _, _No, Result) -> lists:reverse(Result); decode_bitstring_NNL([B | BitList], [{Name, No} | NamedNumberList], No, Result) -> if B =:= 0 -> decode_bitstring_NNL(BitList, NamedNumberList, No + 1, Result); true -> decode_bitstring_NNL(BitList, NamedNumberList, No + 1, [Name | Result]) end; decode_bitstring_NNL([1 | BitList], NamedNumberList, No, Result) -> decode_bitstring_NNL(BitList, NamedNumberList, No + 1, [{bit, No} | Result]); decode_bitstring_NNL([0 | BitList], NamedNumberList, No, Result) -> decode_bitstring_NNL(BitList, NamedNumberList, No + 1, Result). decode_boolean(Tlv, TagIn) -> Val = match_tags(Tlv, TagIn), case Val of <<0:8>> -> false; <<_:8>> -> true; _ -> exit({error, {asn1, {decode_boolean, Val}}}) end. decode_integer(Tlv, TagIn) -> Bin = match_tags(Tlv, TagIn), Len = byte_size(Bin), <> = Bin, Int. decode_named_bit_string(Buffer, NamedNumberList, Tags) -> case match_and_collect(Buffer, Tags) of <<0>> -> []; <> -> BitString = decode_bitstring2(byte_size(Bits), Unused, Bits), decode_bitstring_NNL(BitString, NamedNumberList) end. decode_null(Tlv, Tags) -> Val = match_tags(Tlv, Tags), case Val of <<>> -> 'NULL'; _ -> exit({error, {asn1, {decode_null, Val}}}) end. decode_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_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). decode_universal_string(Buffer, Tags) -> Bin = match_and_collect(Buffer, Tags), mk_universal_string(binary_to_list(Bin)). 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_BMP_string(BMPString, TagIn) -> OctetList = mk_BMP_list(BMPString), encode_tags(TagIn, OctetList, length(OctetList)). encode_UTF8_string(UTF8String, TagIn) when is_binary(UTF8String) -> encode_tags(TagIn, UTF8String, byte_size(UTF8String)); encode_UTF8_string(UTF8String, TagIn) -> encode_tags(TagIn, UTF8String, length(UTF8String)). encode_bitstring([B8, B7, B6, B5, B4, B3, B2, B1 | Rest]) -> Val = B8 bsl 7 bor (B7 bsl 6) bor (B6 bsl 5) bor (B5 bsl 4) bor (B4 bsl 3) bor (B3 bsl 2) bor (B2 bsl 1) bor B1, encode_bitstring(Rest, [Val], 1); encode_bitstring(Val) -> {Unused, Octet} = unused_bitlist(Val, 7, 0), {1, Unused, [Octet]}. encode_bitstring([B8, B7, B6, B5, B4, B3, B2, B1 | Rest], Ack, Len) -> Val = B8 bsl 7 bor (B7 bsl 6) bor (B6 bsl 5) bor (B5 bsl 4) bor (B4 bsl 3) bor (B3 bsl 2) bor (B2 bsl 1) bor B1, encode_bitstring(Rest, [Ack, Val], Len + 1); encode_bitstring([], Ack, Len) -> {Len, 0, Ack}; encode_bitstring(Rest, Ack, Len) -> {Unused, Val} = unused_bitlist(Rest, 7, 0), {Len + 1, Unused, [Ack, Val]}. encode_boolean(true, TagIn) -> encode_tags(TagIn, [255], 1); encode_boolean(false, TagIn) -> encode_tags(TagIn, [0], 1); encode_boolean(X, _) -> exit({error, {asn1, {encode_boolean, X}}}). encode_integer(Val) -> Bytes = if Val >= 0 -> encode_integer_pos(Val, []); true -> encode_integer_neg(Val, []) end, {Bytes, length(Bytes)}. encode_integer(Val, Tag) when is_integer(Val) -> encode_tags(Tag, encode_integer(Val)); encode_integer(Val, _Tag) -> exit({error, {asn1, {encode_integer, Val}}}). encode_integer_neg(-1, [B1 | _T] = L) when B1 > 127 -> L; encode_integer_neg(N, Acc) -> encode_integer_neg(N bsr 8, [N band 255 | Acc]). encode_integer_pos(0, [B | _Acc] = L) when B < 128 -> L; encode_integer_pos(N, Acc) -> encode_integer_pos(N bsr 8, [N band 255 | Acc]). encode_length(L) when L =< 127 -> {[L], 1}; encode_length(L) -> Oct = minimum_octets(L), Len = length(Oct), if Len =< 126 -> {[128 bor Len | Oct], Len + 1}; true -> exit({error, {asn1, too_long_length_oct, Len}}) end. encode_named_bit_string([H | _] = Bits, NamedBitList, TagIn) when is_atom(H) -> do_encode_named_bit_string(Bits, NamedBitList, TagIn); encode_named_bit_string([{bit, _} | _] = Bits, NamedBitList, TagIn) -> do_encode_named_bit_string(Bits, NamedBitList, TagIn); encode_named_bit_string([], _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_null(_Val, TagIn) -> encode_tags(TagIn, [], 0). 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_universal_string(Universal, TagIn) -> OctetList = mk_uni_list(Universal), encode_tags(TagIn, OctetList, length(OctetList)). encode_unnamed_bit_string(Bits, TagIn) -> Unused = (8 - bit_size(Bits) band 7) band 7, Bin = <>, encode_tags(TagIn, Bin, byte_size(Bin)). get_all_bitposes([{bit, ValPos} | Rest], NamedBitList, Ack) -> get_all_bitposes(Rest, NamedBitList, [ValPos | Ack]); get_all_bitposes([Val | Rest], NamedBitList, Ack) when is_atom(Val) -> case lists:keyfind(Val, 1, NamedBitList) of {_ValName, ValPos} -> get_all_bitposes(Rest, NamedBitList, [ValPos | Ack]); _ -> exit({error, {asn1, {bitstring_namedbit, Val}}}) end; get_all_bitposes([], _NamedBitList, Ack) -> lists:sort(Ack). make_and_set_list(0, [], _) -> []; make_and_set_list(0, _, _) -> exit({error, {asn1, bitstring_sizeconstraint}}); make_and_set_list(Len, [XPos | SetPos], XPos) -> [1 | make_and_set_list(Len - 1, SetPos, XPos + 1)]; make_and_set_list(Len, [Pos | SetPos], XPos) -> [0 | make_and_set_list(Len - 1, [Pos | SetPos], XPos + 1)]; make_and_set_list(Len, [], XPos) -> [0 | make_and_set_list(Len - 1, [], XPos + 1)]. match_and_collect(Tlv, TagsIn) -> Val = match_tags(Tlv, TagsIn), case Val of [_ | _] = PartList -> collect_parts(PartList); Bin when is_binary(Bin) -> Bin end. match_tags({T, V}, [T]) -> V; match_tags({T, V}, [T | Tt]) -> match_tags(V, Tt); match_tags([{T, V}], [T | Tt]) -> match_tags(V, Tt); match_tags([{T, _V} | _] = Vlist, [T]) -> Vlist; match_tags(Tlv, []) -> Tlv; match_tags({Tag, _V} = Tlv, [T | _Tt]) -> exit({error, {asn1, {wrong_tag, {{expected, T}, {got, Tag, Tlv}}}}}). minimum_octets(0, Acc) -> Acc; minimum_octets(Val, Acc) -> minimum_octets(Val bsr 8, [Val band 255 | Acc]). minimum_octets(Val) -> minimum_octets(Val, []). mk_BMP_list(In) -> mk_BMP_list(In, []). mk_BMP_list([], List) -> lists:reverse(List); mk_BMP_list([{0, 0, C, D} | T], List) -> mk_BMP_list(T, [D, C | List]); mk_BMP_list([H | T], List) -> mk_BMP_list(T, [H, 0 | List]). mk_BMP_string(In) -> mk_BMP_string(In, []). mk_BMP_string([], US) -> lists:reverse(US); mk_BMP_string([0, B | T], US) -> mk_BMP_string(T, [B | US]); mk_BMP_string([C, D | T], US) -> mk_BMP_string(T, [{0, 0, C, D} | US]). 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). mk_uni_list(In) -> mk_uni_list(In, []). mk_uni_list([], List) -> lists:reverse(List); mk_uni_list([{A, B, C, D} | T], List) -> mk_uni_list(T, [D, C, B, A | List]); mk_uni_list([H | T], List) -> mk_uni_list(T, [H, 0, 0, 0 | List]). mk_universal_string(In) -> mk_universal_string(In, []). mk_universal_string([], Acc) -> lists:reverse(Acc); mk_universal_string([0, 0, 0, D | T], Acc) -> mk_universal_string(T, [D | Acc]); mk_universal_string([A, B, C, D | T], Acc) -> mk_universal_string(T, [{A, B, C, D} | Acc]). unused_bitlist([], Trail, Ack) -> {Trail + 1, Ack}; unused_bitlist([Bit | Rest], Trail, Ack) -> unused_bitlist(Rest, Trail - 1, Bit bsl Trail bor Ack).