summaryrefslogtreecommitdiff
path: root/ACSE-1.erl
diff options
context:
space:
mode:
Diffstat (limited to 'ACSE-1.erl')
-rw-r--r--ACSE-1.erl2014
1 files changed, 2014 insertions, 0 deletions
diff --git a/ACSE-1.erl b/ACSE-1.erl
new file mode 100644
index 0000000..86fec8b
--- /dev/null
+++ b/ACSE-1.erl
@@ -0,0 +1,2014 @@
+%% Generated by the Erlang ASN.1 BER-compiler version:1.7
+%% Purpose: encoder and decoder to the types in mod ACSE-1
+
+-module('ACSE-1').
+-include("ACSE-1.hrl").
+-define('RT_BER',asn1rt_ber_bin).
+-asn1_info([{vsn,'1.7'},
+ {module,'ACSE-1'},
+ {options,[{i,[47,104,111,109,101,47,113,117,97,120,47,101,114,108,47,97,115,110]},warnings,ber,errors,{cwd,[47,104,111,109,101,47,113,117,97,120,47,101,114,108,47,97,115,110]},{outdir,[47,104,111,109,101,47,113,117,97,120,47,101,114,108,47,97,115,110]},{i,[46]},{i,[47,104,111,109,101,47,113,117,97,120,47,101,114,108,47,97,115,110,47,97,99,115,101]}]}]).
+
+-export([encoding_rule/0]).
+-export([
+'enc_ACSE-apdu'/2,
+'enc_AARQ-apdu'/2,
+'enc_AARE-apdu'/2,
+'enc_RLRQ-apdu'/2,
+'enc_RLRE-apdu'/2,
+'enc_ABRT-apdu'/2,
+'enc_ABRT-diagnostic'/2,
+'enc_ABRT-source'/2,
+'enc_ACSE-requirements'/2,
+'enc_Application-context-name-list'/2,
+'enc_Application-context-name'/2,
+'enc_AP-title'/2,
+'enc_AE-qualifier'/2,
+'enc_AP-title-form1'/2,
+'enc_AE-qualifier-form1'/2,
+'enc_AP-title-form2'/2,
+'enc_AE-qualifier-form2'/2,
+'enc_AE-title'/2,
+'enc_AE-title-form1'/2,
+'enc_AE-title-form2'/2,
+'enc_AE-invocation-identifier'/2,
+'enc_AP-invocation-identifier'/2,
+'enc_Associate-result'/2,
+'enc_Associate-source-diagnostic'/2,
+'enc_Association-information'/2,
+'enc_Authentication-value'/2,
+'enc_Implementation-data'/2,
+'enc_Mechanism-name'/2,
+'enc_Release-request-reason'/2,
+'enc_Release-response-reason'/2,
+'enc_EXTERNAL'/2
+]).
+
+-export([
+'dec_ACSE-apdu'/2,
+'dec_AARQ-apdu'/2,
+'dec_AARE-apdu'/2,
+'dec_RLRQ-apdu'/2,
+'dec_RLRE-apdu'/2,
+'dec_ABRT-apdu'/2,
+'dec_ABRT-diagnostic'/2,
+'dec_ABRT-source'/2,
+'dec_ACSE-requirements'/2,
+'dec_Application-context-name-list'/2,
+'dec_Application-context-name'/2,
+'dec_AP-title'/2,
+'dec_AE-qualifier'/2,
+'dec_AP-title-form1'/2,
+'dec_AE-qualifier-form1'/2,
+'dec_AP-title-form2'/2,
+'dec_AE-qualifier-form2'/2,
+'dec_AE-title'/2,
+'dec_AE-title-form1'/2,
+'dec_AE-title-form2'/2,
+'dec_AE-invocation-identifier'/2,
+'dec_AP-invocation-identifier'/2,
+'dec_Associate-result'/2,
+'dec_Associate-source-diagnostic'/2,
+'dec_Association-information'/2,
+'dec_Authentication-value'/2,
+'dec_Implementation-data'/2,
+'dec_Mechanism-name'/2,
+'dec_Release-request-reason'/2,
+'dec_Release-response-reason'/2,
+'dec_EXTERNAL'/2
+]).
+
+-export([
+'dec_ACSE-apdu'/3,
+'dec_AARQ-apdu'/3,
+'dec_AARE-apdu'/3,
+'dec_RLRQ-apdu'/3,
+'dec_RLRE-apdu'/3,
+'dec_ABRT-apdu'/3,
+'dec_ABRT-diagnostic'/3,
+'dec_ABRT-source'/3,
+'dec_ACSE-requirements'/3,
+'dec_Application-context-name-list'/3,
+'dec_Application-context-name'/3,
+'dec_AP-title'/3,
+'dec_AE-qualifier'/3,
+'dec_AP-title-form1'/3,
+'dec_AE-qualifier-form1'/3,
+'dec_AP-title-form2'/3,
+'dec_AE-qualifier-form2'/3,
+'dec_AE-title'/3,
+'dec_AE-title-form1'/3,
+'dec_AE-title-form2'/3,
+'dec_AE-invocation-identifier'/3,
+'dec_AP-invocation-identifier'/3,
+'dec_Associate-result'/3,
+'dec_Associate-source-diagnostic'/3,
+'dec_Association-information'/3,
+'dec_Authentication-value'/3,
+'dec_Implementation-data'/3,
+'dec_Mechanism-name'/3,
+'dec_Release-request-reason'/3,
+'dec_Release-response-reason'/3,
+'dec_EXTERNAL'/3
+]).
+
+-export([
+'acse-as-id'/0,
+'aCSE-id'/0
+]).
+
+-export([
+'getenc_ObjectSet'/2
+]).
+
+-export([
+'getdec_ObjectSet'/2
+]).
+
+-export([info/0]).
+
+
+-export([encode/2,decode/2,encode_disp/2,decode_disp/2]).
+
+encoding_rule() ->
+ ber.
+
+encode(Type,Data) ->
+case catch encode_disp(Type,Data) of
+ {'EXIT',{error,Reason}} ->
+ {error,Reason};
+ {'EXIT',Reason} ->
+ {error,{asn1,Reason}};
+ {Bytes,_Len} ->
+ {ok,wrap_encode(Bytes)};
+ Bytes ->
+ {ok,wrap_encode(Bytes)}
+end.
+
+decode(Type,Data) ->
+case catch decode_disp(Type,wrap_decode(Data)) of
+ {'EXIT',{error,Reason}} ->
+ {error,Reason};
+ {'EXIT',Reason} ->
+ {error,{asn1,Reason}};
+ {X,_Rest} ->
+ {ok,X};
+ {X,_Rest,_Len} ->
+ {ok,X}
+end.
+
+encode_disp('ACSE-apdu',Data) -> 'enc_ACSE-apdu'(Data,[]);
+encode_disp('AARQ-apdu',Data) -> 'enc_AARQ-apdu'(Data,[]);
+encode_disp('AARE-apdu',Data) -> 'enc_AARE-apdu'(Data,[]);
+encode_disp('RLRQ-apdu',Data) -> 'enc_RLRQ-apdu'(Data,[]);
+encode_disp('RLRE-apdu',Data) -> 'enc_RLRE-apdu'(Data,[]);
+encode_disp('ABRT-apdu',Data) -> 'enc_ABRT-apdu'(Data,[]);
+encode_disp('ABRT-diagnostic',Data) -> 'enc_ABRT-diagnostic'(Data,[]);
+encode_disp('ABRT-source',Data) -> 'enc_ABRT-source'(Data,[]);
+encode_disp('ACSE-requirements',Data) -> 'enc_ACSE-requirements'(Data,[]);
+encode_disp('Application-context-name-list',Data) -> 'enc_Application-context-name-list'(Data,[]);
+encode_disp('Application-context-name',Data) -> 'enc_Application-context-name'(Data,[]);
+encode_disp('AP-title',Data) -> 'enc_AP-title'(Data,[]);
+encode_disp('AE-qualifier',Data) -> 'enc_AE-qualifier'(Data,[]);
+encode_disp('AP-title-form1',Data) -> 'enc_AP-title-form1'(Data,[]);
+encode_disp('AE-qualifier-form1',Data) -> 'enc_AE-qualifier-form1'(Data,[]);
+encode_disp('AP-title-form2',Data) -> 'enc_AP-title-form2'(Data,[]);
+encode_disp('AE-qualifier-form2',Data) -> 'enc_AE-qualifier-form2'(Data,[]);
+encode_disp('AE-title',Data) -> 'enc_AE-title'(Data,[]);
+encode_disp('AE-title-form1',Data) -> 'enc_AE-title-form1'(Data,[]);
+encode_disp('AE-title-form2',Data) -> 'enc_AE-title-form2'(Data,[]);
+encode_disp('AE-invocation-identifier',Data) -> 'enc_AE-invocation-identifier'(Data,[]);
+encode_disp('AP-invocation-identifier',Data) -> 'enc_AP-invocation-identifier'(Data,[]);
+encode_disp('Associate-result',Data) -> 'enc_Associate-result'(Data,[]);
+encode_disp('Associate-source-diagnostic',Data) -> 'enc_Associate-source-diagnostic'(Data,[]);
+encode_disp('Association-information',Data) -> 'enc_Association-information'(Data,[]);
+encode_disp('Authentication-value',Data) -> 'enc_Authentication-value'(Data,[]);
+encode_disp('Implementation-data',Data) -> 'enc_Implementation-data'(Data,[]);
+encode_disp('Mechanism-name',Data) -> 'enc_Mechanism-name'(Data,[]);
+encode_disp('Release-request-reason',Data) -> 'enc_Release-request-reason'(Data,[]);
+encode_disp('Release-response-reason',Data) -> 'enc_Release-response-reason'(Data,[]);
+encode_disp('EXTERNAL',Data) -> 'enc_EXTERNAL'(Data,[]);
+encode_disp(Type,_Data) -> exit({error,{asn1,{undefined_type,Type}}}).
+
+
+decode_disp('ACSE-apdu',Data) -> 'dec_ACSE-apdu'(Data,mandatory);
+decode_disp('AARQ-apdu',Data) -> 'dec_AARQ-apdu'(Data,mandatory);
+decode_disp('AARE-apdu',Data) -> 'dec_AARE-apdu'(Data,mandatory);
+decode_disp('RLRQ-apdu',Data) -> 'dec_RLRQ-apdu'(Data,mandatory);
+decode_disp('RLRE-apdu',Data) -> 'dec_RLRE-apdu'(Data,mandatory);
+decode_disp('ABRT-apdu',Data) -> 'dec_ABRT-apdu'(Data,mandatory);
+decode_disp('ABRT-diagnostic',Data) -> 'dec_ABRT-diagnostic'(Data,mandatory);
+decode_disp('ABRT-source',Data) -> 'dec_ABRT-source'(Data,mandatory);
+decode_disp('ACSE-requirements',Data) -> 'dec_ACSE-requirements'(Data,mandatory);
+decode_disp('Application-context-name-list',Data) -> 'dec_Application-context-name-list'(Data,mandatory);
+decode_disp('Application-context-name',Data) -> 'dec_Application-context-name'(Data,mandatory);
+decode_disp('AP-title',Data) -> 'dec_AP-title'(Data,mandatory);
+decode_disp('AE-qualifier',Data) -> 'dec_AE-qualifier'(Data,mandatory);
+decode_disp('AP-title-form1',Data) -> 'dec_AP-title-form1'(Data,mandatory);
+decode_disp('AE-qualifier-form1',Data) -> 'dec_AE-qualifier-form1'(Data,mandatory);
+decode_disp('AP-title-form2',Data) -> 'dec_AP-title-form2'(Data,mandatory);
+decode_disp('AE-qualifier-form2',Data) -> 'dec_AE-qualifier-form2'(Data,mandatory);
+decode_disp('AE-title',Data) -> 'dec_AE-title'(Data,mandatory);
+decode_disp('AE-title-form1',Data) -> 'dec_AE-title-form1'(Data,mandatory);
+decode_disp('AE-title-form2',Data) -> 'dec_AE-title-form2'(Data,mandatory);
+decode_disp('AE-invocation-identifier',Data) -> 'dec_AE-invocation-identifier'(Data,mandatory);
+decode_disp('AP-invocation-identifier',Data) -> 'dec_AP-invocation-identifier'(Data,mandatory);
+decode_disp('Associate-result',Data) -> 'dec_Associate-result'(Data,mandatory);
+decode_disp('Associate-source-diagnostic',Data) -> 'dec_Associate-source-diagnostic'(Data,mandatory);
+decode_disp('Association-information',Data) -> 'dec_Association-information'(Data,mandatory);
+decode_disp('Authentication-value',Data) -> 'dec_Authentication-value'(Data,mandatory);
+decode_disp('Implementation-data',Data) -> 'dec_Implementation-data'(Data,mandatory);
+decode_disp('Mechanism-name',Data) -> 'dec_Mechanism-name'(Data,mandatory);
+decode_disp('Release-request-reason',Data) -> 'dec_Release-request-reason'(Data,mandatory);
+decode_disp('Release-response-reason',Data) -> 'dec_Release-response-reason'(Data,mandatory);
+decode_disp('EXTERNAL',Data) -> 'dec_EXTERNAL'(Data,mandatory);
+decode_disp(Type,_Data) -> exit({error,{asn1,{undefined_type,Type}}}).
+
+
+
+wrap_encode(Bytes) when is_list(Bytes) ->
+ binary_to_list(list_to_binary(Bytes));
+wrap_encode(Bytes) when is_binary(Bytes) ->
+ binary_to_list(Bytes);
+wrap_encode(Bytes) -> Bytes.
+
+wrap_decode(Bytes) when is_list(Bytes) ->
+ list_to_binary(Bytes);
+wrap_decode(Bytes) -> Bytes.
+
+
+info() ->
+ case ?MODULE:module_info() of
+ MI when is_list(MI) ->
+ case lists:keysearch(attributes,1,MI) of
+ {value,{_,Attributes}} when is_list(Attributes) ->
+ case lists:keysearch(asn1_info,1,Attributes) of
+ {value,{_,Info}} when is_list(Info) ->
+ Info;
+ _ ->
+ []
+ end;
+ _ ->
+ []
+ end
+ end.
+
+
+%%================================
+%% ACSE-apdu
+%%================================
+
+'enc_ACSE-apdu'({'ACSE-apdu',Val}, TagIn) ->
+ 'enc_ACSE-apdu'(Val, TagIn);
+
+'enc_ACSE-apdu'(Val, TagIn) ->
+ {EncBytes,EncLen} = case element(1,Val) of
+ aarq ->
+ 'enc_AARQ-apdu'(element(2,Val), []);
+ aare ->
+ 'enc_AARE-apdu'(element(2,Val), []);
+ rlrq ->
+ 'enc_RLRQ-apdu'(element(2,Val), []);
+ rlre ->
+ 'enc_RLRE-apdu'(element(2,Val), []);
+ abrt ->
+ 'enc_ABRT-apdu'(element(2,Val), []);
+ Else ->
+ exit({error,{asn1,{invalid_choice_type,Else}}})
+ end,
+
+?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen).
+
+
+
+
+'dec_ACSE-apdu'(Bytes, OptOrMand) ->
+ 'dec_ACSE-apdu'(Bytes, OptOrMand, []).
+
+'dec_ACSE-apdu'(Bytes, OptOrMand, TagIn) ->
+ {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand),
+ IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end,
+ IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end,
+ case Bytes1 of
+
+%% 'aarq'
+ <<1:2,_:1,0:5,_/binary>> ->
+ {Dec, Rest, RbCho} = 'dec_AARQ-apdu'(Bytes1, mandatory, []),
+ {{aarq, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
+
+
+%% 'aare'
+ <<1:2,_:1,1:5,_/binary>> ->
+ {Dec, Rest, RbCho} = 'dec_AARE-apdu'(Bytes1, mandatory, []),
+ {{aare, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
+
+
+%% 'rlrq'
+ <<1:2,_:1,2:5,_/binary>> ->
+ {Dec, Rest, RbCho} = 'dec_RLRQ-apdu'(Bytes1, mandatory, []),
+ {{rlrq, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
+
+
+%% 'rlre'
+ <<1:2,_:1,3:5,_/binary>> ->
+ {Dec, Rest, RbCho} = 'dec_RLRE-apdu'(Bytes1, mandatory, []),
+ {{rlre, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
+
+
+%% 'abrt'
+ <<1:2,_:1,4:5,_/binary>> ->
+ {Dec, Rest, RbCho} = 'dec_ABRT-apdu'(Bytes1, mandatory, []),
+ {{abrt, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
+
+ _ ->
+ {{asn1_ExtAlt,Bytes1},<<>>, RbExp}
+ end.
+
+
+%%================================
+%% AARQ-apdu
+%%================================
+'enc_AARQ-apdu'(Val, TagIn) ->
+
+%%-------------------------------------------------
+%% attribute number 1 with type BIT STRING DEFAULT = [version1]
+%%-------------------------------------------------
+ {EncBytes1,EncLen1} = case ?RT_BER:cindex(2,Val,'protocol-version') of
+ asn1_DEFAULT -> {<<>>,0};
+ [version1] -> {<<>>,0};
+ _ ->
+ ?RT_BER:encode_bit_string([], ?RT_BER:cindex(2,Val,'protocol-version'), [{version1,0}], [{tag,128,0,'IMPLICIT',32}])
+ end,
+
+%%-------------------------------------------------
+%% attribute number 2 with type OBJECT IDENTIFIER
+%%-------------------------------------------------
+ {EncBytes2,EncLen2} = ?RT_BER:encode_object_identifier(?RT_BER:cindex(3,Val,'application-context-name'), [{tag,128,1,'EXPLICIT',32}]),
+
+%%-------------------------------------------------
+%% attribute number 3 External ACSE-1:AP-title OPTIONAL
+%%-------------------------------------------------
+ {EncBytes3,EncLen3} = case ?RT_BER:cindex(4,Val,'called-AP-title') of
+ asn1_NOVALUE -> {<<>>,0};
+ _ ->
+ 'enc_AP-title'(?RT_BER:cindex(4,Val,'called-AP-title'), [{tag,128,2,'EXPLICIT',32}])
+ end,
+
+%%-------------------------------------------------
+%% attribute number 4 External ACSE-1:AE-qualifier OPTIONAL
+%%-------------------------------------------------
+ {EncBytes4,EncLen4} = case ?RT_BER:cindex(5,Val,'called-AE-qualifier') of
+ asn1_NOVALUE -> {<<>>,0};
+ _ ->
+ 'enc_AE-qualifier'(?RT_BER:cindex(5,Val,'called-AE-qualifier'), [{tag,128,3,'EXPLICIT',32}])
+ end,
+
+%%-------------------------------------------------
+%% attribute number 5 with type INTEGER OPTIONAL
+%%-------------------------------------------------
+ {EncBytes5,EncLen5} = case ?RT_BER:cindex(6,Val,'called-AP-invocation-identifier') of
+ asn1_NOVALUE -> {<<>>,0};
+ _ ->
+ ?RT_BER:encode_integer([], ?RT_BER:cindex(6,Val,'called-AP-invocation-identifier'), [{tag,128,4,'EXPLICIT',32}])
+ end,
+
+%%-------------------------------------------------
+%% attribute number 6 with type INTEGER OPTIONAL
+%%-------------------------------------------------
+ {EncBytes6,EncLen6} = case ?RT_BER:cindex(7,Val,'called-AE-invocation-identifier') of
+ asn1_NOVALUE -> {<<>>,0};
+ _ ->
+ ?RT_BER:encode_integer([], ?RT_BER:cindex(7,Val,'called-AE-invocation-identifier'), [{tag,128,5,'EXPLICIT',32}])
+ end,
+
+%%-------------------------------------------------
+%% attribute number 7 External ACSE-1:AP-title OPTIONAL
+%%-------------------------------------------------
+ {EncBytes7,EncLen7} = case ?RT_BER:cindex(8,Val,'calling-AP-title') of
+ asn1_NOVALUE -> {<<>>,0};
+ _ ->
+ 'enc_AP-title'(?RT_BER:cindex(8,Val,'calling-AP-title'), [{tag,128,6,'EXPLICIT',32}])
+ end,
+
+%%-------------------------------------------------
+%% attribute number 8 External ACSE-1:AE-qualifier OPTIONAL
+%%-------------------------------------------------
+ {EncBytes8,EncLen8} = case ?RT_BER:cindex(9,Val,'calling-AE-qualifier') of
+ asn1_NOVALUE -> {<<>>,0};
+ _ ->
+ 'enc_AE-qualifier'(?RT_BER:cindex(9,Val,'calling-AE-qualifier'), [{tag,128,7,'EXPLICIT',32}])
+ end,
+
+%%-------------------------------------------------
+%% attribute number 9 with type INTEGER OPTIONAL
+%%-------------------------------------------------
+ {EncBytes9,EncLen9} = case ?RT_BER:cindex(10,Val,'calling-AP-invocation-identifier') of
+ asn1_NOVALUE -> {<<>>,0};
+ _ ->
+ ?RT_BER:encode_integer([], ?RT_BER:cindex(10,Val,'calling-AP-invocation-identifier'), [{tag,128,8,'EXPLICIT',32}])
+ end,
+
+%%-------------------------------------------------
+%% attribute number 10 with type INTEGER OPTIONAL
+%%-------------------------------------------------
+ {EncBytes10,EncLen10} = case ?RT_BER:cindex(11,Val,'calling-AE-invocation-identifier') of
+ asn1_NOVALUE -> {<<>>,0};
+ _ ->
+ ?RT_BER:encode_integer([], ?RT_BER:cindex(11,Val,'calling-AE-invocation-identifier'), [{tag,128,9,'EXPLICIT',32}])
+ end,
+
+%%-------------------------------------------------
+%% attribute number 11 with type BIT STRING OPTIONAL
+%%-------------------------------------------------
+ {EncBytes11,EncLen11} = case ?RT_BER:cindex(12,Val,'sender-acse-requirements') of
+ asn1_NOVALUE -> {<<>>,0};
+ _ ->
+ ?RT_BER:encode_bit_string([], ?RT_BER:cindex(12,Val,'sender-acse-requirements'), [{authentication,0},{'application-context-negotiation',1}], [{tag,128,10,'IMPLICIT',32}])
+ end,
+
+%%-------------------------------------------------
+%% attribute number 12 with type OBJECT IDENTIFIER OPTIONAL
+%%-------------------------------------------------
+ {EncBytes12,EncLen12} = case ?RT_BER:cindex(13,Val,'mechanism-name') of
+ asn1_NOVALUE -> {<<>>,0};
+ _ ->
+ ?RT_BER:encode_object_identifier(?RT_BER:cindex(13,Val,'mechanism-name'), [{tag,128,11,'IMPLICIT',32}])
+ end,
+
+%%-------------------------------------------------
+%% attribute number 13 External ACSE-1:Authentication-value OPTIONAL
+%%-------------------------------------------------
+ {EncBytes13,EncLen13} = case ?RT_BER:cindex(14,Val,'calling-authentication-value') of
+ asn1_NOVALUE -> {<<>>,0};
+ _ ->
+ 'enc_Authentication-value'(?RT_BER:cindex(14,Val,'calling-authentication-value'), [{tag,128,12,'EXPLICIT',32}])
+ end,
+
+%%-------------------------------------------------
+%% attribute number 14 External ACSE-1:Application-context-name-list OPTIONAL
+%%-------------------------------------------------
+ {EncBytes14,EncLen14} = case ?RT_BER:cindex(15,Val,'application-context-name-list') of
+ asn1_NOVALUE -> {<<>>,0};
+ _ ->
+ 'enc_Application-context-name-list'(?RT_BER:cindex(15,Val,'application-context-name-list'), [{tag,128,13,'IMPLICIT',32}])
+ end,
+
+%%-------------------------------------------------
+%% attribute number 15 with type GraphicString OPTIONAL
+%%-------------------------------------------------
+ {EncBytes15,EncLen15} = case ?RT_BER:cindex(16,Val,'implementation-information') of
+ asn1_NOVALUE -> {<<>>,0};
+ _ ->
+ ?RT_BER:encode_restricted_string([], ?RT_BER:cindex(16,Val,'implementation-information'), 25, [{tag,128,29,'IMPLICIT',32}])
+ end,
+
+%%-------------------------------------------------
+%% attribute number 16 External ACSE-1:Association-information OPTIONAL
+%%-------------------------------------------------
+ {EncBytes16,EncLen16} = case ?RT_BER:cindex(17,Val,'user-information') of
+ asn1_NOVALUE -> {<<>>,0};
+ _ ->
+ 'enc_Association-information'(?RT_BER:cindex(17,Val,'user-information'), [{tag,128,30,'IMPLICIT',32}])
+ end,
+
+ BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4, EncBytes5, EncBytes6, EncBytes7, EncBytes8, EncBytes9, EncBytes10, EncBytes11, EncBytes12, EncBytes13, EncBytes14, EncBytes15, EncBytes16],
+ LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5 + EncLen6 + EncLen7 + EncLen8 + EncLen9 + EncLen10 + EncLen11 + EncLen12 + EncLen13 + EncLen14 + EncLen15 + EncLen16,
+ ?RT_BER:encode_tags(TagIn ++ [{tag,64,0,'IMPLICIT',32},{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar).
+
+
+'dec_AARQ-apdu'(Bytes, OptOrMand) ->
+ 'dec_AARQ-apdu'(Bytes, OptOrMand, []).
+
+'dec_AARQ-apdu'(Bytes, OptOrMand, TagIn) ->
+ %%-------------------------------------------------
+ %% decode tag and length
+ %%-------------------------------------------------
+ {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,64,0,'IMPLICIT',32},{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand),
+{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len),
+
+%%-------------------------------------------------
+%% attribute number 1 with type BIT STRING DEFAULT = [version1]
+%%-------------------------------------------------
+ {Term1,Bytes3,Rb2} = case Bytes2 of
+<<2:2,_:1,0:5,_/binary>> ->
+?RT_BER:decode_bit_string(Bytes2,[],[{version1,0}],[{tag,128,0,'IMPLICIT',32}], no_length, mandatory);
+_ ->
+{[version1],Bytes2, 0 }
+end,
+
+%%-------------------------------------------------
+%% attribute number 2 with type OBJECT IDENTIFIER
+%%-------------------------------------------------
+ {Term2,Bytes4,Rb3} = ?RT_BER:decode_object_identifier(Bytes3,[{tag,128,1,'EXPLICIT',32}], mandatory),
+
+%%-------------------------------------------------
+%% attribute number 3 External ACSE-1:AP-title OPTIONAL
+%%-------------------------------------------------
+ {Term3,Bytes5,Rb4} = case Bytes4 of
+<<2:2,_:1,2:5,_/binary>> ->
+'dec_AP-title'(Bytes4, opt_or_default, [{tag,128,2,'EXPLICIT',32}]);
+_ ->
+{ asn1_NOVALUE, Bytes4, 0 }
+end,
+
+%%-------------------------------------------------
+%% attribute number 4 External ACSE-1:AE-qualifier OPTIONAL
+%%-------------------------------------------------
+ {Term4,Bytes6,Rb5} = case Bytes5 of
+<<2:2,_:1,3:5,_/binary>> ->
+'dec_AE-qualifier'(Bytes5, opt_or_default, [{tag,128,3,'EXPLICIT',32}]);
+_ ->
+{ asn1_NOVALUE, Bytes5, 0 }
+end,
+
+%%-------------------------------------------------
+%% attribute number 5 with type INTEGER OPTIONAL
+%%-------------------------------------------------
+ {Term5,Bytes7,Rb6} = case Bytes6 of
+<<2:2,_:1,4:5,_/binary>> ->
+?RT_BER:decode_integer(Bytes6,[],[{tag,128,4,'EXPLICIT',32}], mandatory);
+_ ->
+{ asn1_NOVALUE, Bytes6, 0 }
+end,
+
+%%-------------------------------------------------
+%% attribute number 6 with type INTEGER OPTIONAL
+%%-------------------------------------------------
+ {Term6,Bytes8,Rb7} = case Bytes7 of
+<<2:2,_:1,5:5,_/binary>> ->
+?RT_BER:decode_integer(Bytes7,[],[{tag,128,5,'EXPLICIT',32}], mandatory);
+_ ->
+{ asn1_NOVALUE, Bytes7, 0 }
+end,
+
+%%-------------------------------------------------
+%% attribute number 7 External ACSE-1:AP-title OPTIONAL
+%%-------------------------------------------------
+ {Term7,Bytes9,Rb8} = case Bytes8 of
+<<2:2,_:1,6:5,_/binary>> ->
+'dec_AP-title'(Bytes8, opt_or_default, [{tag,128,6,'EXPLICIT',32}]);
+_ ->
+{ asn1_NOVALUE, Bytes8, 0 }
+end,
+
+%%-------------------------------------------------
+%% attribute number 8 External ACSE-1:AE-qualifier OPTIONAL
+%%-------------------------------------------------
+ {Term8,Bytes10,Rb9} = case Bytes9 of
+<<2:2,_:1,7:5,_/binary>> ->
+'dec_AE-qualifier'(Bytes9, opt_or_default, [{tag,128,7,'EXPLICIT',32}]);
+_ ->
+{ asn1_NOVALUE, Bytes9, 0 }
+end,
+
+%%-------------------------------------------------
+%% attribute number 9 with type INTEGER OPTIONAL
+%%-------------------------------------------------
+ {Term9,Bytes11,Rb10} = case Bytes10 of
+<<2:2,_:1,8:5,_/binary>> ->
+?RT_BER:decode_integer(Bytes10,[],[{tag,128,8,'EXPLICIT',32}], mandatory);
+_ ->
+{ asn1_NOVALUE, Bytes10, 0 }
+end,
+
+%%-------------------------------------------------
+%% attribute number 10 with type INTEGER OPTIONAL
+%%-------------------------------------------------
+ {Term10,Bytes12,Rb11} = case Bytes11 of
+<<2:2,_:1,9:5,_/binary>> ->
+?RT_BER:decode_integer(Bytes11,[],[{tag,128,9,'EXPLICIT',32}], mandatory);
+_ ->
+{ asn1_NOVALUE, Bytes11, 0 }
+end,
+
+%%-------------------------------------------------
+%% attribute number 11 with type BIT STRING OPTIONAL
+%%-------------------------------------------------
+ {Term11,Bytes13,Rb12} = case Bytes12 of
+<<2:2,_:1,10:5,_/binary>> ->
+?RT_BER:decode_bit_string(Bytes12,[],[{authentication,0},{'application-context-negotiation',1}],[{tag,128,10,'IMPLICIT',32}], no_length, mandatory);
+_ ->
+{ asn1_NOVALUE, Bytes12, 0 }
+end,
+
+%%-------------------------------------------------
+%% attribute number 12 with type OBJECT IDENTIFIER OPTIONAL
+%%-------------------------------------------------
+ {Term12,Bytes14,Rb13} = case Bytes13 of
+<<2:2,_:1,11:5,_/binary>> ->
+?RT_BER:decode_object_identifier(Bytes13,[{tag,128,11,'IMPLICIT',32}], mandatory);
+_ ->
+{ asn1_NOVALUE, Bytes13, 0 }
+end,
+
+%%-------------------------------------------------
+%% attribute number 13 External ACSE-1:Authentication-value OPTIONAL
+%%-------------------------------------------------
+ {Term13,Bytes15,Rb14} = case Bytes14 of
+<<2:2,_:1,12:5,_/binary>> ->
+'dec_Authentication-value'(Bytes14, opt_or_default, [{tag,128,12,'EXPLICIT',32}]);
+_ ->
+{ asn1_NOVALUE, Bytes14, 0 }
+end,
+
+%%-------------------------------------------------
+%% attribute number 14 External ACSE-1:Application-context-name-list OPTIONAL
+%%-------------------------------------------------
+ {Term14,Bytes16,Rb15} = case Bytes15 of
+<<2:2,_:1,13:5,_/binary>> ->
+'dec_Application-context-name-list'(Bytes15, opt_or_default, [{tag,128,13,'IMPLICIT',32}]);
+_ ->
+{ asn1_NOVALUE, Bytes15, 0 }
+end,
+
+%%-------------------------------------------------
+%% attribute number 15 with type GraphicString OPTIONAL
+%%-------------------------------------------------
+ {Term15,Bytes17,Rb16} = case Bytes16 of
+<<2:2,_:1,29:5,_/binary>> ->
+?RT_BER:decode_restricted_string(Bytes16,[],25,[{tag,128,29,'IMPLICIT',32}], no_length, mandatory);
+_ ->
+{ asn1_NOVALUE, Bytes16, 0 }
+end,
+ {Bytes18, Rb17} = ?RT_BER:skip_ExtensionAdditions(Bytes17, [{tag,128,30,'IMPLICIT',32}]),
+
+%%-------------------------------------------------
+%% attribute number 15 External ACSE-1:Association-information OPTIONAL
+%%-------------------------------------------------
+ {Term16,Bytes19,Rb18} = case Bytes18 of
+<<2:2,_:1,30:5,_/binary>> ->
+'dec_Association-information'(Bytes18, opt_or_default, [{tag,128,30,'IMPLICIT',32}]);
+_ ->
+{ asn1_NOVALUE, Bytes18, 0 }
+end,
+
+ {Bytes20,Rb19} = ?RT_BER:restbytes2(RemBytes, Bytes19,noext),
+ {{'AARQ-apdu', Term1, Term2, Term3, Term4, Term5, Term6, Term7, Term8, Term9, Term10, Term11, Term12, Term13, Term14, Term15, Term16}, Bytes20, Rb1+Rb2+Rb3+Rb4+Rb5+Rb6+Rb7+Rb8+Rb9+Rb10+Rb11+Rb12+Rb13+Rb14+Rb15+Rb16+Rb17+Rb18+Rb19}.
+
+
+%%================================
+%% AARE-apdu
+%%================================
+'enc_AARE-apdu'(Val, TagIn) ->
+
+%%-------------------------------------------------
+%% attribute number 1 with type BIT STRING DEFAULT = [version1]
+%%-------------------------------------------------
+ {EncBytes1,EncLen1} = case ?RT_BER:cindex(2,Val,'protocol-version') of
+ asn1_DEFAULT -> {<<>>,0};
+ [version1] -> {<<>>,0};
+ _ ->
+ ?RT_BER:encode_bit_string([], ?RT_BER:cindex(2,Val,'protocol-version'), [{version1,0}], [{tag,128,0,'IMPLICIT',32}])
+ end,
+
+%%-------------------------------------------------
+%% attribute number 2 with type OBJECT IDENTIFIER
+%%-------------------------------------------------
+ {EncBytes2,EncLen2} = ?RT_BER:encode_object_identifier(?RT_BER:cindex(3,Val,'application-context-name'), [{tag,128,1,'EXPLICIT',32}]),
+
+%%-------------------------------------------------
+%% attribute number 3 with type INTEGER
+%%-------------------------------------------------
+ {EncBytes3,EncLen3} = ?RT_BER:encode_integer([], ?RT_BER:cindex(4,Val,result), [{accepted,0},{'rejected-permanent',1},{'rejected-transient',2}], [{tag,128,2,'EXPLICIT',32}]),
+
+%%-------------------------------------------------
+%% attribute number 4 External ACSE-1:Associate-source-diagnostic
+%%-------------------------------------------------
+ {EncBytes4,EncLen4} = 'enc_Associate-source-diagnostic'(?RT_BER:cindex(5,Val,'result-source-diagnostic'), [{tag,128,3,'EXPLICIT',32}]),
+
+%%-------------------------------------------------
+%% attribute number 5 External ACSE-1:AP-title OPTIONAL
+%%-------------------------------------------------
+ {EncBytes5,EncLen5} = case ?RT_BER:cindex(6,Val,'responding-AP-title') of
+ asn1_NOVALUE -> {<<>>,0};
+ _ ->
+ 'enc_AP-title'(?RT_BER:cindex(6,Val,'responding-AP-title'), [{tag,128,4,'EXPLICIT',32}])
+ end,
+
+%%-------------------------------------------------
+%% attribute number 6 External ACSE-1:AE-qualifier OPTIONAL
+%%-------------------------------------------------
+ {EncBytes6,EncLen6} = case ?RT_BER:cindex(7,Val,'responding-AE-qualifier') of
+ asn1_NOVALUE -> {<<>>,0};
+ _ ->
+ 'enc_AE-qualifier'(?RT_BER:cindex(7,Val,'responding-AE-qualifier'), [{tag,128,5,'EXPLICIT',32}])
+ end,
+
+%%-------------------------------------------------
+%% attribute number 7 with type INTEGER OPTIONAL
+%%-------------------------------------------------
+ {EncBytes7,EncLen7} = case ?RT_BER:cindex(8,Val,'responding-AP-invocation-identifier') of
+ asn1_NOVALUE -> {<<>>,0};
+ _ ->
+ ?RT_BER:encode_integer([], ?RT_BER:cindex(8,Val,'responding-AP-invocation-identifier'), [{tag,128,6,'EXPLICIT',32}])
+ end,
+
+%%-------------------------------------------------
+%% attribute number 8 with type INTEGER OPTIONAL
+%%-------------------------------------------------
+ {EncBytes8,EncLen8} = case ?RT_BER:cindex(9,Val,'responding-AE-invocation-identifier') of
+ asn1_NOVALUE -> {<<>>,0};
+ _ ->
+ ?RT_BER:encode_integer([], ?RT_BER:cindex(9,Val,'responding-AE-invocation-identifier'), [{tag,128,7,'EXPLICIT',32}])
+ end,
+
+%%-------------------------------------------------
+%% attribute number 9 with type BIT STRING OPTIONAL
+%%-------------------------------------------------
+ {EncBytes9,EncLen9} = case ?RT_BER:cindex(10,Val,'responder-acse-requirements') of
+ asn1_NOVALUE -> {<<>>,0};
+ _ ->
+ ?RT_BER:encode_bit_string([], ?RT_BER:cindex(10,Val,'responder-acse-requirements'), [{authentication,0},{'application-context-negotiation',1}], [{tag,128,8,'IMPLICIT',32}])
+ end,
+
+%%-------------------------------------------------
+%% attribute number 10 with type OBJECT IDENTIFIER OPTIONAL
+%%-------------------------------------------------
+ {EncBytes10,EncLen10} = case ?RT_BER:cindex(11,Val,'mechanism-name') of
+ asn1_NOVALUE -> {<<>>,0};
+ _ ->
+ ?RT_BER:encode_object_identifier(?RT_BER:cindex(11,Val,'mechanism-name'), [{tag,128,9,'IMPLICIT',32}])
+ end,
+
+%%-------------------------------------------------
+%% attribute number 11 External ACSE-1:Authentication-value OPTIONAL
+%%-------------------------------------------------
+ {EncBytes11,EncLen11} = case ?RT_BER:cindex(12,Val,'responding-authentication-value') of
+ asn1_NOVALUE -> {<<>>,0};
+ _ ->
+ 'enc_Authentication-value'(?RT_BER:cindex(12,Val,'responding-authentication-value'), [{tag,128,10,'EXPLICIT',32}])
+ end,
+
+%%-------------------------------------------------
+%% attribute number 12 External ACSE-1:Application-context-name-list OPTIONAL
+%%-------------------------------------------------
+ {EncBytes12,EncLen12} = case ?RT_BER:cindex(13,Val,'application-context-name-list') of
+ asn1_NOVALUE -> {<<>>,0};
+ _ ->
+ 'enc_Application-context-name-list'(?RT_BER:cindex(13,Val,'application-context-name-list'), [{tag,128,11,'IMPLICIT',32}])
+ end,
+
+%%-------------------------------------------------
+%% attribute number 13 with type GraphicString OPTIONAL
+%%-------------------------------------------------
+ {EncBytes13,EncLen13} = case ?RT_BER:cindex(14,Val,'implementation-information') of
+ asn1_NOVALUE -> {<<>>,0};
+ _ ->
+ ?RT_BER:encode_restricted_string([], ?RT_BER:cindex(14,Val,'implementation-information'), 25, [{tag,128,29,'IMPLICIT',32}])
+ end,
+
+%%-------------------------------------------------
+%% attribute number 14 External ACSE-1:Association-information OPTIONAL
+%%-------------------------------------------------
+ {EncBytes14,EncLen14} = case ?RT_BER:cindex(15,Val,'user-information') of
+ asn1_NOVALUE -> {<<>>,0};
+ _ ->
+ 'enc_Association-information'(?RT_BER:cindex(15,Val,'user-information'), [{tag,128,30,'IMPLICIT',32}])
+ end,
+
+ BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4, EncBytes5, EncBytes6, EncBytes7, EncBytes8, EncBytes9, EncBytes10, EncBytes11, EncBytes12, EncBytes13, EncBytes14],
+ LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5 + EncLen6 + EncLen7 + EncLen8 + EncLen9 + EncLen10 + EncLen11 + EncLen12 + EncLen13 + EncLen14,
+ ?RT_BER:encode_tags(TagIn ++ [{tag,64,1,'IMPLICIT',32},{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar).
+
+
+'dec_AARE-apdu'(Bytes, OptOrMand) ->
+ 'dec_AARE-apdu'(Bytes, OptOrMand, []).
+
+'dec_AARE-apdu'(Bytes, OptOrMand, TagIn) ->
+ %%-------------------------------------------------
+ %% decode tag and length
+ %%-------------------------------------------------
+ {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,64,1,'IMPLICIT',32},{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand),
+{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len),
+
+%%-------------------------------------------------
+%% attribute number 1 with type BIT STRING DEFAULT = [version1]
+%%-------------------------------------------------
+ {Term1,Bytes3,Rb2} = case Bytes2 of
+<<2:2,_:1,0:5,_/binary>> ->
+?RT_BER:decode_bit_string(Bytes2,[],[{version1,0}],[{tag,128,0,'IMPLICIT',32}], no_length, mandatory);
+_ ->
+{[version1],Bytes2, 0 }
+end,
+
+%%-------------------------------------------------
+%% attribute number 2 with type OBJECT IDENTIFIER
+%%-------------------------------------------------
+ {Term2,Bytes4,Rb3} = ?RT_BER:decode_object_identifier(Bytes3,[{tag,128,1,'EXPLICIT',32}], mandatory),
+
+%%-------------------------------------------------
+%% attribute number 3 with type INTEGER
+%%-------------------------------------------------
+ {Term3,Bytes5,Rb4} = ?RT_BER:decode_integer(Bytes4,[],[{accepted,0},{'rejected-permanent',1},{'rejected-transient',2}],[{tag,128,2,'EXPLICIT',32}], mandatory),
+
+%%-------------------------------------------------
+%% attribute number 4 External ACSE-1:Associate-source-diagnostic
+%%-------------------------------------------------
+ {Term4,Bytes6,Rb5} = 'dec_Associate-source-diagnostic'(Bytes5, mandatory, [{tag,128,3,'EXPLICIT',32}]),
+
+%%-------------------------------------------------
+%% attribute number 5 External ACSE-1:AP-title OPTIONAL
+%%-------------------------------------------------
+ {Term5,Bytes7,Rb6} = case Bytes6 of
+<<2:2,_:1,4:5,_/binary>> ->
+'dec_AP-title'(Bytes6, opt_or_default, [{tag,128,4,'EXPLICIT',32}]);
+_ ->
+{ asn1_NOVALUE, Bytes6, 0 }
+end,
+
+%%-------------------------------------------------
+%% attribute number 6 External ACSE-1:AE-qualifier OPTIONAL
+%%-------------------------------------------------
+ {Term6,Bytes8,Rb7} = case Bytes7 of
+<<2:2,_:1,5:5,_/binary>> ->
+'dec_AE-qualifier'(Bytes7, opt_or_default, [{tag,128,5,'EXPLICIT',32}]);
+_ ->
+{ asn1_NOVALUE, Bytes7, 0 }
+end,
+
+%%-------------------------------------------------
+%% attribute number 7 with type INTEGER OPTIONAL
+%%-------------------------------------------------
+ {Term7,Bytes9,Rb8} = case Bytes8 of
+<<2:2,_:1,6:5,_/binary>> ->
+?RT_BER:decode_integer(Bytes8,[],[{tag,128,6,'EXPLICIT',32}], mandatory);
+_ ->
+{ asn1_NOVALUE, Bytes8, 0 }
+end,
+
+%%-------------------------------------------------
+%% attribute number 8 with type INTEGER OPTIONAL
+%%-------------------------------------------------
+ {Term8,Bytes10,Rb9} = case Bytes9 of
+<<2:2,_:1,7:5,_/binary>> ->
+?RT_BER:decode_integer(Bytes9,[],[{tag,128,7,'EXPLICIT',32}], mandatory);
+_ ->
+{ asn1_NOVALUE, Bytes9, 0 }
+end,
+
+%%-------------------------------------------------
+%% attribute number 9 with type BIT STRING OPTIONAL
+%%-------------------------------------------------
+ {Term9,Bytes11,Rb10} = case Bytes10 of
+<<2:2,_:1,8:5,_/binary>> ->
+?RT_BER:decode_bit_string(Bytes10,[],[{authentication,0},{'application-context-negotiation',1}],[{tag,128,8,'IMPLICIT',32}], no_length, mandatory);
+_ ->
+{ asn1_NOVALUE, Bytes10, 0 }
+end,
+
+%%-------------------------------------------------
+%% attribute number 10 with type OBJECT IDENTIFIER OPTIONAL
+%%-------------------------------------------------
+ {Term10,Bytes12,Rb11} = case Bytes11 of
+<<2:2,_:1,9:5,_/binary>> ->
+?RT_BER:decode_object_identifier(Bytes11,[{tag,128,9,'IMPLICIT',32}], mandatory);
+_ ->
+{ asn1_NOVALUE, Bytes11, 0 }
+end,
+
+%%-------------------------------------------------
+%% attribute number 11 External ACSE-1:Authentication-value OPTIONAL
+%%-------------------------------------------------
+ {Term11,Bytes13,Rb12} = case Bytes12 of
+<<2:2,_:1,10:5,_/binary>> ->
+'dec_Authentication-value'(Bytes12, opt_or_default, [{tag,128,10,'EXPLICIT',32}]);
+_ ->
+{ asn1_NOVALUE, Bytes12, 0 }
+end,
+
+%%-------------------------------------------------
+%% attribute number 12 External ACSE-1:Application-context-name-list OPTIONAL
+%%-------------------------------------------------
+ {Term12,Bytes14,Rb13} = case Bytes13 of
+<<2:2,_:1,11:5,_/binary>> ->
+'dec_Application-context-name-list'(Bytes13, opt_or_default, [{tag,128,11,'IMPLICIT',32}]);
+_ ->
+{ asn1_NOVALUE, Bytes13, 0 }
+end,
+
+%%-------------------------------------------------
+%% attribute number 13 with type GraphicString OPTIONAL
+%%-------------------------------------------------
+ {Term13,Bytes15,Rb14} = case Bytes14 of
+<<2:2,_:1,29:5,_/binary>> ->
+?RT_BER:decode_restricted_string(Bytes14,[],25,[{tag,128,29,'IMPLICIT',32}], no_length, mandatory);
+_ ->
+{ asn1_NOVALUE, Bytes14, 0 }
+end,
+ {Bytes16, Rb15} = ?RT_BER:skip_ExtensionAdditions(Bytes15, [{tag,128,30,'IMPLICIT',32}]),
+
+%%-------------------------------------------------
+%% attribute number 13 External ACSE-1:Association-information OPTIONAL
+%%-------------------------------------------------
+ {Term14,Bytes17,Rb16} = case Bytes16 of
+<<2:2,_:1,30:5,_/binary>> ->
+'dec_Association-information'(Bytes16, opt_or_default, [{tag,128,30,'IMPLICIT',32}]);
+_ ->
+{ asn1_NOVALUE, Bytes16, 0 }
+end,
+
+ {Bytes18,Rb17} = ?RT_BER:restbytes2(RemBytes, Bytes17,noext),
+ {{'AARE-apdu', Term1, Term2, Term3, Term4, Term5, Term6, Term7, Term8, Term9, Term10, Term11, Term12, Term13, Term14}, Bytes18, Rb1+Rb2+Rb3+Rb4+Rb5+Rb6+Rb7+Rb8+Rb9+Rb10+Rb11+Rb12+Rb13+Rb14+Rb15+Rb16+Rb17}.
+
+
+%%================================
+%% RLRQ-apdu
+%%================================
+'enc_RLRQ-apdu'(Val, TagIn) ->
+
+%%-------------------------------------------------
+%% attribute number 1 with type INTEGER OPTIONAL
+%%-------------------------------------------------
+ {EncBytes1,EncLen1} = case ?RT_BER:cindex(2,Val,reason) of
+ asn1_NOVALUE -> {<<>>,0};
+ _ ->
+ ?RT_BER:encode_integer([], ?RT_BER:cindex(2,Val,reason), [{normal,0},{urgent,1},{'user-defined',30}], [{tag,128,0,'IMPLICIT',32}])
+ end,
+
+%%-------------------------------------------------
+%% attribute number 2 External ACSE-1:Association-information OPTIONAL
+%%-------------------------------------------------
+ {EncBytes2,EncLen2} = case ?RT_BER:cindex(3,Val,'user-information') of
+ asn1_NOVALUE -> {<<>>,0};
+ _ ->
+ 'enc_Association-information'(?RT_BER:cindex(3,Val,'user-information'), [{tag,128,30,'IMPLICIT',32}])
+ end,
+
+ BytesSoFar = [EncBytes1, EncBytes2],
+ LenSoFar = EncLen1 + EncLen2,
+ ?RT_BER:encode_tags(TagIn ++ [{tag,64,2,'IMPLICIT',32},{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar).
+
+
+'dec_RLRQ-apdu'(Bytes, OptOrMand) ->
+ 'dec_RLRQ-apdu'(Bytes, OptOrMand, []).
+
+'dec_RLRQ-apdu'(Bytes, OptOrMand, TagIn) ->
+ %%-------------------------------------------------
+ %% decode tag and length
+ %%-------------------------------------------------
+ {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,64,2,'IMPLICIT',32},{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand),
+{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len),
+
+%%-------------------------------------------------
+%% attribute number 1 with type INTEGER OPTIONAL
+%%-------------------------------------------------
+ {Term1,Bytes3,Rb2} = case Bytes2 of
+<<2:2,_:1,0:5,_/binary>> ->
+?RT_BER:decode_integer(Bytes2,[],[{normal,0},{urgent,1},{'user-defined',30}],[{tag,128,0,'IMPLICIT',32}], mandatory);
+_ ->
+{ asn1_NOVALUE, Bytes2, 0 }
+end,
+ {Bytes4, Rb3} = ?RT_BER:skip_ExtensionAdditions(Bytes3, [{tag,128,30,'IMPLICIT',32}]),
+
+%%-------------------------------------------------
+%% attribute number 1 External ACSE-1:Association-information OPTIONAL
+%%-------------------------------------------------
+ {Term2,Bytes5,Rb4} = case Bytes4 of
+<<2:2,_:1,30:5,_/binary>> ->
+'dec_Association-information'(Bytes4, opt_or_default, [{tag,128,30,'IMPLICIT',32}]);
+_ ->
+{ asn1_NOVALUE, Bytes4, 0 }
+end,
+
+ {Bytes6,Rb5} = ?RT_BER:restbytes2(RemBytes, Bytes5,noext),
+ {{'RLRQ-apdu', Term1, Term2}, Bytes6, Rb1+Rb2+Rb3+Rb4+Rb5}.
+
+
+%%================================
+%% RLRE-apdu
+%%================================
+'enc_RLRE-apdu'(Val, TagIn) ->
+
+%%-------------------------------------------------
+%% attribute number 1 with type INTEGER OPTIONAL
+%%-------------------------------------------------
+ {EncBytes1,EncLen1} = case ?RT_BER:cindex(2,Val,reason) of
+ asn1_NOVALUE -> {<<>>,0};
+ _ ->
+ ?RT_BER:encode_integer([], ?RT_BER:cindex(2,Val,reason), [{normal,0},{'not-finished',1},{'user-defined',30}], [{tag,128,0,'IMPLICIT',32}])
+ end,
+
+%%-------------------------------------------------
+%% attribute number 2 External ACSE-1:Association-information OPTIONAL
+%%-------------------------------------------------
+ {EncBytes2,EncLen2} = case ?RT_BER:cindex(3,Val,'user-information') of
+ asn1_NOVALUE -> {<<>>,0};
+ _ ->
+ 'enc_Association-information'(?RT_BER:cindex(3,Val,'user-information'), [{tag,128,30,'IMPLICIT',32}])
+ end,
+
+ BytesSoFar = [EncBytes1, EncBytes2],
+ LenSoFar = EncLen1 + EncLen2,
+ ?RT_BER:encode_tags(TagIn ++ [{tag,64,3,'IMPLICIT',32},{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar).
+
+
+'dec_RLRE-apdu'(Bytes, OptOrMand) ->
+ 'dec_RLRE-apdu'(Bytes, OptOrMand, []).
+
+'dec_RLRE-apdu'(Bytes, OptOrMand, TagIn) ->
+ %%-------------------------------------------------
+ %% decode tag and length
+ %%-------------------------------------------------
+ {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,64,3,'IMPLICIT',32},{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand),
+{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len),
+
+%%-------------------------------------------------
+%% attribute number 1 with type INTEGER OPTIONAL
+%%-------------------------------------------------
+ {Term1,Bytes3,Rb2} = case Bytes2 of
+<<2:2,_:1,0:5,_/binary>> ->
+?RT_BER:decode_integer(Bytes2,[],[{normal,0},{'not-finished',1},{'user-defined',30}],[{tag,128,0,'IMPLICIT',32}], mandatory);
+_ ->
+{ asn1_NOVALUE, Bytes2, 0 }
+end,
+ {Bytes4, Rb3} = ?RT_BER:skip_ExtensionAdditions(Bytes3, [{tag,128,30,'IMPLICIT',32}]),
+
+%%-------------------------------------------------
+%% attribute number 1 External ACSE-1:Association-information OPTIONAL
+%%-------------------------------------------------
+ {Term2,Bytes5,Rb4} = case Bytes4 of
+<<2:2,_:1,30:5,_/binary>> ->
+'dec_Association-information'(Bytes4, opt_or_default, [{tag,128,30,'IMPLICIT',32}]);
+_ ->
+{ asn1_NOVALUE, Bytes4, 0 }
+end,
+
+ {Bytes6,Rb5} = ?RT_BER:restbytes2(RemBytes, Bytes5,noext),
+ {{'RLRE-apdu', Term1, Term2}, Bytes6, Rb1+Rb2+Rb3+Rb4+Rb5}.
+
+
+%%================================
+%% ABRT-apdu
+%%================================
+'enc_ABRT-apdu'(Val, TagIn) ->
+
+%%-------------------------------------------------
+%% attribute number 1 with type INTEGER
+%%-------------------------------------------------
+ {EncBytes1,EncLen1} = ?RT_BER:encode_integer([], ?RT_BER:cindex(2,Val,'abort-source'), [{'acse-service-user',0},{'acse-service-provider',1}], [{tag,128,0,'IMPLICIT',32}]),
+
+%%-------------------------------------------------
+%% attribute number 2 with type ENUMERATED OPTIONAL
+%%-------------------------------------------------
+ {EncBytes2,EncLen2} = case ?RT_BER:cindex(3,Val,'abort-diagnostic') of
+ asn1_NOVALUE -> {<<>>,0};
+ _ ->
+ case (case ?RT_BER:cindex(3,Val,'abort-diagnostic') of {_,Enumval2}->Enumval2;_->?RT_BER:cindex(3,Val,'abort-diagnostic') end) of
+'no-reason-given' -> ?RT_BER:encode_enumerated(1,[{tag,128,1,'IMPLICIT',32}]);
+'protocol-error' -> ?RT_BER:encode_enumerated(2,[{tag,128,1,'IMPLICIT',32}]);
+'authentication-mechanism-name-not-recognized' -> ?RT_BER:encode_enumerated(3,[{tag,128,1,'IMPLICIT',32}]);
+'authentication-mechanism-name-required' -> ?RT_BER:encode_enumerated(4,[{tag,128,1,'IMPLICIT',32}]);
+'authentication-failure' -> ?RT_BER:encode_enumerated(5,[{tag,128,1,'IMPLICIT',32}]);
+'authentication-required' -> ?RT_BER:encode_enumerated(6,[{tag,128,1,'IMPLICIT',32}]);
+Enumval3 -> exit({error,{asn1, {enumerated_not_in_range,Enumval3}}})
+end
+ end,
+
+%%-------------------------------------------------
+%% attribute number 3 External ACSE-1:Association-information OPTIONAL
+%%-------------------------------------------------
+ {EncBytes3,EncLen3} = case ?RT_BER:cindex(4,Val,'user-information') of
+ asn1_NOVALUE -> {<<>>,0};
+ _ ->
+ 'enc_Association-information'(?RT_BER:cindex(4,Val,'user-information'), [{tag,128,30,'IMPLICIT',32}])
+ end,
+
+ BytesSoFar = [EncBytes1, EncBytes2, EncBytes3],
+ LenSoFar = EncLen1 + EncLen2 + EncLen3,
+ ?RT_BER:encode_tags(TagIn ++ [{tag,64,4,'IMPLICIT',32},{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar).
+
+
+'dec_ABRT-apdu'(Bytes, OptOrMand) ->
+ 'dec_ABRT-apdu'(Bytes, OptOrMand, []).
+
+'dec_ABRT-apdu'(Bytes, OptOrMand, TagIn) ->
+ %%-------------------------------------------------
+ %% decode tag and length
+ %%-------------------------------------------------
+ {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,64,4,'IMPLICIT',32},{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand),
+{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len),
+
+%%-------------------------------------------------
+%% attribute number 1 with type INTEGER
+%%-------------------------------------------------
+ {Term1,Bytes3,Rb2} = ?RT_BER:decode_integer(Bytes2,[],[{'acse-service-user',0},{'acse-service-provider',1}],[{tag,128,0,'IMPLICIT',32}], mandatory),
+
+%%-------------------------------------------------
+%% attribute number 2 with type ENUMERATED OPTIONAL
+%%-------------------------------------------------
+ {Term2,Bytes4,Rb3} = case Bytes3 of
+<<2:2,_:1,1:5,_/binary>> ->
+?RT_BER:decode_enumerated(Bytes3,[],{[{'no-reason-given',1},{'protocol-error',2},{'authentication-mechanism-name-not-recognized',3},{'authentication-mechanism-name-required',4},{'authentication-failure',5},{'authentication-required',6}],[]},[{tag,128,1,'IMPLICIT',32}], mandatory);
+_ ->
+{ asn1_NOVALUE, Bytes3, 0 }
+end,
+ {Bytes5, Rb4} = ?RT_BER:skip_ExtensionAdditions(Bytes4, [{tag,128,30,'IMPLICIT',32}]),
+
+%%-------------------------------------------------
+%% attribute number 2 External ACSE-1:Association-information OPTIONAL
+%%-------------------------------------------------
+ {Term3,Bytes6,Rb5} = case Bytes5 of
+<<2:2,_:1,30:5,_/binary>> ->
+'dec_Association-information'(Bytes5, opt_or_default, [{tag,128,30,'IMPLICIT',32}]);
+_ ->
+{ asn1_NOVALUE, Bytes5, 0 }
+end,
+
+ {Bytes7,Rb6} = ?RT_BER:restbytes2(RemBytes, Bytes6,noext),
+ {{'ABRT-apdu', Term1, Term2, Term3}, Bytes7, Rb1+Rb2+Rb3+Rb4+Rb5+Rb6}.
+
+
+%%================================
+%% ABRT-diagnostic
+%%================================
+
+'enc_ABRT-diagnostic'({'ABRT-diagnostic',Val}, TagIn) ->
+ 'enc_ABRT-diagnostic'(Val, TagIn);
+
+'enc_ABRT-diagnostic'(Val, TagIn) ->
+case (case Val of {_,Enumval1}->Enumval1;_->Val end) of
+'no-reason-given' -> ?RT_BER:encode_enumerated(1,TagIn ++ []);
+'protocol-error' -> ?RT_BER:encode_enumerated(2,TagIn ++ []);
+'authentication-mechanism-name-not-recognized' -> ?RT_BER:encode_enumerated(3,TagIn ++ []);
+'authentication-mechanism-name-required' -> ?RT_BER:encode_enumerated(4,TagIn ++ []);
+'authentication-failure' -> ?RT_BER:encode_enumerated(5,TagIn ++ []);
+'authentication-required' -> ?RT_BER:encode_enumerated(6,TagIn ++ []);
+Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}})
+end.
+
+
+'dec_ABRT-diagnostic'(Bytes, OptOrMand) ->
+ 'dec_ABRT-diagnostic'(Bytes, OptOrMand, []).
+
+'dec_ABRT-diagnostic'(Bytes, OptOrMand, TagIn) ->
+?RT_BER:decode_enumerated(Bytes,[],{[{'no-reason-given',1},{'protocol-error',2},{'authentication-mechanism-name-not-recognized',3},{'authentication-mechanism-name-required',4},{'authentication-failure',5},{'authentication-required',6}],[]},TagIn++[], OptOrMand).
+
+
+
+%%================================
+%% ABRT-source
+%%================================
+
+'enc_ABRT-source'({'ABRT-source',Val}, TagIn) ->
+ 'enc_ABRT-source'(Val, TagIn);
+
+'enc_ABRT-source'(Val, TagIn) ->
+?RT_BER:encode_integer([], Val, [{'acse-service-user',0},{'acse-service-provider',1}], TagIn ++ []).
+
+
+'dec_ABRT-source'(Bytes, OptOrMand) ->
+ 'dec_ABRT-source'(Bytes, OptOrMand, []).
+
+'dec_ABRT-source'(Bytes, OptOrMand, TagIn) ->
+?RT_BER:decode_integer(Bytes,[],[{'acse-service-user',0},{'acse-service-provider',1}],TagIn++[], OptOrMand).
+
+
+
+%%================================
+%% ACSE-requirements
+%%================================
+
+'enc_ACSE-requirements'({'ACSE-requirements',Val}, TagIn) ->
+ 'enc_ACSE-requirements'(Val, TagIn);
+
+'enc_ACSE-requirements'(Val, TagIn) ->
+?RT_BER:encode_bit_string([], Val, [{authentication,0},{'application-context-negotiation',1}], TagIn ++ []).
+
+
+'dec_ACSE-requirements'(Bytes, OptOrMand) ->
+ 'dec_ACSE-requirements'(Bytes, OptOrMand, []).
+
+'dec_ACSE-requirements'(Bytes, OptOrMand, TagIn) ->
+?RT_BER:decode_bit_string(Bytes,[],[{authentication,0},{'application-context-negotiation',1}],TagIn++[], no_length, OptOrMand).
+
+
+
+%%================================
+%% Application-context-name-list
+%%================================
+
+'enc_Application-context-name-list'({'Application-context-name-list',Val}, TagIn) ->
+ 'enc_Application-context-name-list'(Val, TagIn);
+
+'enc_Application-context-name-list'(Val, TagIn) ->
+ {EncBytes,EncLen} = 'enc_Application-context-name-list_components'(Val,[],0),
+ ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], EncBytes, EncLen).
+
+'enc_Application-context-name-list_components'([], AccBytes, AccLen) ->
+ {lists:reverse(AccBytes),AccLen};
+
+'enc_Application-context-name-list_components'([H|T],AccBytes, AccLen) ->
+ {EncBytes,EncLen} = ?RT_BER:encode_object_identifier(H, []),
+ 'enc_Application-context-name-list_components'(T,[EncBytes|AccBytes], AccLen + EncLen).
+
+
+
+'dec_Application-context-name-list'(Bytes, OptOrMand) ->
+ 'dec_Application-context-name-list'(Bytes, OptOrMand, []).
+
+'dec_Application-context-name-list'(Bytes, OptOrMand, TagIn) ->
+ %%-------------------------------------------------
+ %% decode tag and length
+ %%-------------------------------------------------
+ {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand),
+ ?RT_BER:decode_components(Rb1, Len, Bytes1, fun(FBytes,_,_)->
+?RT_BER:decode_object_identifier(FBytes,[], mandatory)
+end, [], []).
+
+
+
+
+%%================================
+%% Application-context-name
+%%================================
+
+'enc_Application-context-name'({'Application-context-name',Val}, TagIn) ->
+ 'enc_Application-context-name'(Val, TagIn);
+
+'enc_Application-context-name'(Val, TagIn) ->
+?RT_BER:encode_object_identifier(Val, TagIn ++ []).
+
+
+'dec_Application-context-name'(Bytes, OptOrMand) ->
+ 'dec_Application-context-name'(Bytes, OptOrMand, []).
+
+'dec_Application-context-name'(Bytes, OptOrMand, TagIn) ->
+?RT_BER:decode_object_identifier(Bytes,TagIn++[], OptOrMand).
+
+
+
+%%================================
+%% AP-title
+%%================================
+
+'enc_AP-title'({'AP-title',Val}, TagIn) ->
+ 'enc_AP-title'(Val, TagIn);
+
+'enc_AP-title'(Val, TagIn) ->
+ {EncBytes,EncLen} = case element(1,Val) of
+ 'ap-title-form1' ->
+ 'enc_AP-title-form1'(element(2,Val), []);
+ 'ap-title-form2' ->
+ ?RT_BER:encode_object_identifier(element(2,Val), []);
+ Else ->
+ exit({error,{asn1,{invalid_choice_type,Else}}})
+ end,
+
+?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen).
+
+
+
+
+'dec_AP-title'(Bytes, OptOrMand) ->
+ 'dec_AP-title'(Bytes, OptOrMand, []).
+
+'dec_AP-title'(Bytes, OptOrMand, TagIn) ->
+ {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand),
+ IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end,
+ IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end,
+ case Bytes1 of
+
+%% 'ap-title-form1'
+ <<0:2,_:1,16:5,_/binary>> ->
+ {Dec, Rest, RbCho} = 'dec_AP-title-form1'(Bytes1, mandatory, []),
+ {{'ap-title-form1', Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
+
+
+%% 'ap-title-form2'
+ <<0:2,_:1,6:5,_/binary>> ->
+ {Dec, Rest, RbCho} = ?RT_BER:decode_object_identifier(Bytes1,[], mandatory),
+ {{'ap-title-form2', Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
+
+ _ ->
+ {{asn1_ExtAlt,Bytes1},<<>>, RbExp}
+ end.
+
+
+%%================================
+%% AE-qualifier
+%%================================
+
+'enc_AE-qualifier'({'AE-qualifier',Val}, TagIn) ->
+ 'enc_AE-qualifier'(Val, TagIn);
+
+'enc_AE-qualifier'(Val, TagIn) ->
+ {EncBytes,EncLen} = case element(1,Val) of
+ 'ae-qualifier-form1' ->
+ 'enc_AE-qualifier-form1'(element(2,Val), []);
+ 'ae-qualifier-form2' ->
+ ?RT_BER:encode_integer([], element(2,Val), []);
+ Else ->
+ exit({error,{asn1,{invalid_choice_type,Else}}})
+ end,
+
+?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen).
+
+
+
+
+'dec_AE-qualifier'(Bytes, OptOrMand) ->
+ 'dec_AE-qualifier'(Bytes, OptOrMand, []).
+
+'dec_AE-qualifier'(Bytes, OptOrMand, TagIn) ->
+ {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand),
+ IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end,
+ IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end,
+ case Bytes1 of
+
+%% 'ae-qualifier-form1'
+ <<0:2,_:1,17:5,_/binary>> ->
+ {Dec, Rest, RbCho} = 'dec_AE-qualifier-form1'(Bytes1, mandatory, []),
+ {{'ae-qualifier-form1', Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
+
+
+%% 'ae-qualifier-form2'
+ <<0:2,_:1,2:5,_/binary>> ->
+ {Dec, Rest, RbCho} = ?RT_BER:decode_integer(Bytes1,[],[], mandatory),
+ {{'ae-qualifier-form2', Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
+
+ _ ->
+ {{asn1_ExtAlt,Bytes1},<<>>, RbExp}
+ end.
+
+
+%%================================
+%% AP-title-form1
+%%================================
+
+'enc_AP-title-form1'({'AP-title-form1',Val}, TagIn) ->
+ 'enc_AP-title-form1'(Val, TagIn);
+
+'enc_AP-title-form1'(Val, TagIn) ->
+ 'InformationFramework':'enc_Name'(Val, TagIn ++ []).
+
+
+'dec_AP-title-form1'(Bytes, OptOrMand) ->
+ 'dec_AP-title-form1'(Bytes, OptOrMand, []).
+
+'dec_AP-title-form1'(Bytes, OptOrMand, TagIn) ->
+'InformationFramework':'dec_Name'(Bytes, OptOrMand, TagIn++[]).
+
+
+
+%%================================
+%% AE-qualifier-form1
+%%================================
+
+'enc_AE-qualifier-form1'({'AE-qualifier-form1',Val}, TagIn) ->
+ 'enc_AE-qualifier-form1'(Val, TagIn);
+
+'enc_AE-qualifier-form1'(Val, TagIn) ->
+ 'InformationFramework':'enc_RelativeDistinguishedName'(Val, TagIn ++ []).
+
+
+'dec_AE-qualifier-form1'(Bytes, OptOrMand) ->
+ 'dec_AE-qualifier-form1'(Bytes, OptOrMand, []).
+
+'dec_AE-qualifier-form1'(Bytes, OptOrMand, TagIn) ->
+'InformationFramework':'dec_RelativeDistinguishedName'(Bytes, OptOrMand, TagIn++[]).
+
+
+
+%%================================
+%% AP-title-form2
+%%================================
+
+'enc_AP-title-form2'({'AP-title-form2',Val}, TagIn) ->
+ 'enc_AP-title-form2'(Val, TagIn);
+
+'enc_AP-title-form2'(Val, TagIn) ->
+?RT_BER:encode_object_identifier(Val, TagIn ++ []).
+
+
+'dec_AP-title-form2'(Bytes, OptOrMand) ->
+ 'dec_AP-title-form2'(Bytes, OptOrMand, []).
+
+'dec_AP-title-form2'(Bytes, OptOrMand, TagIn) ->
+?RT_BER:decode_object_identifier(Bytes,TagIn++[], OptOrMand).
+
+
+
+%%================================
+%% AE-qualifier-form2
+%%================================
+
+'enc_AE-qualifier-form2'({'AE-qualifier-form2',Val}, TagIn) ->
+ 'enc_AE-qualifier-form2'(Val, TagIn);
+
+'enc_AE-qualifier-form2'(Val, TagIn) ->
+?RT_BER:encode_integer([], Val, TagIn ++ []).
+
+
+'dec_AE-qualifier-form2'(Bytes, OptOrMand) ->
+ 'dec_AE-qualifier-form2'(Bytes, OptOrMand, []).
+
+'dec_AE-qualifier-form2'(Bytes, OptOrMand, TagIn) ->
+?RT_BER:decode_integer(Bytes,[],TagIn++[], OptOrMand).
+
+
+
+%%================================
+%% AE-title
+%%================================
+
+'enc_AE-title'({'AE-title',Val}, TagIn) ->
+ 'enc_AE-title'(Val, TagIn);
+
+'enc_AE-title'(Val, TagIn) ->
+ {EncBytes,EncLen} = case element(1,Val) of
+ 'ae-title-form1' ->
+ 'enc_AE-title-form1'(element(2,Val), []);
+ 'ae-title-form2' ->
+ ?RT_BER:encode_object_identifier(element(2,Val), []);
+ Else ->
+ exit({error,{asn1,{invalid_choice_type,Else}}})
+ end,
+
+?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen).
+
+
+
+
+'dec_AE-title'(Bytes, OptOrMand) ->
+ 'dec_AE-title'(Bytes, OptOrMand, []).
+
+'dec_AE-title'(Bytes, OptOrMand, TagIn) ->
+ {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand),
+ IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end,
+ IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end,
+ case Bytes1 of
+
+%% 'ae-title-form1'
+ <<0:2,_:1,16:5,_/binary>> ->
+ {Dec, Rest, RbCho} = 'dec_AE-title-form1'(Bytes1, mandatory, []),
+ {{'ae-title-form1', Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
+
+
+%% 'ae-title-form2'
+ <<0:2,_:1,6:5,_/binary>> ->
+ {Dec, Rest, RbCho} = ?RT_BER:decode_object_identifier(Bytes1,[], mandatory),
+ {{'ae-title-form2', Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
+
+ _ ->
+ {{asn1_ExtAlt,Bytes1},<<>>, RbExp}
+ end.
+
+
+%%================================
+%% AE-title-form1
+%%================================
+
+'enc_AE-title-form1'({'AE-title-form1',Val}, TagIn) ->
+ 'enc_AE-title-form1'(Val, TagIn);
+
+'enc_AE-title-form1'(Val, TagIn) ->
+ 'InformationFramework':'enc_Name'(Val, TagIn ++ []).
+
+
+'dec_AE-title-form1'(Bytes, OptOrMand) ->
+ 'dec_AE-title-form1'(Bytes, OptOrMand, []).
+
+'dec_AE-title-form1'(Bytes, OptOrMand, TagIn) ->
+'InformationFramework':'dec_Name'(Bytes, OptOrMand, TagIn++[]).
+
+
+
+%%================================
+%% AE-title-form2
+%%================================
+
+'enc_AE-title-form2'({'AE-title-form2',Val}, TagIn) ->
+ 'enc_AE-title-form2'(Val, TagIn);
+
+'enc_AE-title-form2'(Val, TagIn) ->
+?RT_BER:encode_object_identifier(Val, TagIn ++ []).
+
+
+'dec_AE-title-form2'(Bytes, OptOrMand) ->
+ 'dec_AE-title-form2'(Bytes, OptOrMand, []).
+
+'dec_AE-title-form2'(Bytes, OptOrMand, TagIn) ->
+?RT_BER:decode_object_identifier(Bytes,TagIn++[], OptOrMand).
+
+
+
+%%================================
+%% AE-invocation-identifier
+%%================================
+
+'enc_AE-invocation-identifier'({'AE-invocation-identifier',Val}, TagIn) ->
+ 'enc_AE-invocation-identifier'(Val, TagIn);
+
+'enc_AE-invocation-identifier'(Val, TagIn) ->
+?RT_BER:encode_integer([], Val, TagIn ++ []).
+
+
+'dec_AE-invocation-identifier'(Bytes, OptOrMand) ->
+ 'dec_AE-invocation-identifier'(Bytes, OptOrMand, []).
+
+'dec_AE-invocation-identifier'(Bytes, OptOrMand, TagIn) ->
+?RT_BER:decode_integer(Bytes,[],TagIn++[], OptOrMand).
+
+
+
+%%================================
+%% AP-invocation-identifier
+%%================================
+
+'enc_AP-invocation-identifier'({'AP-invocation-identifier',Val}, TagIn) ->
+ 'enc_AP-invocation-identifier'(Val, TagIn);
+
+'enc_AP-invocation-identifier'(Val, TagIn) ->
+?RT_BER:encode_integer([], Val, TagIn ++ []).
+
+
+'dec_AP-invocation-identifier'(Bytes, OptOrMand) ->
+ 'dec_AP-invocation-identifier'(Bytes, OptOrMand, []).
+
+'dec_AP-invocation-identifier'(Bytes, OptOrMand, TagIn) ->
+?RT_BER:decode_integer(Bytes,[],TagIn++[], OptOrMand).
+
+
+
+%%================================
+%% Associate-result
+%%================================
+
+'enc_Associate-result'({'Associate-result',Val}, TagIn) ->
+ 'enc_Associate-result'(Val, TagIn);
+
+'enc_Associate-result'(Val, TagIn) ->
+?RT_BER:encode_integer([], Val, [{accepted,0},{'rejected-permanent',1},{'rejected-transient',2}], TagIn ++ []).
+
+
+'dec_Associate-result'(Bytes, OptOrMand) ->
+ 'dec_Associate-result'(Bytes, OptOrMand, []).
+
+'dec_Associate-result'(Bytes, OptOrMand, TagIn) ->
+?RT_BER:decode_integer(Bytes,[],[{accepted,0},{'rejected-permanent',1},{'rejected-transient',2}],TagIn++[], OptOrMand).
+
+
+
+%%================================
+%% Associate-source-diagnostic
+%%================================
+
+'enc_Associate-source-diagnostic'({'Associate-source-diagnostic',Val}, TagIn) ->
+ 'enc_Associate-source-diagnostic'(Val, TagIn);
+
+'enc_Associate-source-diagnostic'(Val, TagIn) ->
+ {EncBytes,EncLen} = case element(1,Val) of
+ 'acse-service-user' ->
+ ?RT_BER:encode_integer([], element(2,Val), [{null,0},{'no-reason-given',1},{'application-context-name-not-supported',2},{'calling-AP-title-not-recognized',3},{'calling-AP-invocation-identifier-not-recognized',4},{'calling-AE-qualifier-not-recognized',5},{'calling-AE-invocation-identifier-not-recognized',6},{'called-AP-title-not-recognized',7},{'called-AP-invocation-identifier-not-recognized',8},{'called-AE-qualifier-not-recognized',9},{'called-AE-invocation-identifier-not-recognized',10},{'authentication-mechanism-name-not-recognized',11},{'authentication-mechanism-name-required',12},{'authentication-failure',13},{'authentication-required',14}], [{tag,128,1,'EXPLICIT',32}]);
+ 'acse-service-provider' ->
+ ?RT_BER:encode_integer([], element(2,Val), [{null,0},{'no-reason-given',1},{'no-common-acse-version',2}], [{tag,128,2,'EXPLICIT',32}]);
+ Else ->
+ exit({error,{asn1,{invalid_choice_type,Else}}})
+ end,
+
+?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen).
+
+
+
+
+'dec_Associate-source-diagnostic'(Bytes, OptOrMand) ->
+ 'dec_Associate-source-diagnostic'(Bytes, OptOrMand, []).
+
+'dec_Associate-source-diagnostic'(Bytes, OptOrMand, TagIn) ->
+ {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand),
+ IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end,
+ IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end,
+ case Bytes1 of
+
+%% 'acse-service-user'
+ <<2:2,_:1,1:5,_/binary>> ->
+ {Dec, Rest, RbCho} = ?RT_BER:decode_integer(Bytes1,[],[{null,0},{'no-reason-given',1},{'application-context-name-not-supported',2},{'calling-AP-title-not-recognized',3},{'calling-AP-invocation-identifier-not-recognized',4},{'calling-AE-qualifier-not-recognized',5},{'calling-AE-invocation-identifier-not-recognized',6},{'called-AP-title-not-recognized',7},{'called-AP-invocation-identifier-not-recognized',8},{'called-AE-qualifier-not-recognized',9},{'called-AE-invocation-identifier-not-recognized',10},{'authentication-mechanism-name-not-recognized',11},{'authentication-mechanism-name-required',12},{'authentication-failure',13},{'authentication-required',14}],[{tag,128,1,'EXPLICIT',32}], mandatory),
+ {{'acse-service-user', Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
+
+
+%% 'acse-service-provider'
+ <<2:2,_:1,2:5,_/binary>> ->
+ {Dec, Rest, RbCho} = ?RT_BER:decode_integer(Bytes1,[],[{null,0},{'no-reason-given',1},{'no-common-acse-version',2}],[{tag,128,2,'EXPLICIT',32}], mandatory),
+ {{'acse-service-provider', Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
+
+ Else ->
+ case OptOrMand of
+ mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}});
+ _ ->exit({error,{asn1,{no_optional_tag,Else}}})
+ end
+ end.
+
+
+%%================================
+%% Association-information
+%%================================
+
+'enc_Association-information'({'Association-information',Val}, TagIn) ->
+ 'enc_Association-information'(Val, TagIn);
+
+'enc_Association-information'(Val, TagIn) ->
+ {EncBytes,EncLen} = 'enc_Association-information_components'(Val,[],0),
+ ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], EncBytes, EncLen).
+
+'enc_Association-information_components'([], AccBytes, AccLen) ->
+ {lists:reverse(AccBytes),AccLen};
+
+'enc_Association-information_components'([H|T],AccBytes, AccLen) ->
+ {EncBytes,EncLen} = 'enc_EXTERNAL'(H, []),
+ 'enc_Association-information_components'(T,[EncBytes|AccBytes], AccLen + EncLen).
+
+
+
+'dec_Association-information'(Bytes, OptOrMand) ->
+ 'dec_Association-information'(Bytes, OptOrMand, []).
+
+'dec_Association-information'(Bytes, OptOrMand, TagIn) ->
+ %%-------------------------------------------------
+ %% decode tag and length
+ %%-------------------------------------------------
+ {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand),
+ ?RT_BER:decode_components(Rb1, Len, Bytes1, fun 'dec_EXTERNAL'/3, [], []).
+
+
+
+
+%%================================
+%% Authentication-value
+%%================================
+
+'enc_Authentication-value'({'Authentication-value',Val}, TagIn) ->
+ 'enc_Authentication-value'(Val, TagIn);
+
+'enc_Authentication-value'(Val, TagIn) ->
+ {EncBytes,EncLen} = case element(1,Val) of
+ charstring ->
+ ?RT_BER:encode_restricted_string([], element(2,Val), 25, [{tag,128,0,'IMPLICIT',32}]);
+ bitstring ->
+ ?RT_BER:encode_bit_string([], element(2,Val), [], [{tag,128,1,'IMPLICIT',32}]);
+ external ->
+ 'enc_EXTERNAL'(element(2,Val), [{tag,128,2,'IMPLICIT',32}]);
+ other ->
+ 'enc_Authentication-value_other'(element(2,Val), [{tag,128,3,'IMPLICIT',32}]);
+ Else ->
+ exit({error,{asn1,{invalid_choice_type,Else}}})
+ end,
+
+?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen).
+
+
+
+
+
+%%================================
+%% Authentication-value_other
+%%================================
+'enc_Authentication-value_other'(Val, TagIn) ->
+ Objother_mechanism_name =
+ 'ACSE-1':'getenc_ObjectSet'(id,
+ value_match([],?RT_BER:cindex(2,Val,'other-mechanism-name'))),
+
+%%-------------------------------------------------
+%% attribute number 1 with type fixedtypevaluefieldidtypeOBJECT IDENTIFIERno
+%%-------------------------------------------------
+ {EncBytes1,EncLen1} = ?RT_BER:encode_object_identifier(?RT_BER:cindex(2,Val,'other-mechanism-name'), []),
+
+%%-------------------------------------------------
+%% attribute number 2 with type typefieldType
+%%-------------------------------------------------
+ {TmpBytes1,_} = Objother_mechanism_name('Type', ?RT_BER:cindex(3,Val,'other-mechanism-value'), [], []),
+ {EncBytes2, EncLen2} = ?RT_BER:encode_open_type(TmpBytes1,[]),
+
+ BytesSoFar = [EncBytes1, EncBytes2],
+ LenSoFar = EncLen1 + EncLen2,
+ ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar).
+'dec_Authentication-value_other'(Bytes, OptOrMand, TagIn) ->
+ %%-------------------------------------------------
+ %% decode tag and length
+ %%-------------------------------------------------
+ {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand),
+{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len),
+
+%%-------------------------------------------------
+%% attribute number 1 with type fixedtypevaluefieldidtypeOBJECT IDENTIFIERno
+%%-------------------------------------------------
+ {Term1,Bytes3,Rb2} = ?RT_BER:decode_object_identifier(Bytes2,[], mandatory),
+
+%%-------------------------------------------------
+%% attribute number 2 with type typefieldType
+%%-------------------------------------------------
+ {Tmpterm1, Bytes4,Rb3} = ?RT_BER:decode_open_type(Bytes3,[]),
+
+DecObjother_mechanism_nameTerm1 =
+ 'ACSE-1':'getdec_ObjectSet'(id, Term1),
+{Term2, _, _} =
+ case (catch DecObjother_mechanism_nameTerm1('Type', Tmpterm1, [], [])) of
+ {'EXIT', Reason1} ->
+ exit({'Type not compatible with table constraint',Reason1});
+ Tmpterm2 ->
+ Tmpterm2
+ end,
+
+ {Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext),
+ {{'Authentication-value_other', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}.
+
+
+'dec_Authentication-value'(Bytes, OptOrMand) ->
+ 'dec_Authentication-value'(Bytes, OptOrMand, []).
+
+'dec_Authentication-value'(Bytes, OptOrMand, TagIn) ->
+ {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand),
+ IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end,
+ IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end,
+ case Bytes1 of
+
+%% 'charstring'
+ <<2:2,_:1,0:5,_/binary>> ->
+ {Dec, Rest, RbCho} = ?RT_BER:decode_restricted_string(Bytes1,[],25,[{tag,128,0,'IMPLICIT',32}], no_length, mandatory),
+ {{charstring, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
+
+
+%% 'bitstring'
+ <<2:2,_:1,1:5,_/binary>> ->
+ {Dec, Rest, RbCho} = ?RT_BER:decode_bit_string(Bytes1,[],[],[{tag,128,1,'IMPLICIT',32}], no_length, mandatory),
+ {{bitstring, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
+
+
+%% 'external'
+ <<2:2,_:1,2:5,_/binary>> ->
+ {Dec, Rest, RbCho} = 'dec_EXTERNAL'(Bytes1, mandatory, [{tag,128,2,'IMPLICIT',32}]),
+ {{external, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
+
+
+%% 'other'
+ <<2:2,_:1,3:5,_/binary>> ->
+ {Dec, Rest, RbCho} = 'dec_Authentication-value_other'(Bytes1, mandatory, [{tag,128,3,'IMPLICIT',32}]),
+ {{other, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
+
+ Else ->
+ case OptOrMand of
+ mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}});
+ _ ->exit({error,{asn1,{no_optional_tag,Else}}})
+ end
+ end.
+
+
+%%================================
+%% Implementation-data
+%%================================
+
+'enc_Implementation-data'({'Implementation-data',Val}, TagIn) ->
+ 'enc_Implementation-data'(Val, TagIn);
+
+'enc_Implementation-data'(Val, TagIn) ->
+?RT_BER:encode_restricted_string([], Val, 25, TagIn ++ []).
+
+
+'dec_Implementation-data'(Bytes, OptOrMand) ->
+ 'dec_Implementation-data'(Bytes, OptOrMand, []).
+
+'dec_Implementation-data'(Bytes, OptOrMand, TagIn) ->
+?RT_BER:decode_restricted_string(Bytes,[],25,TagIn++[], no_length, OptOrMand).
+
+
+
+%%================================
+%% Mechanism-name
+%%================================
+
+'enc_Mechanism-name'({'Mechanism-name',Val}, TagIn) ->
+ 'enc_Mechanism-name'(Val, TagIn);
+
+'enc_Mechanism-name'(Val, TagIn) ->
+?RT_BER:encode_object_identifier(Val, TagIn ++ []).
+
+
+'dec_Mechanism-name'(Bytes, OptOrMand) ->
+ 'dec_Mechanism-name'(Bytes, OptOrMand, []).
+
+'dec_Mechanism-name'(Bytes, OptOrMand, TagIn) ->
+?RT_BER:decode_object_identifier(Bytes,TagIn++[], OptOrMand).
+
+
+
+%%================================
+%% Release-request-reason
+%%================================
+
+'enc_Release-request-reason'({'Release-request-reason',Val}, TagIn) ->
+ 'enc_Release-request-reason'(Val, TagIn);
+
+'enc_Release-request-reason'(Val, TagIn) ->
+?RT_BER:encode_integer([], Val, [{normal,0},{urgent,1},{'user-defined',30}], TagIn ++ []).
+
+
+'dec_Release-request-reason'(Bytes, OptOrMand) ->
+ 'dec_Release-request-reason'(Bytes, OptOrMand, []).
+
+'dec_Release-request-reason'(Bytes, OptOrMand, TagIn) ->
+?RT_BER:decode_integer(Bytes,[],[{normal,0},{urgent,1},{'user-defined',30}],TagIn++[], OptOrMand).
+
+
+
+%%================================
+%% Release-response-reason
+%%================================
+
+'enc_Release-response-reason'({'Release-response-reason',Val}, TagIn) ->
+ 'enc_Release-response-reason'(Val, TagIn);
+
+'enc_Release-response-reason'(Val, TagIn) ->
+?RT_BER:encode_integer([], Val, [{normal,0},{'not-finished',1},{'user-defined',30}], TagIn ++ []).
+
+
+'dec_Release-response-reason'(Bytes, OptOrMand) ->
+ 'dec_Release-response-reason'(Bytes, OptOrMand, []).
+
+'dec_Release-response-reason'(Bytes, OptOrMand, TagIn) ->
+?RT_BER:decode_integer(Bytes,[],[{normal,0},{'not-finished',1},{'user-defined',30}],TagIn++[], OptOrMand).
+
+
+
+%%================================
+%% EXTERNAL
+%%================================
+'enc_EXTERNAL'(Val, TagIn) ->
+ NewVal = asn1rt_check:transform_to_EXTERNAL1990(Val),
+
+%%-------------------------------------------------
+%% attribute number 1 with type OBJECT IDENTIFIER OPTIONAL
+%%-------------------------------------------------
+ {EncBytes1,EncLen1} = case ?RT_BER:cindex(2,NewVal,'direct-reference') of
+ asn1_NOVALUE -> {<<>>,0};
+ _ ->
+ ?RT_BER:encode_object_identifier(?RT_BER:cindex(2,NewVal,'direct-reference'), [])
+ end,
+
+%%-------------------------------------------------
+%% attribute number 2 with type INTEGER OPTIONAL
+%%-------------------------------------------------
+ {EncBytes2,EncLen2} = case ?RT_BER:cindex(3,NewVal,'indirect-reference') of
+ asn1_NOVALUE -> {<<>>,0};
+ _ ->
+ ?RT_BER:encode_integer([], ?RT_BER:cindex(3,NewVal,'indirect-reference'), [])
+ end,
+
+%%-------------------------------------------------
+%% attribute number 3 with type ObjectDescriptor OPTIONAL
+%%-------------------------------------------------
+ {EncBytes3,EncLen3} = case ?RT_BER:cindex(4,NewVal,'data-value-descriptor') of
+ asn1_NOVALUE -> {<<>>,0};
+ _ ->
+ ?RT_BER:encode_restricted_string([], ?RT_BER:cindex(4,NewVal,'data-value-descriptor'), 7, [])
+ end,
+
+%%-------------------------------------------------
+%% attribute number 4 with type CHOICE
+%%-------------------------------------------------
+ {EncBytes4,EncLen4} = 'enc_EXTERNAL_encoding'(?RT_BER:cindex(5,NewVal,encoding), []),
+
+ BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4],
+ LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4,
+ ?RT_BER:encode_tags(TagIn ++ [{tag,0,8,'IMPLICIT',32},{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar).
+
+
+
+%%================================
+%% EXTERNAL_encoding
+%%================================
+
+'enc_EXTERNAL_encoding'({'EXTERNAL_encoding',Val}, TagIn) ->
+ 'enc_EXTERNAL_encoding'(Val, TagIn);
+
+'enc_EXTERNAL_encoding'(Val, TagIn) ->
+ {EncBytes,EncLen} = case element(1,Val) of
+ 'single-ASN1-type' ->
+ ?RT_BER:encode_open_type(element(2,Val), [{tag,128,0,'EXPLICIT',32}]);
+ 'octet-aligned' ->
+ ?RT_BER:encode_octet_string([], element(2,Val), [{tag,128,1,'IMPLICIT',0}]);
+ arbitrary ->
+ ?RT_BER:encode_bit_string([], element(2,Val), [], [{tag,128,2,'IMPLICIT',0}]);
+ Else ->
+ exit({error,{asn1,{invalid_choice_type,Else}}})
+ end,
+
+?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen).
+
+
+'dec_EXTERNAL_encoding'(Bytes, OptOrMand, TagIn) ->
+ {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand),
+ IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end,
+ IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end,
+ case Bytes1 of
+
+%% 'single-ASN1-type'
+ <<2:2,_:1,0:5,_/binary>> ->
+ {Dec, Rest, RbCho} = ?RT_BER:decode_open_type(ber,Bytes1,[{tag,128,0,'EXPLICIT',32}]),
+ {{'single-ASN1-type', Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
+
+
+%% 'octet-aligned'
+ <<2:2,_:1,1:5,_/binary>> ->
+ {Dec, Rest, RbCho} = ?RT_BER:decode_octet_string(Bytes1,[],[{tag,128,1,'IMPLICIT',0}], no_length, mandatory),
+ {{'octet-aligned', Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
+
+
+%% 'arbitrary'
+ <<2:2,_:1,2:5,_/binary>> ->
+ {Dec, Rest, RbCho} = ?RT_BER:decode_bit_string(Bytes1,[],[],[{tag,128,2,'IMPLICIT',0}], no_length, mandatory),
+ {{arbitrary, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
+
+ Else ->
+ case OptOrMand of
+ mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}});
+ _ ->exit({error,{asn1,{no_optional_tag,Else}}})
+ end
+ end.
+
+
+'dec_EXTERNAL'(Bytes, OptOrMand) ->
+ 'dec_EXTERNAL'(Bytes, OptOrMand, []).
+
+'dec_EXTERNAL'(Bytes, OptOrMand, TagIn) ->
+ %%-------------------------------------------------
+ %% decode tag and length
+ %%-------------------------------------------------
+ {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,8,'IMPLICIT',32},{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand),
+{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len),
+
+%%-------------------------------------------------
+%% attribute number 1 with type OBJECT IDENTIFIER OPTIONAL
+%%-------------------------------------------------
+ {Term1,Bytes3,Rb2} = case Bytes2 of
+<<0:2,_:1,6:5,_/binary>> ->
+?RT_BER:decode_object_identifier(Bytes2,[], mandatory);
+_ ->
+{ asn1_NOVALUE, Bytes2, 0 }
+end,
+
+%%-------------------------------------------------
+%% attribute number 2 with type INTEGER OPTIONAL
+%%-------------------------------------------------
+ {Term2,Bytes4,Rb3} = case Bytes3 of
+<<0:2,_:1,2:5,_/binary>> ->
+?RT_BER:decode_integer(Bytes3,[],[], mandatory);
+_ ->
+{ asn1_NOVALUE, Bytes3, 0 }
+end,
+
+%%-------------------------------------------------
+%% attribute number 3 with type ObjectDescriptor OPTIONAL
+%%-------------------------------------------------
+ {Term3,Bytes5,Rb4} = case Bytes4 of
+<<0:2,_:1,7:5,_/binary>> ->
+?RT_BER:decode_restricted_string(Bytes4,[],7,[], no_length, mandatory);
+_ ->
+{ asn1_NOVALUE, Bytes4, 0 }
+end,
+
+%%-------------------------------------------------
+%% attribute number 4 with type CHOICE
+%%-------------------------------------------------
+ {Term4,Bytes6,Rb5} = 'dec_EXTERNAL_encoding'(Bytes5, mandatory, []),
+
+ {Bytes7,Rb6} = ?RT_BER:restbytes2(RemBytes, Bytes6,noext),
+ OldFormat={'EXTERNAL', Term1, Term2, Term3, Term4},
+ ASN11994Format =
+ asn1rt_check:transform_to_EXTERNAL1994(OldFormat),
+ {ASN11994Format,Bytes7, Rb1+Rb2+Rb3+Rb4+Rb5+Rb6}.
+value_match([{Index,Cname}|Rest],Value) ->
+ Value2 =
+ case element(Index,Value) of
+ {Cname,Val2} -> Val2;
+ X -> X
+ end,
+ value_match(Rest,Value2);
+value_match([],Value) ->
+ Value.
+'acse-as-id'() ->
+{2,2,1,0,1}.
+
+'aCSE-id'() ->
+{2,2,3,1,1}.
+
+
+
+
+%%================================
+%% ObjectSet
+%%================================
+'getenc_ObjectSet'(_, _) ->
+ fun(_Attr, Val, _TagIn, _RestPrimFieldName) ->
+ Len = case Val of
+ Bin when is_binary(Bin) -> size(Bin);
+ _ -> length(Val)
+ end, {Val,Len}
+ end.
+
+'getdec_ObjectSet'(_, _) ->
+ fun(_, Bytes, _, _) ->
+ Len = case Bytes of
+ Bin when is_binary(Bin) -> size(Bin);
+ _ -> length(Bytes)
+ end, {Bytes,[],Len}
+ end.
+
+