From 5cea818e88c61c7abef1df94da3f3796e0b23441 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Fri, 23 Oct 2015 17:10:17 +0200 Subject: Resort files --- acse.erl | 3363 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 3363 insertions(+) create mode 100644 acse.erl (limited to 'acse.erl') diff --git a/acse.erl b/acse.erl new file mode 100644 index 0000000..4331686 --- /dev/null +++ b/acse.erl @@ -0,0 +1,3363 @@ +%% Generated by the Erlang ASN.1 BER_V2-compiler version, utilizing bit-syntax:4.0 +%% Purpose: encoder and decoder to the types in mod acse + +-module('acse'). +-compile(nowarn_unused_vars). +-include("acse.hrl"). +-asn1_info([{vsn,'4.0'}, + {module,'acse'}, + {options,[{i,"/Users/quax/erl"}, + warnings,ber,errors, + {cwd,"/Users/quax/erl"}, + {outdir,"/Users/quax/erl"}, + {i,"."}, + {i,"/Users/quax/erl/lib"}]}]). + +-export([encoding_rule/0,bit_string_format/0, + legacy_erlang_types/0]). +-export(['dialyzer-suppressions'/1]). +-export([ +'enc_VendorSpecEvents'/2, +'enc_VoiceUnitEvents'/2, +'enc_DeviceMaintenanceEvents'/2, +'enc_LogicalDeviceFeatureEvents'/2, +'enc_PhysicalDeviceFeatureEvents'/2, +'enc_MediaAttachmentEvents'/2, +'enc_CallAssociatedEvents'/2, +'enc_CallControlEvents'/2, +'enc_LocationServices'/2, +'enc_VoiceUnitServices'/2, +'enc_RouteingServices'/2, +'enc_MediaAttachmentServices'/2, +'enc_CallAssociatedServices'/2, +'enc_CallControlServices'/2, +'enc_CSTAVersion'/2, +'enc_CSTAPrivateDataVersionList'/2, +'enc_NewACSEUserInformationForCSTA'/2, +'enc_OldACSEUserInformationForCSTA'/2, +'enc_ACSEUserInformationForCSTA'/2, +'enc_VoiceUnitServicesC2'/2, +'enc_InputOutputServicesC2'/2, +'enc_StatusReportingServicesC2'/2, +'enc_BidirectionalServicesC2'/2, +'enc_ComputingFunctionServicesC2'/2, +'enc_EventReportServicesC2'/2, +'enc_SwitchingFunctionServicesC2'/2, +'enc_CSTAFunctionality'/2, +'enc_Release-response-reason'/2, +'enc_Release-request-reason'/2, +'enc_Mechanism-name'/2, +'enc_Implementation-data'/2, +'enc_Authentication-value'/2, +'enc_Association-information'/2, +'enc_Associate-source-diagnostic'/2, +'enc_Associate-result'/2, +'enc_AP-invocation-identifier'/2, +'enc_AE-invocation-identifier'/2, +'enc_AE-title-form2'/2, +'enc_AE-title-form1'/2, +'enc_AE-title'/2, +'enc_AE-qualifier-form2'/2, +'enc_AP-title-form2'/2, +'enc_AE-qualifier-form1'/2, +'enc_AP-title-form1'/2, +'enc_AE-qualifier'/2, +'enc_AP-title'/2, +'enc_Application-context-name'/2, +'enc_Application-context-name-list'/2, +'enc_ACSE-requirements'/2, +'enc_ABRT-source'/2, +'enc_ABRT-diagnostic'/2, +'enc_ABRT-apdu'/2, +'enc_RLRE-apdu'/2, +'enc_RLRQ-apdu'/2, +'enc_AARE-apdu'/2, +'enc_AARQ-apdu'/2, +'enc_ACSE-apdu'/2, +'enc_EXTERNAL'/2 +]). + +-export([ +'dec_VendorSpecEvents'/2, +'dec_VoiceUnitEvents'/2, +'dec_DeviceMaintenanceEvents'/2, +'dec_LogicalDeviceFeatureEvents'/2, +'dec_PhysicalDeviceFeatureEvents'/2, +'dec_MediaAttachmentEvents'/2, +'dec_CallAssociatedEvents'/2, +'dec_CallControlEvents'/2, +'dec_LocationServices'/2, +'dec_VoiceUnitServices'/2, +'dec_RouteingServices'/2, +'dec_MediaAttachmentServices'/2, +'dec_CallAssociatedServices'/2, +'dec_CallControlServices'/2, +'dec_CSTAVersion'/2, +'dec_CSTAPrivateDataVersionList'/2, +'dec_NewACSEUserInformationForCSTA'/2, +'dec_OldACSEUserInformationForCSTA'/2, +'dec_ACSEUserInformationForCSTA'/2, +'dec_VoiceUnitServicesC2'/2, +'dec_InputOutputServicesC2'/2, +'dec_StatusReportingServicesC2'/2, +'dec_BidirectionalServicesC2'/2, +'dec_ComputingFunctionServicesC2'/2, +'dec_EventReportServicesC2'/2, +'dec_SwitchingFunctionServicesC2'/2, +'dec_CSTAFunctionality'/2, +'dec_Release-response-reason'/2, +'dec_Release-request-reason'/2, +'dec_Mechanism-name'/2, +'dec_Implementation-data'/2, +'dec_Authentication-value'/2, +'dec_Association-information'/2, +'dec_Associate-source-diagnostic'/2, +'dec_Associate-result'/2, +'dec_AP-invocation-identifier'/2, +'dec_AE-invocation-identifier'/2, +'dec_AE-title-form2'/2, +'dec_AE-title-form1'/2, +'dec_AE-title'/2, +'dec_AE-qualifier-form2'/2, +'dec_AP-title-form2'/2, +'dec_AE-qualifier-form1'/2, +'dec_AP-title-form1'/2, +'dec_AE-qualifier'/2, +'dec_AP-title'/2, +'dec_Application-context-name'/2, +'dec_Application-context-name-list'/2, +'dec_ACSE-requirements'/2, +'dec_ABRT-source'/2, +'dec_ABRT-diagnostic'/2, +'dec_ABRT-apdu'/2, +'dec_RLRE-apdu'/2, +'dec_RLRQ-apdu'/2, +'dec_AARE-apdu'/2, +'dec_AARQ-apdu'/2, +'dec_ACSE-apdu'/2, +'dec_EXTERNAL'/2 +]). + +-export([ +'aCSE-id'/0, +'acse-as-id'/0 +]). + +-export([ +'getenc_ObjectSet'/1 +]). + +-export([ +'getdec_ObjectSet'/1 +]). + +-export([info/0]). + + +-export([encode/2,decode/2]). + +encoding_rule() -> ber. + +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 when Class =:= error; Class =:= exit -> + case Exception of + {error,Reason}=Error -> + Error; + Reason -> + {error,{asn1,Reason}} + end +end. + +decode(Type,Data) -> +try decode_disp(Type, element(1, ber_decode_nif(Data))) of + Result -> + {ok,Result} + catch + Class:Exception when Class =:= error; Class =:= exit -> + case Exception of + {error,Reason}=Error -> + Error; + Reason -> + {error,{asn1,Reason}} + end +end. + +encode_disp('VendorSpecEvents',Data) -> 'enc_VendorSpecEvents'(Data); +encode_disp('VoiceUnitEvents',Data) -> 'enc_VoiceUnitEvents'(Data); +encode_disp('DeviceMaintenanceEvents',Data) -> 'enc_DeviceMaintenanceEvents'(Data); +encode_disp('LogicalDeviceFeatureEvents',Data) -> 'enc_LogicalDeviceFeatureEvents'(Data); +encode_disp('PhysicalDeviceFeatureEvents',Data) -> 'enc_PhysicalDeviceFeatureEvents'(Data); +encode_disp('MediaAttachmentEvents',Data) -> 'enc_MediaAttachmentEvents'(Data); +encode_disp('CallAssociatedEvents',Data) -> 'enc_CallAssociatedEvents'(Data); +encode_disp('CallControlEvents',Data) -> 'enc_CallControlEvents'(Data); +encode_disp('LocationServices',Data) -> 'enc_LocationServices'(Data); +encode_disp('VoiceUnitServices',Data) -> 'enc_VoiceUnitServices'(Data); +encode_disp('RouteingServices',Data) -> 'enc_RouteingServices'(Data); +encode_disp('MediaAttachmentServices',Data) -> 'enc_MediaAttachmentServices'(Data); +encode_disp('CallAssociatedServices',Data) -> 'enc_CallAssociatedServices'(Data); +encode_disp('CallControlServices',Data) -> 'enc_CallControlServices'(Data); +encode_disp('CSTAVersion',Data) -> 'enc_CSTAVersion'(Data); +encode_disp('CSTAPrivateDataVersionList',Data) -> 'enc_CSTAPrivateDataVersionList'(Data); +encode_disp('NewACSEUserInformationForCSTA',Data) -> 'enc_NewACSEUserInformationForCSTA'(Data); +encode_disp('OldACSEUserInformationForCSTA',Data) -> 'enc_OldACSEUserInformationForCSTA'(Data); +encode_disp('ACSEUserInformationForCSTA',Data) -> 'enc_ACSEUserInformationForCSTA'(Data); +encode_disp('VoiceUnitServicesC2',Data) -> 'enc_VoiceUnitServicesC2'(Data); +encode_disp('InputOutputServicesC2',Data) -> 'enc_InputOutputServicesC2'(Data); +encode_disp('StatusReportingServicesC2',Data) -> 'enc_StatusReportingServicesC2'(Data); +encode_disp('BidirectionalServicesC2',Data) -> 'enc_BidirectionalServicesC2'(Data); +encode_disp('ComputingFunctionServicesC2',Data) -> 'enc_ComputingFunctionServicesC2'(Data); +encode_disp('EventReportServicesC2',Data) -> 'enc_EventReportServicesC2'(Data); +encode_disp('SwitchingFunctionServicesC2',Data) -> 'enc_SwitchingFunctionServicesC2'(Data); +encode_disp('CSTAFunctionality',Data) -> 'enc_CSTAFunctionality'(Data); +encode_disp('Release-response-reason',Data) -> 'enc_Release-response-reason'(Data); +encode_disp('Release-request-reason',Data) -> 'enc_Release-request-reason'(Data); +encode_disp('Mechanism-name',Data) -> 'enc_Mechanism-name'(Data); +encode_disp('Implementation-data',Data) -> 'enc_Implementation-data'(Data); +encode_disp('Authentication-value',Data) -> 'enc_Authentication-value'(Data); +encode_disp('Association-information',Data) -> 'enc_Association-information'(Data); +encode_disp('Associate-source-diagnostic',Data) -> 'enc_Associate-source-diagnostic'(Data); +encode_disp('Associate-result',Data) -> 'enc_Associate-result'(Data); +encode_disp('AP-invocation-identifier',Data) -> 'enc_AP-invocation-identifier'(Data); +encode_disp('AE-invocation-identifier',Data) -> 'enc_AE-invocation-identifier'(Data); +encode_disp('AE-title-form2',Data) -> 'enc_AE-title-form2'(Data); +encode_disp('AE-title-form1',Data) -> 'enc_AE-title-form1'(Data); +encode_disp('AE-title',Data) -> 'enc_AE-title'(Data); +encode_disp('AE-qualifier-form2',Data) -> 'enc_AE-qualifier-form2'(Data); +encode_disp('AP-title-form2',Data) -> 'enc_AP-title-form2'(Data); +encode_disp('AE-qualifier-form1',Data) -> 'enc_AE-qualifier-form1'(Data); +encode_disp('AP-title-form1',Data) -> 'enc_AP-title-form1'(Data); +encode_disp('AE-qualifier',Data) -> 'enc_AE-qualifier'(Data); +encode_disp('AP-title',Data) -> 'enc_AP-title'(Data); +encode_disp('Application-context-name',Data) -> 'enc_Application-context-name'(Data); +encode_disp('Application-context-name-list',Data) -> 'enc_Application-context-name-list'(Data); +encode_disp('ACSE-requirements',Data) -> 'enc_ACSE-requirements'(Data); +encode_disp('ABRT-source',Data) -> 'enc_ABRT-source'(Data); +encode_disp('ABRT-diagnostic',Data) -> 'enc_ABRT-diagnostic'(Data); +encode_disp('ABRT-apdu',Data) -> 'enc_ABRT-apdu'(Data); +encode_disp('RLRE-apdu',Data) -> 'enc_RLRE-apdu'(Data); +encode_disp('RLRQ-apdu',Data) -> 'enc_RLRQ-apdu'(Data); +encode_disp('AARE-apdu',Data) -> 'enc_AARE-apdu'(Data); +encode_disp('AARQ-apdu',Data) -> 'enc_AARQ-apdu'(Data); +encode_disp('ACSE-apdu',Data) -> 'enc_ACSE-apdu'(Data); +encode_disp('EXTERNAL',Data) -> 'enc_EXTERNAL'(Data); +encode_disp(Type,_Data) -> exit({error,{asn1,{undefined_type,Type}}}). + + +decode_disp('VendorSpecEvents',Data) -> 'dec_VendorSpecEvents'(Data); +decode_disp('VoiceUnitEvents',Data) -> 'dec_VoiceUnitEvents'(Data); +decode_disp('DeviceMaintenanceEvents',Data) -> 'dec_DeviceMaintenanceEvents'(Data); +decode_disp('LogicalDeviceFeatureEvents',Data) -> 'dec_LogicalDeviceFeatureEvents'(Data); +decode_disp('PhysicalDeviceFeatureEvents',Data) -> 'dec_PhysicalDeviceFeatureEvents'(Data); +decode_disp('MediaAttachmentEvents',Data) -> 'dec_MediaAttachmentEvents'(Data); +decode_disp('CallAssociatedEvents',Data) -> 'dec_CallAssociatedEvents'(Data); +decode_disp('CallControlEvents',Data) -> 'dec_CallControlEvents'(Data); +decode_disp('LocationServices',Data) -> 'dec_LocationServices'(Data); +decode_disp('VoiceUnitServices',Data) -> 'dec_VoiceUnitServices'(Data); +decode_disp('RouteingServices',Data) -> 'dec_RouteingServices'(Data); +decode_disp('MediaAttachmentServices',Data) -> 'dec_MediaAttachmentServices'(Data); +decode_disp('CallAssociatedServices',Data) -> 'dec_CallAssociatedServices'(Data); +decode_disp('CallControlServices',Data) -> 'dec_CallControlServices'(Data); +decode_disp('CSTAVersion',Data) -> 'dec_CSTAVersion'(Data); +decode_disp('CSTAPrivateDataVersionList',Data) -> 'dec_CSTAPrivateDataVersionList'(Data); +decode_disp('NewACSEUserInformationForCSTA',Data) -> 'dec_NewACSEUserInformationForCSTA'(Data); +decode_disp('OldACSEUserInformationForCSTA',Data) -> 'dec_OldACSEUserInformationForCSTA'(Data); +decode_disp('ACSEUserInformationForCSTA',Data) -> 'dec_ACSEUserInformationForCSTA'(Data); +decode_disp('VoiceUnitServicesC2',Data) -> 'dec_VoiceUnitServicesC2'(Data); +decode_disp('InputOutputServicesC2',Data) -> 'dec_InputOutputServicesC2'(Data); +decode_disp('StatusReportingServicesC2',Data) -> 'dec_StatusReportingServicesC2'(Data); +decode_disp('BidirectionalServicesC2',Data) -> 'dec_BidirectionalServicesC2'(Data); +decode_disp('ComputingFunctionServicesC2',Data) -> 'dec_ComputingFunctionServicesC2'(Data); +decode_disp('EventReportServicesC2',Data) -> 'dec_EventReportServicesC2'(Data); +decode_disp('SwitchingFunctionServicesC2',Data) -> 'dec_SwitchingFunctionServicesC2'(Data); +decode_disp('CSTAFunctionality',Data) -> 'dec_CSTAFunctionality'(Data); +decode_disp('Release-response-reason',Data) -> 'dec_Release-response-reason'(Data); +decode_disp('Release-request-reason',Data) -> 'dec_Release-request-reason'(Data); +decode_disp('Mechanism-name',Data) -> 'dec_Mechanism-name'(Data); +decode_disp('Implementation-data',Data) -> 'dec_Implementation-data'(Data); +decode_disp('Authentication-value',Data) -> 'dec_Authentication-value'(Data); +decode_disp('Association-information',Data) -> 'dec_Association-information'(Data); +decode_disp('Associate-source-diagnostic',Data) -> 'dec_Associate-source-diagnostic'(Data); +decode_disp('Associate-result',Data) -> 'dec_Associate-result'(Data); +decode_disp('AP-invocation-identifier',Data) -> 'dec_AP-invocation-identifier'(Data); +decode_disp('AE-invocation-identifier',Data) -> 'dec_AE-invocation-identifier'(Data); +decode_disp('AE-title-form2',Data) -> 'dec_AE-title-form2'(Data); +decode_disp('AE-title-form1',Data) -> 'dec_AE-title-form1'(Data); +decode_disp('AE-title',Data) -> 'dec_AE-title'(Data); +decode_disp('AE-qualifier-form2',Data) -> 'dec_AE-qualifier-form2'(Data); +decode_disp('AP-title-form2',Data) -> 'dec_AP-title-form2'(Data); +decode_disp('AE-qualifier-form1',Data) -> 'dec_AE-qualifier-form1'(Data); +decode_disp('AP-title-form1',Data) -> 'dec_AP-title-form1'(Data); +decode_disp('AE-qualifier',Data) -> 'dec_AE-qualifier'(Data); +decode_disp('AP-title',Data) -> 'dec_AP-title'(Data); +decode_disp('Application-context-name',Data) -> 'dec_Application-context-name'(Data); +decode_disp('Application-context-name-list',Data) -> 'dec_Application-context-name-list'(Data); +decode_disp('ACSE-requirements',Data) -> 'dec_ACSE-requirements'(Data); +decode_disp('ABRT-source',Data) -> 'dec_ABRT-source'(Data); +decode_disp('ABRT-diagnostic',Data) -> 'dec_ABRT-diagnostic'(Data); +decode_disp('ABRT-apdu',Data) -> 'dec_ABRT-apdu'(Data); +decode_disp('RLRE-apdu',Data) -> 'dec_RLRE-apdu'(Data); +decode_disp('RLRQ-apdu',Data) -> 'dec_RLRQ-apdu'(Data); +decode_disp('AARE-apdu',Data) -> 'dec_AARE-apdu'(Data); +decode_disp('AARQ-apdu',Data) -> 'dec_AARQ-apdu'(Data); +decode_disp('ACSE-apdu',Data) -> 'dec_ACSE-apdu'(Data); +decode_disp('EXTERNAL',Data) -> 'dec_EXTERNAL'(Data); +decode_disp(Type,_Data) -> exit({error,{asn1,{undefined_type,Type}}}). + + + + +info() -> + case ?MODULE:module_info(attributes) of + Attributes when is_list(Attributes) -> + case lists:keyfind(asn1_info, 1, Attributes) of + {_,Info} when is_list(Info) -> + Info; + _ -> + [] + end; + _ -> + [] + end. + + +%%================================ +%% VendorSpecEvents +%%================================ +'enc_VendorSpecEvents'(Val) -> + 'enc_VendorSpecEvents'(Val, [<<3>>]). + +'enc_VendorSpecEvents'(Val, TagIn) -> +encode_named_bit_string(Val, [{privateEvent,0}], TagIn). + + +'dec_VendorSpecEvents'(Tlv) -> + 'dec_VendorSpecEvents'(Tlv, [3]). + +'dec_VendorSpecEvents'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{privateEvent,0}], TagIn). + + + +%%================================ +%% VoiceUnitEvents +%%================================ +'enc_VoiceUnitEvents'(Val) -> + 'enc_VoiceUnitEvents'(Val, [<<3>>]). + +'enc_VoiceUnitEvents'(Val, TagIn) -> +encode_named_bit_string(Val, [{stop,0},{play,1},{suspendPlay,2},{record,3},{suspendRecord,4},{review,5},{voiceAttributesChange,6},{bookmarkReached,7},{completed,8},{dtmfDetected,9},{emptied,10},{interruptionDetected,11},{notRecognized,12},{recognized,13},{started,14},{silenceTimeoutExpired,15},{speechDetected,16},{voiceErrorOccured,17}], TagIn). + + +'dec_VoiceUnitEvents'(Tlv) -> + 'dec_VoiceUnitEvents'(Tlv, [3]). + +'dec_VoiceUnitEvents'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{stop,0},{play,1},{suspendPlay,2},{record,3},{suspendRecord,4},{review,5},{voiceAttributesChange,6},{bookmarkReached,7},{completed,8},{dtmfDetected,9},{emptied,10},{interruptionDetected,11},{notRecognized,12},{recognized,13},{started,14},{silenceTimeoutExpired,15},{speechDetected,16},{voiceErrorOccured,17}], TagIn). + + + +%%================================ +%% DeviceMaintenanceEvents +%%================================ +'enc_DeviceMaintenanceEvents'(Val) -> + 'enc_DeviceMaintenanceEvents'(Val, [<<3>>]). + +'enc_DeviceMaintenanceEvents'(Val, TagIn) -> +encode_named_bit_string(Val, [{backInService,0},{outOfService,1},{deviceCapabilityChanged,2},{partiallyInService,3}], TagIn). + + +'dec_DeviceMaintenanceEvents'(Tlv) -> + 'dec_DeviceMaintenanceEvents'(Tlv, [3]). + +'dec_DeviceMaintenanceEvents'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{backInService,0},{outOfService,1},{deviceCapabilityChanged,2},{partiallyInService,3}], TagIn). + + + +%%================================ +%% LogicalDeviceFeatureEvents +%%================================ +'enc_LogicalDeviceFeatureEvents'(Val) -> + 'enc_LogicalDeviceFeatureEvents'(Val, [<<3>>]). + +'enc_LogicalDeviceFeatureEvents'(Val, TagIn) -> +encode_named_bit_string(Val, [{agentBusy,0},{agentLoggedOn,1},{agentLoggedOff,2},{agentNotReady,3},{agentReady,4},{agentWorkingAfterCall,5},{autoAnswer,6},{autoWorkMode,7},{callBack,8},{callBackMessage,9},{callerIDStatus,10},{doNotDisturb,11},{forwarding,12},{routeingMode,13},{presenceState,14}], TagIn). + + +'dec_LogicalDeviceFeatureEvents'(Tlv) -> + 'dec_LogicalDeviceFeatureEvents'(Tlv, [3]). + +'dec_LogicalDeviceFeatureEvents'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{agentBusy,0},{agentLoggedOn,1},{agentLoggedOff,2},{agentNotReady,3},{agentReady,4},{agentWorkingAfterCall,5},{autoAnswer,6},{autoWorkMode,7},{callBack,8},{callBackMessage,9},{callerIDStatus,10},{doNotDisturb,11},{forwarding,12},{routeingMode,13},{presenceState,14}], TagIn). + + + +%%================================ +%% PhysicalDeviceFeatureEvents +%%================================ +'enc_PhysicalDeviceFeatureEvents'(Val) -> + 'enc_PhysicalDeviceFeatureEvents'(Val, [<<3>>]). + +'enc_PhysicalDeviceFeatureEvents'(Val, TagIn) -> +encode_named_bit_string(Val, [{buttonInformation,0},{buttonPress,1},{displayUpdated,2},{hookswitch,3},{lampMode,4},{messageWaiting,5},{microphoneGain,6},{microphoneMute,7},{ringerStatus,8},{speakerMute,9},{speakerVolume,10}], TagIn). + + +'dec_PhysicalDeviceFeatureEvents'(Tlv) -> + 'dec_PhysicalDeviceFeatureEvents'(Tlv, [3]). + +'dec_PhysicalDeviceFeatureEvents'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{buttonInformation,0},{buttonPress,1},{displayUpdated,2},{hookswitch,3},{lampMode,4},{messageWaiting,5},{microphoneGain,6},{microphoneMute,7},{ringerStatus,8},{speakerMute,9},{speakerVolume,10}], TagIn). + + + +%%================================ +%% MediaAttachmentEvents +%%================================ +'enc_MediaAttachmentEvents'(Val) -> + 'enc_MediaAttachmentEvents'(Val, [<<3>>]). + +'enc_MediaAttachmentEvents'(Val, TagIn) -> +encode_named_bit_string(Val, [{mediaAttached,0},{mediaDetached,1}], TagIn). + + +'dec_MediaAttachmentEvents'(Tlv) -> + 'dec_MediaAttachmentEvents'(Tlv, [3]). + +'dec_MediaAttachmentEvents'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{mediaAttached,0},{mediaDetached,1}], TagIn). + + + +%%================================ +%% CallAssociatedEvents +%%================================ +'enc_CallAssociatedEvents'(Val) -> + 'enc_CallAssociatedEvents'(Val, [<<3>>]). + +'enc_CallAssociatedEvents'(Val, TagIn) -> +encode_named_bit_string(Val, [{callInformation,0},{charging,1},{dTMFDigitsDetected,2},{telephonyTonesDetected,3},{serviceCompletionFailure,4}], TagIn). + + +'dec_CallAssociatedEvents'(Tlv) -> + 'dec_CallAssociatedEvents'(Tlv, [3]). + +'dec_CallAssociatedEvents'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{callInformation,0},{charging,1},{dTMFDigitsDetected,2},{telephonyTonesDetected,3},{serviceCompletionFailure,4}], TagIn). + + + +%%================================ +%% CallControlEvents +%%================================ +'enc_CallControlEvents'(Val) -> + 'enc_CallControlEvents'(Val, [<<3>>]). + +'enc_CallControlEvents'(Val, TagIn) -> +encode_named_bit_string(Val, [{callCleared,0},{conferenced,1},{connectionCleared,2},{delivered,3},{diverted,4},{established,5},{failed,6},{held,7},{networkReached,8},{originated,9},{queued,10},{retrieved,11},{serviceInitiated,12},{transferred,13},{digitsDialed,14},{bridged,15},{networkCapabilitiesChanged,16},{offered,17}], TagIn). + + +'dec_CallControlEvents'(Tlv) -> + 'dec_CallControlEvents'(Tlv, [3]). + +'dec_CallControlEvents'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{callCleared,0},{conferenced,1},{connectionCleared,2},{delivered,3},{diverted,4},{established,5},{failed,6},{held,7},{networkReached,8},{originated,9},{queued,10},{retrieved,11},{serviceInitiated,12},{transferred,13},{digitsDialed,14},{bridged,15},{networkCapabilitiesChanged,16},{offered,17}], TagIn). + + + +%%================================ +%% LocationServices +%%================================ +'enc_LocationServices'(Val) -> + 'enc_LocationServices'(Val, [<<3>>]). + +'enc_LocationServices'(Val, TagIn) -> +encode_named_bit_string(Val, [{getLocationInformation,0},{setLocationInformation,1},{locationTrackkingSessionResumed,2},{locationTrackkingSessionSuspended,3},{resumeLocationTrackingSession,4},{locationInformationReport,5},{startLocationTrackingSession,6},{stopLocationTrackingSession,7},{suspendLocationTrackingCapabilities,8},{locationSessionInfo,9}], TagIn). + + +'dec_LocationServices'(Tlv) -> + 'dec_LocationServices'(Tlv, [3]). + +'dec_LocationServices'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{getLocationInformation,0},{setLocationInformation,1},{locationTrackkingSessionResumed,2},{locationTrackkingSessionSuspended,3},{resumeLocationTrackingSession,4},{locationInformationReport,5},{startLocationTrackingSession,6},{stopLocationTrackingSession,7},{suspendLocationTrackingCapabilities,8},{locationSessionInfo,9}], TagIn). + + + +%%================================ +%% VoiceUnitServices +%%================================ +'enc_VoiceUnitServices'(Val) -> + 'enc_VoiceUnitServices'(Val, [<<3>>]). + +'enc_VoiceUnitServices'(Val, TagIn) -> +encode_named_bit_string(Val, [{concatenateMessage,0},{deleteMessage,1},{playMessage,2},{queryVoiceAttribute,3},{recordMessage,4},{reposition,5},{resume,6},{review,7},{setVoiceAttribute,8},{stop,9},{suspend,10},{synthesizeMessage,11},{activate,12},{clear,13},{deactivate,14}], TagIn). + + +'dec_VoiceUnitServices'(Tlv) -> + 'dec_VoiceUnitServices'(Tlv, [3]). + +'dec_VoiceUnitServices'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{concatenateMessage,0},{deleteMessage,1},{playMessage,2},{queryVoiceAttribute,3},{recordMessage,4},{reposition,5},{resume,6},{review,7},{setVoiceAttribute,8},{stop,9},{suspend,10},{synthesizeMessage,11},{activate,12},{clear,13},{deactivate,14}], TagIn). + + + +%%================================ +%% RouteingServices +%%================================ +'enc_RouteingServices'(Val) -> + 'enc_RouteingServices'(Val, [<<3>>]). + +'enc_RouteingServices'(Val, TagIn) -> +encode_named_bit_string(Val, [{routeRegister,0},{routeRegisterCancel,1},{routeRegisterAbort,2},{reroute,3},{routeEnd,4},{routeReject,5},{routeRequest,6},{routeSelect,7},{routeUsed,8}], TagIn). + + +'dec_RouteingServices'(Tlv) -> + 'dec_RouteingServices'(Tlv, [3]). + +'dec_RouteingServices'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{routeRegister,0},{routeRegisterCancel,1},{routeRegisterAbort,2},{reroute,3},{routeEnd,4},{routeReject,5},{routeRequest,6},{routeSelect,7},{routeUsed,8}], TagIn). + + + +%%================================ +%% MediaAttachmentServices +%%================================ +'enc_MediaAttachmentServices'(Val) -> + 'enc_MediaAttachmentServices'(Val, [<<3>>]). + +'enc_MediaAttachmentServices'(Val, TagIn) -> +encode_named_bit_string(Val, [{attachMediaService,0},{detachMediaService,1}], TagIn). + + +'dec_MediaAttachmentServices'(Tlv) -> + 'dec_MediaAttachmentServices'(Tlv, [3]). + +'dec_MediaAttachmentServices'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{attachMediaService,0},{detachMediaService,1}], TagIn). + + + +%%================================ +%% CallAssociatedServices +%%================================ +'enc_CallAssociatedServices'(Val) -> + 'enc_CallAssociatedServices'(Val, [<<3>>]). + +'enc_CallAssociatedServices'(Val, TagIn) -> +encode_named_bit_string(Val, [{associateData,0},{cancelTelephonyTones,1},{generateDigits,2},{generateTelephonyTones,3},{sendUserInformation,4},{changeConnectionInformation,5}], TagIn). + + +'dec_CallAssociatedServices'(Tlv) -> + 'dec_CallAssociatedServices'(Tlv, [3]). + +'dec_CallAssociatedServices'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{associateData,0},{cancelTelephonyTones,1},{generateDigits,2},{generateTelephonyTones,3},{sendUserInformation,4},{changeConnectionInformation,5}], TagIn). + + + +%%================================ +%% CallControlServices +%%================================ +'enc_CallControlServices'(Val) -> + 'enc_CallControlServices'(Val, [<<3>>]). + +'enc_CallControlServices'(Val, TagIn) -> +encode_named_bit_string(Val, [{acceptCall,0},{alternateCall,1},{answerCall,2},{callBack,3},{callBackMessage,4},{campOnCall,5},{clearCall,6},{clearConnection,7},{conferenceCall,8},{consultationCall,9},{deflectCall,10},{dialDigits,11},{directedPickupCall,12},{groupPickupCall,13},{holdCall,14},{intrudeCall,15},{joinCall,16},{makeCall,17},{makePredictiveCall,18},{parkCall,19},{reconnectCall,20},{retrieveCall,21},{singleStepConference,22},{singleStepTransfer,23},{transferCall,24},{makeConnection,25},{sendMessage,26}], TagIn). + + +'dec_CallControlServices'(Tlv) -> + 'dec_CallControlServices'(Tlv, [3]). + +'dec_CallControlServices'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{acceptCall,0},{alternateCall,1},{answerCall,2},{callBack,3},{callBackMessage,4},{campOnCall,5},{clearCall,6},{clearConnection,7},{conferenceCall,8},{consultationCall,9},{deflectCall,10},{dialDigits,11},{directedPickupCall,12},{groupPickupCall,13},{holdCall,14},{intrudeCall,15},{joinCall,16},{makeCall,17},{makePredictiveCall,18},{parkCall,19},{reconnectCall,20},{retrieveCall,21},{singleStepConference,22},{singleStepTransfer,23},{transferCall,24},{makeConnection,25},{sendMessage,26}], TagIn). + + + +%%================================ +%% CSTAVersion +%%================================ +'enc_CSTAVersion'(Val) -> + 'enc_CSTAVersion'(Val, [<<3>>]). + +'enc_CSTAVersion'(Val, TagIn) -> +encode_named_bit_string(Val, [{versionOne,0},{versionTwo,1},{versionThree,2},{versionFour,3},{versionFive,4},{versionSix,5},{versionSeven,6},{versionEight,7},{versionNine,8},{versionTen,9},{versionEleven,10},{versionTwelve,11},{versionThirteen,12},{versionFourteen,13},{versionFifteen,14},{versionSixteen,15},{versionSeventeen,16},{versionEighteen,17},{versionNineteen,18},{versionTwenty,19},{versionTwentyone,20},{versionTwentytwo,21},{versionTwentythree,22},{versionTwentyfour,23}], TagIn). + + +'dec_CSTAVersion'(Tlv) -> + 'dec_CSTAVersion'(Tlv, [3]). + +'dec_CSTAVersion'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{versionOne,0},{versionTwo,1},{versionThree,2},{versionFour,3},{versionFive,4},{versionSix,5},{versionSeven,6},{versionEight,7},{versionNine,8},{versionTen,9},{versionEleven,10},{versionTwelve,11},{versionThirteen,12},{versionFourteen,13},{versionFifteen,14},{versionSixteen,15},{versionSeventeen,16},{versionEighteen,17},{versionNineteen,18},{versionTwenty,19},{versionTwentyone,20},{versionTwentytwo,21},{versionTwentythree,22},{versionTwentyfour,23}], TagIn). + + + +%%================================ +%% CSTAPrivateDataVersionList +%%================================ +'enc_CSTAPrivateDataVersionList'(Val) -> + 'enc_CSTAPrivateDataVersionList'(Val, [<<48>>]). + +'enc_CSTAPrivateDataVersionList'(Val, TagIn) -> + {EncBytes,EncLen} = 'enc_CSTAPrivateDataVersionList_components'(Val,[],0), + encode_tags(TagIn, EncBytes, EncLen). + +'enc_CSTAPrivateDataVersionList_components'([], AccBytes, AccLen) -> + {lists:reverse(AccBytes),AccLen}; + +'enc_CSTAPrivateDataVersionList_components'([H|T],AccBytes, AccLen) -> + {EncBytes,EncLen} = encode_integer(H, [<<2>>]), + 'enc_CSTAPrivateDataVersionList_components'(T,[EncBytes|AccBytes], AccLen + EncLen). + + + +'dec_CSTAPrivateDataVersionList'(Tlv) -> + 'dec_CSTAPrivateDataVersionList'(Tlv, [16]). + +'dec_CSTAPrivateDataVersionList'(Tlv, TagIn) -> + %%------------------------------------------------- + %% decode tag and length + %%------------------------------------------------- +Tlv1 = match_tags(Tlv, TagIn), +[decode_integer(V1, [2]) || V1 <- Tlv1]. + + + + +%%================================ +%% NewACSEUserInformationForCSTA +%%================================ +'enc_NewACSEUserInformationForCSTA'(Val) -> + 'enc_NewACSEUserInformationForCSTA'(Val, [<<48>>]). + +'enc_NewACSEUserInformationForCSTA'(Val, TagIn) -> +{_,Cindex1, Cindex2, Cindex3, Cindex4} = Val, + +%%------------------------------------------------- +%% attribute cSTAVersion(1) with type BIT STRING +%%------------------------------------------------- + {EncBytes1,EncLen1} = encode_named_bit_string(Cindex1, [{versionOne,0},{versionTwo,1},{versionThree,2},{versionFour,3},{versionFive,4},{versionSix,5},{versionSeven,6},{versionEight,7},{versionNine,8},{versionTen,9},{versionEleven,10},{versionTwelve,11},{versionThirteen,12},{versionFourteen,13},{versionFifteen,14},{versionSixteen,15},{versionSeventeen,16},{versionEighteen,17},{versionNineteen,18},{versionTwenty,19},{versionTwentyone,20},{versionTwentytwo,21},{versionTwentythree,22},{versionTwentyfour,23}], [<<3>>]), + +%%------------------------------------------------- +%% attribute cSTAFunctionsRequiredByApplication(2) External acse:CSTAFunctionality OPTIONAL +%%------------------------------------------------- + {EncBytes2,EncLen2} = case Cindex2 of + asn1_NOVALUE -> {<<>>,0}; + _ -> + 'enc_CSTAFunctionality'(Cindex2, [<<160>>]) + end, + +%%------------------------------------------------- +%% attribute cSTAFunctionsThatCanBeSupplied(3) External acse:CSTAFunctionality OPTIONAL +%%------------------------------------------------- + {EncBytes3,EncLen3} = case Cindex3 of + asn1_NOVALUE -> {<<>>,0}; + _ -> + 'enc_CSTAFunctionality'(Cindex3, [<<161>>]) + end, + +%%------------------------------------------------- +%% attribute cSTAPrivateDataVersionList(4) External acse:CSTAPrivateDataVersionList OPTIONAL +%%------------------------------------------------- + {EncBytes4,EncLen4} = case Cindex4 of + asn1_NOVALUE -> {<<>>,0}; + _ -> + 'enc_CSTAPrivateDataVersionList'(Cindex4, [<<162>>]) + end, + + BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4], +LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4, +encode_tags(TagIn, BytesSoFar, LenSoFar). + + +'dec_NewACSEUserInformationForCSTA'(Tlv) -> + 'dec_NewACSEUserInformationForCSTA'(Tlv, [16]). + +'dec_NewACSEUserInformationForCSTA'(Tlv, TagIn) -> + %%------------------------------------------------- + %% decode tag and length + %%------------------------------------------------- +Tlv1 = match_tags(Tlv, TagIn), + +%%------------------------------------------------- +%% attribute cSTAVersion(1) with type BIT STRING +%%------------------------------------------------- +[V1|Tlv2] = Tlv1, +Term1 = decode_named_bit_string(V1, [{versionOne,0},{versionTwo,1},{versionThree,2},{versionFour,3},{versionFive,4},{versionSix,5},{versionSeven,6},{versionEight,7},{versionNine,8},{versionTen,9},{versionEleven,10},{versionTwelve,11},{versionThirteen,12},{versionFourteen,13},{versionFifteen,14},{versionSixteen,15},{versionSeventeen,16},{versionEighteen,17},{versionNineteen,18},{versionTwenty,19},{versionTwentyone,20},{versionTwentytwo,21},{versionTwentythree,22},{versionTwentyfour,23}], [3]), + +%%------------------------------------------------- +%% attribute cSTAFunctionsRequiredByApplication(2) External acse:CSTAFunctionality OPTIONAL +%%------------------------------------------------- +{Term2,Tlv3} = case Tlv2 of +[{131072,V2}|TempTlv3] -> + {'dec_CSTAFunctionality'(V2, []), TempTlv3}; + _ -> + { asn1_NOVALUE, Tlv2} +end, + +%%------------------------------------------------- +%% attribute cSTAFunctionsThatCanBeSupplied(3) External acse:CSTAFunctionality OPTIONAL +%%------------------------------------------------- +{Term3,Tlv4} = case Tlv3 of +[{131073,V3}|TempTlv4] -> + {'dec_CSTAFunctionality'(V3, []), TempTlv4}; + _ -> + { asn1_NOVALUE, Tlv3} +end, + +%%------------------------------------------------- +%% attribute cSTAPrivateDataVersionList(4) External acse:CSTAPrivateDataVersionList OPTIONAL +%%------------------------------------------------- +{Term4,Tlv5} = case Tlv4 of +[{131074,V4}|TempTlv5] -> + {'dec_CSTAPrivateDataVersionList'(V4, []), TempTlv5}; + _ -> + { asn1_NOVALUE, Tlv4} +end, + +case Tlv5 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv5}}}) % extra fields not allowed +end, + {'NewACSEUserInformationForCSTA', Term1, Term2, Term3, Term4}. + + + +%%================================ +%% OldACSEUserInformationForCSTA +%%================================ +'enc_OldACSEUserInformationForCSTA'(Val) -> + 'enc_OldACSEUserInformationForCSTA'(Val, [<<48>>]). + +'enc_OldACSEUserInformationForCSTA'(Val, TagIn) -> +{_,Cindex1, Cindex2, Cindex3} = Val, + +%%------------------------------------------------- +%% attribute cSTAVersion(1) with type BIT STRING +%%------------------------------------------------- + {EncBytes1,EncLen1} = encode_named_bit_string(Cindex1, [{versionOne,0},{versionTwo,1},{versionThree,2},{versionFour,3},{versionFive,4},{versionSix,5},{versionSeven,6},{versionEight,7},{versionNine,8},{versionTen,9},{versionEleven,10},{versionTwelve,11},{versionThirteen,12},{versionFourteen,13},{versionFifteen,14},{versionSixteen,15},{versionSeventeen,16},{versionEighteen,17},{versionNineteen,18},{versionTwenty,19},{versionTwentyone,20},{versionTwentytwo,21},{versionTwentythree,22},{versionTwentyfour,23}], [<<3>>]), + +%%------------------------------------------------- +%% attribute cSTAFunctionsRequiredByApplication(2) External acse:CSTAFunctionality +%%------------------------------------------------- + {EncBytes2,EncLen2} = 'enc_CSTAFunctionality'(Cindex2, [<<48>>]), + +%%------------------------------------------------- +%% attribute cSTAFunctionsThatCanBeSupplied(3) External acse:CSTAFunctionality +%%------------------------------------------------- + {EncBytes3,EncLen3} = 'enc_CSTAFunctionality'(Cindex3, [<<48>>]), + + BytesSoFar = [EncBytes1, EncBytes2, EncBytes3], +LenSoFar = EncLen1 + EncLen2 + EncLen3, +encode_tags(TagIn, BytesSoFar, LenSoFar). + + +'dec_OldACSEUserInformationForCSTA'(Tlv) -> + 'dec_OldACSEUserInformationForCSTA'(Tlv, [16]). + +'dec_OldACSEUserInformationForCSTA'(Tlv, TagIn) -> + %%------------------------------------------------- + %% decode tag and length + %%------------------------------------------------- +Tlv1 = match_tags(Tlv, TagIn), + +%%------------------------------------------------- +%% attribute cSTAVersion(1) with type BIT STRING +%%------------------------------------------------- +[V1|Tlv2] = Tlv1, +Term1 = decode_named_bit_string(V1, [{versionOne,0},{versionTwo,1},{versionThree,2},{versionFour,3},{versionFive,4},{versionSix,5},{versionSeven,6},{versionEight,7},{versionNine,8},{versionTen,9},{versionEleven,10},{versionTwelve,11},{versionThirteen,12},{versionFourteen,13},{versionFifteen,14},{versionSixteen,15},{versionSeventeen,16},{versionEighteen,17},{versionNineteen,18},{versionTwenty,19},{versionTwentyone,20},{versionTwentytwo,21},{versionTwentythree,22},{versionTwentyfour,23}], [3]), + +%%------------------------------------------------- +%% attribute cSTAFunctionsRequiredByApplication(2) External acse:CSTAFunctionality +%%------------------------------------------------- +[V2|Tlv3] = Tlv2, +Term2 = 'dec_CSTAFunctionality'(V2, [16]), + +%%------------------------------------------------- +%% attribute cSTAFunctionsThatCanBeSupplied(3) External acse:CSTAFunctionality +%%------------------------------------------------- +[V3|Tlv4] = Tlv3, +Term3 = 'dec_CSTAFunctionality'(V3, [16]), + +case Tlv4 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowed +end, + {'OldACSEUserInformationForCSTA', Term1, Term2, Term3}. + + + +%%================================ +%% ACSEUserInformationForCSTA +%%================================ +'enc_ACSEUserInformationForCSTA'(Val) -> + 'enc_ACSEUserInformationForCSTA'(Val, []). + +'enc_ACSEUserInformationForCSTA'(Val, TagIn) -> + {EncBytes,EncLen} = case element(1,Val) of + oldDefinition -> + 'enc_OldACSEUserInformationForCSTA'(element(2,Val), [<<48>>]); + newDefinition -> + 'enc_NewACSEUserInformationForCSTA'(element(2,Val), [<<160>>]); + Else -> + exit({error,{asn1,{invalid_choice_type,Else}}}) + end, + +encode_tags(TagIn, EncBytes, EncLen). + + + + +'dec_ACSEUserInformationForCSTA'(Tlv) -> + 'dec_ACSEUserInformationForCSTA'(Tlv, []). + +'dec_ACSEUserInformationForCSTA'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of + +%% 'oldDefinition' + {16, V1} -> + {oldDefinition, 'dec_OldACSEUserInformationForCSTA'(V1, [])}; + + +%% 'newDefinition' + {131072, V1} -> + {newDefinition, 'dec_NewACSEUserInformationForCSTA'(V1, [])}; + + Else -> + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. + + +%%================================ +%% VoiceUnitServicesC2 +%%================================ +'enc_VoiceUnitServicesC2'(Val) -> + 'enc_VoiceUnitServicesC2'(Val, [<<3>>]). + +'enc_VoiceUnitServicesC2'(Val, TagIn) -> +encode_named_bit_string(Val, [{concatenateMessage,0},{deleteMessage,1},{playMessage,2},{queryVoiceAttribute,3},{recordMessage,4},{reposition,5},{resume,6},{review,7},{setVoiceAttribute,8},{stop,9},{suspend,10},{synthesizeMessage,11}], TagIn). + + +'dec_VoiceUnitServicesC2'(Tlv) -> + 'dec_VoiceUnitServicesC2'(Tlv, [3]). + +'dec_VoiceUnitServicesC2'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{concatenateMessage,0},{deleteMessage,1},{playMessage,2},{queryVoiceAttribute,3},{recordMessage,4},{reposition,5},{resume,6},{review,7},{setVoiceAttribute,8},{stop,9},{suspend,10},{synthesizeMessage,11}], TagIn). + + + +%%================================ +%% InputOutputServicesC2 +%%================================ +'enc_InputOutputServicesC2'(Val) -> + 'enc_InputOutputServicesC2'(Val, [<<3>>]). + +'enc_InputOutputServicesC2'(Val, TagIn) -> +encode_named_bit_string(Val, [{startDataPathService,0},{stopDataPathService,1},{sendDataService,2},{sendMulticastDataService,3},{sendBroadcastDataService,4},{suspendDataPathService,5},{dataPathSuspendedService,6},{resumeDataPath,7},{dataPathResumedService,8},{fastData,9}], TagIn). + + +'dec_InputOutputServicesC2'(Tlv) -> + 'dec_InputOutputServicesC2'(Tlv, [3]). + +'dec_InputOutputServicesC2'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{startDataPathService,0},{stopDataPathService,1},{sendDataService,2},{sendMulticastDataService,3},{sendBroadcastDataService,4},{suspendDataPathService,5},{dataPathSuspendedService,6},{resumeDataPath,7},{dataPathResumedService,8},{fastData,9}], TagIn). + + + +%%================================ +%% StatusReportingServicesC2 +%%================================ +'enc_StatusReportingServicesC2'(Val) -> + 'enc_StatusReportingServicesC2'(Val, [<<3>>]). + +'enc_StatusReportingServicesC2'(Val, TagIn) -> +encode_named_bit_string(Val, [{monitorStart,0},{changeMonitorFilter,1},{monitorStop,2},{snapshotDevice,3},{snapshotCall,4}], TagIn). + + +'dec_StatusReportingServicesC2'(Tlv) -> + 'dec_StatusReportingServicesC2'(Tlv, [3]). + +'dec_StatusReportingServicesC2'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{monitorStart,0},{changeMonitorFilter,1},{monitorStop,2},{snapshotDevice,3},{snapshotCall,4}], TagIn). + + + +%%================================ +%% BidirectionalServicesC2 +%%================================ +'enc_BidirectionalServicesC2'(Val) -> + 'enc_BidirectionalServicesC2'(Val, [<<3>>]). + +'enc_BidirectionalServicesC2'(Val, TagIn) -> +encode_named_bit_string(Val, [{escapeService,0},{systemStatus,1}], TagIn). + + +'dec_BidirectionalServicesC2'(Tlv) -> + 'dec_BidirectionalServicesC2'(Tlv, [3]). + +'dec_BidirectionalServicesC2'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{escapeService,0},{systemStatus,1}], TagIn). + + + +%%================================ +%% ComputingFunctionServicesC2 +%%================================ +'enc_ComputingFunctionServicesC2'(Val) -> + 'enc_ComputingFunctionServicesC2'(Val, [<<3>>]). + +'enc_ComputingFunctionServicesC2'(Val, TagIn) -> +encode_named_bit_string(Val, [{routeRequest,0},{reRouteRequest,1},{routeSelectRequest,2},{routeUsedRequest,3},{routeEndRequest,4}], TagIn). + + +'dec_ComputingFunctionServicesC2'(Tlv) -> + 'dec_ComputingFunctionServicesC2'(Tlv, [3]). + +'dec_ComputingFunctionServicesC2'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{routeRequest,0},{reRouteRequest,1},{routeSelectRequest,2},{routeUsedRequest,3},{routeEndRequest,4}], TagIn). + + + +%%================================ +%% EventReportServicesC2 +%%================================ +'enc_EventReportServicesC2'(Val) -> + 'enc_EventReportServicesC2'(Val, [<<3>>]). + +'enc_EventReportServicesC2'(Val, TagIn) -> +encode_named_bit_string(Val, [{callCleared,0},{conferenced,1},{connectionCleared,2},{delivered,3},{diverted,4},{established,5},{failed,6},{held,7},{networkReached,8},{originated,9},{queued,10},{retrieved,11},{serviceInitiated,12},{transferred,13},{autoAnswer,14},{callInformation,15},{doNotDisturb,16},{forwarding,17},{messageWaiting,18},{microphoneMute,19},{speakerMute,20},{speakerVolume,21},{agentBusy,22},{loggedOn,23},{loggedOff,24},{notReady,25},{ready,26},{workingAfterCall,27},{backInService,28},{outOfServiceEvent,29},{privateEvent,30},{playEvent,31},{recordEvent,32},{reviewEvent,33},{stopEvent,34},{suspendPlayEvent,35},{suspendRecordEvent,36},{voiceAttributesChangeEvent,37}], TagIn). + + +'dec_EventReportServicesC2'(Tlv) -> + 'dec_EventReportServicesC2'(Tlv, [3]). + +'dec_EventReportServicesC2'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{callCleared,0},{conferenced,1},{connectionCleared,2},{delivered,3},{diverted,4},{established,5},{failed,6},{held,7},{networkReached,8},{originated,9},{queued,10},{retrieved,11},{serviceInitiated,12},{transferred,13},{autoAnswer,14},{callInformation,15},{doNotDisturb,16},{forwarding,17},{messageWaiting,18},{microphoneMute,19},{speakerMute,20},{speakerVolume,21},{agentBusy,22},{loggedOn,23},{loggedOff,24},{notReady,25},{ready,26},{workingAfterCall,27},{backInService,28},{outOfServiceEvent,29},{privateEvent,30},{playEvent,31},{recordEvent,32},{reviewEvent,33},{stopEvent,34},{suspendPlayEvent,35},{suspendRecordEvent,36},{voiceAttributesChangeEvent,37}], TagIn). + + + +%%================================ +%% SwitchingFunctionServicesC2 +%%================================ +'enc_SwitchingFunctionServicesC2'(Val) -> + 'enc_SwitchingFunctionServicesC2'(Val, [<<3>>]). + +'enc_SwitchingFunctionServicesC2'(Val, TagIn) -> +encode_named_bit_string(Val, [{alternateCall,0},{answerCall,1},{associateData,2},{callCompletion,3},{clearCall,4},{clearConnection,5},{conferenceCall,6},{consultationCall,7},{divertCall,8},{holdCall,9},{makeCall,10},{makePredictiveCall,11},{parkCall,12},{queryDevice,13},{reconnectCall,14},{retrieveCall,15},{sendDTMFTones,16},{setFeature,17},{singleStepConference,18},{singleStepTransfer,19},{transferCall,20}], TagIn). + + +'dec_SwitchingFunctionServicesC2'(Tlv) -> + 'dec_SwitchingFunctionServicesC2'(Tlv, [3]). + +'dec_SwitchingFunctionServicesC2'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{alternateCall,0},{answerCall,1},{associateData,2},{callCompletion,3},{clearCall,4},{clearConnection,5},{conferenceCall,6},{consultationCall,7},{divertCall,8},{holdCall,9},{makeCall,10},{makePredictiveCall,11},{parkCall,12},{queryDevice,13},{reconnectCall,14},{retrieveCall,15},{sendDTMFTones,16},{setFeature,17},{singleStepConference,18},{singleStepTransfer,19},{transferCall,20}], TagIn). + + + +%%================================ +%% CSTAFunctionality +%%================================ +'enc_CSTAFunctionality'(Val) -> + 'enc_CSTAFunctionality'(Val, [<<48>>]). + +'enc_CSTAFunctionality'(Val, TagIn) -> +{_,Cindex1, Cindex2, Cindex3, Cindex4, Cindex5, Cindex6, Cindex7} = Val, + +%%------------------------------------------------- +%% attribute switchingFunctionServices(1) with type BIT STRING DEFAULT = [] +%%------------------------------------------------- + {EncBytes1,EncLen1} = case Cindex1 of + asn1_DEFAULT -> {<<>>,0}; + [] -> {<<>>,0}; + _ -> + encode_named_bit_string(Cindex1, [{alternateCall,0},{answerCall,1},{associateData,2},{callCompletion,3},{clearCall,4},{clearConnection,5},{conferenceCall,6},{consultationCall,7},{divertCall,8},{holdCall,9},{makeCall,10},{makePredictiveCall,11},{parkCall,12},{queryDevice,13},{reconnectCall,14},{retrieveCall,15},{sendDTMFTones,16},{setFeature,17},{singleStepConference,18},{singleStepTransfer,19},{transferCall,20}], [<<128>>]) + end, + +%%------------------------------------------------- +%% attribute eventReportServices(2) with type BIT STRING DEFAULT = [] +%%------------------------------------------------- + {EncBytes2,EncLen2} = case Cindex2 of + asn1_DEFAULT -> {<<>>,0}; + [] -> {<<>>,0}; + _ -> + encode_named_bit_string(Cindex2, [{callCleared,0},{conferenced,1},{connectionCleared,2},{delivered,3},{diverted,4},{established,5},{failed,6},{held,7},{networkReached,8},{originated,9},{queued,10},{retrieved,11},{serviceInitiated,12},{transferred,13},{autoAnswer,14},{callInformation,15},{doNotDisturb,16},{forwarding,17},{messageWaiting,18},{microphoneMute,19},{speakerMute,20},{speakerVolume,21},{agentBusy,22},{loggedOn,23},{loggedOff,24},{notReady,25},{ready,26},{workingAfterCall,27},{backInService,28},{outOfServiceEvent,29},{privateEvent,30},{playEvent,31},{recordEvent,32},{reviewEvent,33},{stopEvent,34},{suspendPlayEvent,35},{suspendRecordEvent,36},{voiceAttributesChangeEvent,37}], [<<129>>]) + end, + +%%------------------------------------------------- +%% attribute computingFunctionServices(3) with type BIT STRING DEFAULT = [] +%%------------------------------------------------- + {EncBytes3,EncLen3} = case Cindex3 of + asn1_DEFAULT -> {<<>>,0}; + [] -> {<<>>,0}; + _ -> + encode_named_bit_string(Cindex3, [{routeRequest,0},{reRouteRequest,1},{routeSelectRequest,2},{routeUsedRequest,3},{routeEndRequest,4}], [<<130>>]) + end, + +%%------------------------------------------------- +%% attribute bidirectionalServices(4) with type BIT STRING DEFAULT = [] +%%------------------------------------------------- + {EncBytes4,EncLen4} = case Cindex4 of + asn1_DEFAULT -> {<<>>,0}; + [] -> {<<>>,0}; + _ -> + encode_named_bit_string(Cindex4, [{escapeService,0},{systemStatus,1}], [<<131>>]) + end, + +%%------------------------------------------------- +%% attribute statusReportingServices(5) with type BIT STRING DEFAULT = [] +%%------------------------------------------------- + {EncBytes5,EncLen5} = case Cindex5 of + asn1_DEFAULT -> {<<>>,0}; + [] -> {<<>>,0}; + _ -> + encode_named_bit_string(Cindex5, [{monitorStart,0},{changeMonitorFilter,1},{monitorStop,2},{snapshotDevice,3},{snapshotCall,4}], [<<132>>]) + end, + +%%------------------------------------------------- +%% attribute inputOutputServices(6) with type BIT STRING DEFAULT = [] +%%------------------------------------------------- + {EncBytes6,EncLen6} = case Cindex6 of + asn1_DEFAULT -> {<<>>,0}; + [] -> {<<>>,0}; + _ -> + encode_named_bit_string(Cindex6, [{startDataPathService,0},{stopDataPathService,1},{sendDataService,2},{sendMulticastDataService,3},{sendBroadcastDataService,4},{suspendDataPathService,5},{dataPathSuspendedService,6},{resumeDataPath,7},{dataPathResumedService,8},{fastData,9}], [<<133>>]) + end, + +%%------------------------------------------------- +%% attribute voiceUnitServices(7) with type BIT STRING DEFAULT = [] +%%------------------------------------------------- + {EncBytes7,EncLen7} = case Cindex7 of + asn1_DEFAULT -> {<<>>,0}; + [] -> {<<>>,0}; + _ -> + encode_named_bit_string(Cindex7, [{concatenateMessage,0},{deleteMessage,1},{playMessage,2},{queryVoiceAttribute,3},{recordMessage,4},{reposition,5},{resume,6},{review,7},{setVoiceAttribute,8},{stop,9},{suspend,10},{synthesizeMessage,11}], [<<134>>]) + end, + + BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4, EncBytes5, EncBytes6, EncBytes7], +LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5 + EncLen6 + EncLen7, +encode_tags(TagIn, BytesSoFar, LenSoFar). + + +'dec_CSTAFunctionality'(Tlv) -> + 'dec_CSTAFunctionality'(Tlv, [16]). + +'dec_CSTAFunctionality'(Tlv, TagIn) -> + %%------------------------------------------------- + %% decode tag and length + %%------------------------------------------------- +Tlv1 = match_tags(Tlv, TagIn), + +%%------------------------------------------------- +%% attribute switchingFunctionServices(1) with type BIT STRING DEFAULT = [] +%%------------------------------------------------- +{Term1,Tlv2} = case Tlv1 of +[{131072,V1}|TempTlv2] -> + {decode_named_bit_string(V1, [{alternateCall,0},{answerCall,1},{associateData,2},{callCompletion,3},{clearCall,4},{clearConnection,5},{conferenceCall,6},{consultationCall,7},{divertCall,8},{holdCall,9},{makeCall,10},{makePredictiveCall,11},{parkCall,12},{queryDevice,13},{reconnectCall,14},{retrieveCall,15},{sendDTMFTones,16},{setFeature,17},{singleStepConference,18},{singleStepTransfer,19},{transferCall,20}], []), TempTlv2}; + _ -> + {[],Tlv1} +end, + +%%------------------------------------------------- +%% attribute eventReportServices(2) with type BIT STRING DEFAULT = [] +%%------------------------------------------------- +{Term2,Tlv3} = case Tlv2 of +[{131073,V2}|TempTlv3] -> + {decode_named_bit_string(V2, [{callCleared,0},{conferenced,1},{connectionCleared,2},{delivered,3},{diverted,4},{established,5},{failed,6},{held,7},{networkReached,8},{originated,9},{queued,10},{retrieved,11},{serviceInitiated,12},{transferred,13},{autoAnswer,14},{callInformation,15},{doNotDisturb,16},{forwarding,17},{messageWaiting,18},{microphoneMute,19},{speakerMute,20},{speakerVolume,21},{agentBusy,22},{loggedOn,23},{loggedOff,24},{notReady,25},{ready,26},{workingAfterCall,27},{backInService,28},{outOfServiceEvent,29},{privateEvent,30},{playEvent,31},{recordEvent,32},{reviewEvent,33},{stopEvent,34},{suspendPlayEvent,35},{suspendRecordEvent,36},{voiceAttributesChangeEvent,37}], []), TempTlv3}; + _ -> + {[],Tlv2} +end, + +%%------------------------------------------------- +%% attribute computingFunctionServices(3) with type BIT STRING DEFAULT = [] +%%------------------------------------------------- +{Term3,Tlv4} = case Tlv3 of +[{131074,V3}|TempTlv4] -> + {decode_named_bit_string(V3, [{routeRequest,0},{reRouteRequest,1},{routeSelectRequest,2},{routeUsedRequest,3},{routeEndRequest,4}], []), TempTlv4}; + _ -> + {[],Tlv3} +end, + +%%------------------------------------------------- +%% attribute bidirectionalServices(4) with type BIT STRING DEFAULT = [] +%%------------------------------------------------- +{Term4,Tlv5} = case Tlv4 of +[{131075,V4}|TempTlv5] -> + {decode_named_bit_string(V4, [{escapeService,0},{systemStatus,1}], []), TempTlv5}; + _ -> + {[],Tlv4} +end, + +%%------------------------------------------------- +%% attribute statusReportingServices(5) with type BIT STRING DEFAULT = [] +%%------------------------------------------------- +{Term5,Tlv6} = case Tlv5 of +[{131076,V5}|TempTlv6] -> + {decode_named_bit_string(V5, [{monitorStart,0},{changeMonitorFilter,1},{monitorStop,2},{snapshotDevice,3},{snapshotCall,4}], []), TempTlv6}; + _ -> + {[],Tlv5} +end, + +%%------------------------------------------------- +%% attribute inputOutputServices(6) with type BIT STRING DEFAULT = [] +%%------------------------------------------------- +{Term6,Tlv7} = case Tlv6 of +[{131077,V6}|TempTlv7] -> + {decode_named_bit_string(V6, [{startDataPathService,0},{stopDataPathService,1},{sendDataService,2},{sendMulticastDataService,3},{sendBroadcastDataService,4},{suspendDataPathService,5},{dataPathSuspendedService,6},{resumeDataPath,7},{dataPathResumedService,8},{fastData,9}], []), TempTlv7}; + _ -> + {[],Tlv6} +end, + +%%------------------------------------------------- +%% attribute voiceUnitServices(7) with type BIT STRING DEFAULT = [] +%%------------------------------------------------- +{Term7,Tlv8} = case Tlv7 of +[{131078,V7}|TempTlv8] -> + {decode_named_bit_string(V7, [{concatenateMessage,0},{deleteMessage,1},{playMessage,2},{queryVoiceAttribute,3},{recordMessage,4},{reposition,5},{resume,6},{review,7},{setVoiceAttribute,8},{stop,9},{suspend,10},{synthesizeMessage,11}], []), TempTlv8}; + _ -> + {[],Tlv7} +end, + +case Tlv8 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv8}}}) % extra fields not allowed +end, + {'CSTAFunctionality', Term1, Term2, Term3, Term4, Term5, Term6, Term7}. + + + +%%================================ +%% Release-response-reason +%%================================ +'enc_Release-response-reason'(Val) -> + 'enc_Release-response-reason'(Val, [<<2>>]). + +'enc_Release-response-reason'(Val, TagIn) -> +encode_integer(Val, [{normal,0},{'not-finished',1},{'user-defined',30}], TagIn). + + +'dec_Release-response-reason'(Tlv) -> + 'dec_Release-response-reason'(Tlv, [2]). + +'dec_Release-response-reason'(Tlv, TagIn) -> +begin +Val1 = decode_integer(Tlv, TagIn), +number2name(Val1, [{normal,0},{'not-finished',1},{'user-defined',30}]) +end +. + + + +%%================================ +%% Release-request-reason +%%================================ +'enc_Release-request-reason'(Val) -> + 'enc_Release-request-reason'(Val, [<<2>>]). + +'enc_Release-request-reason'(Val, TagIn) -> +encode_integer(Val, [{normal,0},{urgent,1},{'user-defined',30}], TagIn). + + +'dec_Release-request-reason'(Tlv) -> + 'dec_Release-request-reason'(Tlv, [2]). + +'dec_Release-request-reason'(Tlv, TagIn) -> +begin +Val1 = decode_integer(Tlv, TagIn), +number2name(Val1, [{normal,0},{urgent,1},{'user-defined',30}]) +end +. + + + +%%================================ +%% Mechanism-name +%%================================ +'enc_Mechanism-name'(Val) -> + 'enc_Mechanism-name'(Val, [<<6>>]). + +'enc_Mechanism-name'(Val, TagIn) -> +encode_object_identifier(Val, TagIn). + + +'dec_Mechanism-name'(Tlv) -> + 'dec_Mechanism-name'(Tlv, [6]). + +'dec_Mechanism-name'(Tlv, TagIn) -> +decode_object_identifier(Tlv, TagIn). + + + +%%================================ +%% Implementation-data +%%================================ +'enc_Implementation-data'(Val) -> + 'enc_Implementation-data'(Val, [<<25>>]). + +'enc_Implementation-data'(Val, TagIn) -> +encode_restricted_string(Val, TagIn). + + +'dec_Implementation-data'(Tlv) -> + 'dec_Implementation-data'(Tlv, [25]). + +'dec_Implementation-data'(Tlv, TagIn) -> +begin +binary_to_list(decode_restricted_string(Tlv, TagIn)) +end +. + + + +%%================================ +%% Authentication-value +%%================================ +'enc_Authentication-value'(Val) -> + 'enc_Authentication-value'(Val, []). + +'enc_Authentication-value'(Val, TagIn) -> + {EncBytes,EncLen} = case element(1,Val) of + charstring -> + encode_restricted_string(element(2,Val), [<<128>>]); + bitstring -> + encode_unnamed_bit_string(element(2,Val), [<<129>>]); + external -> + 'enc_EXTERNAL'(element(2,Val), [<<162>>]); + other -> + 'enc_Authentication-value_other'(element(2,Val), [<<163>>]); + Else -> + exit({error,{asn1,{invalid_choice_type,Else}}}) + end, + +encode_tags(TagIn, EncBytes, EncLen). + + + + + +%%================================ +%% Authentication-value_other +%%================================ +'enc_Authentication-value_other'(Val, TagIn) -> + {_,Cindex1, Cindex2} = Val, +Objother_mechanism_name = + acse:'getenc_ObjectSet'( Cindex1), + +%%------------------------------------------------- +%% attribute other-mechanism-name(1) with type OBJECT IDENTIFIER +%%------------------------------------------------- + {EncBytes1,EncLen1} = encode_object_identifier(Cindex1, [<<6>>]), + +%%------------------------------------------------- +%% attribute other-mechanism-value(2) with type typefieldType +%%------------------------------------------------- + {TmpBytes2,_} = Objother_mechanism_name('Type', Cindex2, []), + {EncBytes2,EncLen2} = encode_open_type(TmpBytes2, []) +, + + BytesSoFar = [EncBytes1, EncBytes2], +LenSoFar = EncLen1 + EncLen2, +encode_tags(TagIn, BytesSoFar, LenSoFar). + + +'dec_Authentication-value'(Tlv) -> + 'dec_Authentication-value'(Tlv, []). + +'dec_Authentication-value'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of + +%% 'charstring' + {131072, V1} -> + {charstring, begin +binary_to_list(decode_restricted_string(V1, [])) +end +}; + + +%% 'bitstring' + {131073, V1} -> + {bitstring, decode_native_bit_string(V1, [])}; + + +%% 'external' + {131074, V1} -> + {external, 'dec_EXTERNAL'(V1, [])}; + + +%% 'other' + {131075, V1} -> + {other, 'dec_Authentication-value_other'(V1, [])}; + + Else -> + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. +'dec_Authentication-value_other'(Tlv, TagIn) -> + %%------------------------------------------------- + %% decode tag and length + %%------------------------------------------------- +Tlv1 = match_tags(Tlv, TagIn), + +%%------------------------------------------------- +%% attribute other-mechanism-name(1) with type OBJECT IDENTIFIER +%%------------------------------------------------- +[V1|Tlv2] = Tlv1, +Term1 = decode_object_identifier(V1, [6]), + +%%------------------------------------------------- +%% attribute other-mechanism-value(2) with type typefieldType +%%------------------------------------------------- +[V2|Tlv3] = Tlv2, + + Tmpterm1 = decode_open_type(V2, []), + +DecObjother_mechanism_nameTerm1 = + acse:'getdec_ObjectSet'(Term1), +Term2 = + case (catch DecObjother_mechanism_nameTerm1('Type', 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, + {'Authentication-value_other', Term1, Term2}. + + + +%%================================ +%% Association-information +%%================================ +'enc_Association-information'(Val) -> + 'enc_Association-information'(Val, [<<48>>]). + +'enc_Association-information'(Val, TagIn) -> + {EncBytes,EncLen} = 'enc_Association-information_components'(Val,[],0), + encode_tags(TagIn, 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, [<<40>>]), + 'enc_Association-information_components'(T,[EncBytes|AccBytes], AccLen + EncLen). + + + +'dec_Association-information'(Tlv) -> + 'dec_Association-information'(Tlv, [16]). + +'dec_Association-information'(Tlv, TagIn) -> + %%------------------------------------------------- + %% decode tag and length + %%------------------------------------------------- +Tlv1 = match_tags(Tlv, TagIn), +['dec_EXTERNAL'(V1, [8]) || V1 <- Tlv1]. + + + + +%%================================ +%% Associate-source-diagnostic +%%================================ +'enc_Associate-source-diagnostic'(Val) -> + 'enc_Associate-source-diagnostic'(Val, []). + +'enc_Associate-source-diagnostic'(Val, TagIn) -> + {EncBytes,EncLen} = case element(1,Val) of + 'acse-service-user' -> + 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}], [<<2>>,<<161>>]); + 'acse-service-provider' -> + encode_integer(element(2,Val), [{null,0},{'no-reason-given',1},{'no-common-acse-version',2}], [<<2>>,<<162>>]); + Else -> + exit({error,{asn1,{invalid_choice_type,Else}}}) + end, + +encode_tags(TagIn, EncBytes, EncLen). + + + + +'dec_Associate-source-diagnostic'(Tlv) -> + 'dec_Associate-source-diagnostic'(Tlv, []). + +'dec_Associate-source-diagnostic'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of + +%% 'acse-service-user' + {131073, V1} -> + {'acse-service-user', begin +Val1 = decode_integer(V1, [2]), +number2name(Val1, [{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}]) +end +}; + + +%% 'acse-service-provider' + {131074, V1} -> + {'acse-service-provider', begin +Val2 = decode_integer(V1, [2]), +number2name(Val2, [{null,0},{'no-reason-given',1},{'no-common-acse-version',2}]) +end +}; + + Else -> + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. + + +%%================================ +%% Associate-result +%%================================ +'enc_Associate-result'(Val) -> + 'enc_Associate-result'(Val, [<<2>>]). + +'enc_Associate-result'(Val, TagIn) -> +encode_integer(Val, [{accepted,0},{'rejected-permanent',1},{'rejected-transient',2}], TagIn). + + +'dec_Associate-result'(Tlv) -> + 'dec_Associate-result'(Tlv, [2]). + +'dec_Associate-result'(Tlv, TagIn) -> +begin +Val1 = decode_integer(Tlv, TagIn), +number2name(Val1, [{accepted,0},{'rejected-permanent',1},{'rejected-transient',2}]) +end +. + + + +%%================================ +%% AP-invocation-identifier +%%================================ +'enc_AP-invocation-identifier'(Val) -> + 'enc_AP-invocation-identifier'(Val, [<<2>>]). + +'enc_AP-invocation-identifier'(Val, TagIn) -> +encode_integer(Val, TagIn). + + +'dec_AP-invocation-identifier'(Tlv) -> + 'dec_AP-invocation-identifier'(Tlv, [2]). + +'dec_AP-invocation-identifier'(Tlv, TagIn) -> +decode_integer(Tlv, TagIn). + + + +%%================================ +%% AE-invocation-identifier +%%================================ +'enc_AE-invocation-identifier'(Val) -> + 'enc_AE-invocation-identifier'(Val, [<<2>>]). + +'enc_AE-invocation-identifier'(Val, TagIn) -> +encode_integer(Val, TagIn). + + +'dec_AE-invocation-identifier'(Tlv) -> + 'dec_AE-invocation-identifier'(Tlv, [2]). + +'dec_AE-invocation-identifier'(Tlv, TagIn) -> +decode_integer(Tlv, TagIn). + + + +%%================================ +%% AE-title-form2 +%%================================ +'enc_AE-title-form2'(Val) -> + 'enc_AE-title-form2'(Val, [<<6>>]). + +'enc_AE-title-form2'(Val, TagIn) -> +encode_object_identifier(Val, TagIn). + + +'dec_AE-title-form2'(Tlv) -> + 'dec_AE-title-form2'(Tlv, [6]). + +'dec_AE-title-form2'(Tlv, TagIn) -> +decode_object_identifier(Tlv, TagIn). + + + +%%================================ +%% AE-title-form1 +%%================================ +'enc_AE-title-form1'(Val) -> + 'enc_AE-title-form1'(Val, []). + +'enc_AE-title-form1'(Val, TagIn) -> + 'InformationFramework':'enc_Name'(Val, TagIn). + + +'dec_AE-title-form1'(Tlv) -> + 'dec_AE-title-form1'(Tlv, []). + +'dec_AE-title-form1'(Tlv, TagIn) -> +'InformationFramework':'dec_Name'(Tlv, TagIn). + + + +%%================================ +%% AE-title +%%================================ +'enc_AE-title'(Val) -> + 'enc_AE-title'(Val, []). + +'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' -> + encode_object_identifier(element(2,Val), [<<6>>]); + Else -> + exit({error,{asn1,{invalid_choice_type,Else}}}) + end, + +encode_tags(TagIn, EncBytes, EncLen). + + + + +'dec_AE-title'(Tlv) -> + 'dec_AE-title'(Tlv, []). + +'dec_AE-title'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of + +%% 'ae-title-form1' + V1 = {16,_} -> + {'ae-title-form1', 'dec_AE-title-form1'(V1, [])}; + + +%% 'ae-title-form2' + {6, V1} -> + {'ae-title-form2', decode_object_identifier(V1, [])}; + + Else -> + {asn1_ExtAlt,ber_encode(Else)} + end +. + + +%%================================ +%% AE-qualifier-form2 +%%================================ +'enc_AE-qualifier-form2'(Val) -> + 'enc_AE-qualifier-form2'(Val, [<<2>>]). + +'enc_AE-qualifier-form2'(Val, TagIn) -> +encode_integer(Val, TagIn). + + +'dec_AE-qualifier-form2'(Tlv) -> + 'dec_AE-qualifier-form2'(Tlv, [2]). + +'dec_AE-qualifier-form2'(Tlv, TagIn) -> +decode_integer(Tlv, TagIn). + + + +%%================================ +%% AP-title-form2 +%%================================ +'enc_AP-title-form2'(Val) -> + 'enc_AP-title-form2'(Val, [<<6>>]). + +'enc_AP-title-form2'(Val, TagIn) -> +encode_object_identifier(Val, TagIn). + + +'dec_AP-title-form2'(Tlv) -> + 'dec_AP-title-form2'(Tlv, [6]). + +'dec_AP-title-form2'(Tlv, TagIn) -> +decode_object_identifier(Tlv, TagIn). + + + +%%================================ +%% AE-qualifier-form1 +%%================================ +'enc_AE-qualifier-form1'(Val) -> + 'enc_AE-qualifier-form1'(Val, [<<49>>]). + +'enc_AE-qualifier-form1'(Val, TagIn) -> + 'InformationFramework':'enc_RelativeDistinguishedName'(Val, TagIn). + + +'dec_AE-qualifier-form1'(Tlv) -> + 'dec_AE-qualifier-form1'(Tlv, [17]). + +'dec_AE-qualifier-form1'(Tlv, TagIn) -> +'InformationFramework':'dec_RelativeDistinguishedName'(Tlv, TagIn). + + + +%%================================ +%% AP-title-form1 +%%================================ +'enc_AP-title-form1'(Val) -> + 'enc_AP-title-form1'(Val, []). + +'enc_AP-title-form1'(Val, TagIn) -> + 'InformationFramework':'enc_Name'(Val, TagIn). + + +'dec_AP-title-form1'(Tlv) -> + 'dec_AP-title-form1'(Tlv, []). + +'dec_AP-title-form1'(Tlv, TagIn) -> +'InformationFramework':'dec_Name'(Tlv, TagIn). + + + +%%================================ +%% AE-qualifier +%%================================ +'enc_AE-qualifier'(Val) -> + 'enc_AE-qualifier'(Val, []). + +'enc_AE-qualifier'(Val, TagIn) -> + {EncBytes,EncLen} = case element(1,Val) of + 'ae-qualifier-form1' -> + 'enc_AE-qualifier-form1'(element(2,Val), [<<49>>]); + 'ae-qualifier-form2' -> + encode_integer(element(2,Val), [<<2>>]); + Else -> + exit({error,{asn1,{invalid_choice_type,Else}}}) + end, + +encode_tags(TagIn, EncBytes, EncLen). + + + + +'dec_AE-qualifier'(Tlv) -> + 'dec_AE-qualifier'(Tlv, []). + +'dec_AE-qualifier'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of + +%% 'ae-qualifier-form1' + {17, V1} -> + {'ae-qualifier-form1', 'dec_AE-qualifier-form1'(V1, [])}; + + +%% 'ae-qualifier-form2' + {2, V1} -> + {'ae-qualifier-form2', decode_integer(V1, [])}; + + Else -> + {asn1_ExtAlt,ber_encode(Else)} + end +. + + +%%================================ +%% AP-title +%%================================ +'enc_AP-title'(Val) -> + 'enc_AP-title'(Val, []). + +'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' -> + encode_object_identifier(element(2,Val), [<<6>>]); + Else -> + exit({error,{asn1,{invalid_choice_type,Else}}}) + end, + +encode_tags(TagIn, EncBytes, EncLen). + + + + +'dec_AP-title'(Tlv) -> + 'dec_AP-title'(Tlv, []). + +'dec_AP-title'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of + +%% 'ap-title-form1' + V1 = {16,_} -> + {'ap-title-form1', 'dec_AP-title-form1'(V1, [])}; + + +%% 'ap-title-form2' + {6, V1} -> + {'ap-title-form2', decode_object_identifier(V1, [])}; + + Else -> + {asn1_ExtAlt,ber_encode(Else)} + end +. + + +%%================================ +%% Application-context-name +%%================================ +'enc_Application-context-name'(Val) -> + 'enc_Application-context-name'(Val, [<<6>>]). + +'enc_Application-context-name'(Val, TagIn) -> +encode_object_identifier(Val, TagIn). + + +'dec_Application-context-name'(Tlv) -> + 'dec_Application-context-name'(Tlv, [6]). + +'dec_Application-context-name'(Tlv, TagIn) -> +decode_object_identifier(Tlv, TagIn). + + + +%%================================ +%% Application-context-name-list +%%================================ +'enc_Application-context-name-list'(Val) -> + 'enc_Application-context-name-list'(Val, [<<48>>]). + +'enc_Application-context-name-list'(Val, TagIn) -> + {EncBytes,EncLen} = 'enc_Application-context-name-list_components'(Val,[],0), + encode_tags(TagIn, 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} = encode_object_identifier(H, [<<6>>]), + 'enc_Application-context-name-list_components'(T,[EncBytes|AccBytes], AccLen + EncLen). + + + +'dec_Application-context-name-list'(Tlv) -> + 'dec_Application-context-name-list'(Tlv, [16]). + +'dec_Application-context-name-list'(Tlv, TagIn) -> + %%------------------------------------------------- + %% decode tag and length + %%------------------------------------------------- +Tlv1 = match_tags(Tlv, TagIn), +[decode_object_identifier(V1, [6]) || V1 <- Tlv1]. + + + + +%%================================ +%% ACSE-requirements +%%================================ +'enc_ACSE-requirements'(Val) -> + 'enc_ACSE-requirements'(Val, [<<3>>]). + +'enc_ACSE-requirements'(Val, TagIn) -> +encode_named_bit_string(Val, [{authentication,0},{'application-context-negotiation',1}], TagIn). + + +'dec_ACSE-requirements'(Tlv) -> + 'dec_ACSE-requirements'(Tlv, [3]). + +'dec_ACSE-requirements'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{authentication,0},{'application-context-negotiation',1}], TagIn). + + + +%%================================ +%% ABRT-source +%%================================ +'enc_ABRT-source'(Val) -> + 'enc_ABRT-source'(Val, [<<2>>]). + +'enc_ABRT-source'(Val, TagIn) -> +encode_integer(Val, [{'acse-service-user',0},{'acse-service-provider',1}], TagIn). + + +'dec_ABRT-source'(Tlv) -> + 'dec_ABRT-source'(Tlv, [2]). + +'dec_ABRT-source'(Tlv, TagIn) -> +begin +Val1 = decode_integer(Tlv, TagIn), +number2name(Val1, [{'acse-service-user',0},{'acse-service-provider',1}]) +end +. + + + +%%================================ +%% ABRT-diagnostic +%%================================ +'enc_ABRT-diagnostic'(Val) -> + 'enc_ABRT-diagnostic'(Val, [<<10>>]). + +'enc_ABRT-diagnostic'(Val, TagIn) -> +case Val of +'no-reason-given' -> encode_tags(TagIn, [1], 1); +'protocol-error' -> encode_tags(TagIn, [2], 1); +'authentication-mechanism-name-not-recognized' -> encode_tags(TagIn, [3], 1); +'authentication-mechanism-name-required' -> encode_tags(TagIn, [4], 1); +'authentication-failure' -> encode_tags(TagIn, [5], 1); +'authentication-required' -> encode_tags(TagIn, [6], 1); +Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}}) +end. + + +'dec_ABRT-diagnostic'(Tlv) -> + 'dec_ABRT-diagnostic'(Tlv, [10]). + +'dec_ABRT-diagnostic'(Tlv, TagIn) -> +case decode_integer(Tlv, TagIn) of +1 -> 'no-reason-given'; +2 -> 'protocol-error'; +3 -> 'authentication-mechanism-name-not-recognized'; +4 -> 'authentication-mechanism-name-required'; +5 -> 'authentication-failure'; +6 -> 'authentication-required'; +Default1 -> {asn1_enum,Default1} +end. + + + +%%================================ +%% ABRT-apdu +%%================================ +'enc_ABRT-apdu'(Val) -> + 'enc_ABRT-apdu'(Val, [<<100>>]). + +'enc_ABRT-apdu'(Val, TagIn) -> +{_,Cindex1, Cindex2, Cindex3} = Val, + +%%------------------------------------------------- +%% attribute abort-source(1) with type INTEGER +%%------------------------------------------------- + {EncBytes1,EncLen1} = encode_integer(Cindex1, [{'acse-service-user',0},{'acse-service-provider',1}], [<<128>>]), + +%%------------------------------------------------- +%% attribute abort-diagnostic(2) with type ENUMERATED OPTIONAL +%%------------------------------------------------- + {EncBytes2,EncLen2} = case Cindex2 of + asn1_NOVALUE -> {<<>>,0}; + _ -> + case Cindex2 of +'no-reason-given' -> encode_tags([<<129>>], [1], 1); +'protocol-error' -> encode_tags([<<129>>], [2], 1); +'authentication-mechanism-name-not-recognized' -> encode_tags([<<129>>], [3], 1); +'authentication-mechanism-name-required' -> encode_tags([<<129>>], [4], 1); +'authentication-failure' -> encode_tags([<<129>>], [5], 1); +'authentication-required' -> encode_tags([<<129>>], [6], 1); +Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}}) +end + end, + +%%------------------------------------------------- +%% attribute user-information(3) External acse:Association-information OPTIONAL +%%------------------------------------------------- + {EncBytes3,EncLen3} = case Cindex3 of + asn1_NOVALUE -> {<<>>,0}; + _ -> + 'enc_Association-information'(Cindex3, [<<190>>]) + end, + + BytesSoFar = [EncBytes1, EncBytes2, EncBytes3], +LenSoFar = EncLen1 + EncLen2 + EncLen3, +encode_tags(TagIn, BytesSoFar, LenSoFar). + + +'dec_ABRT-apdu'(Tlv) -> + 'dec_ABRT-apdu'(Tlv, [65540]). + +'dec_ABRT-apdu'(Tlv, TagIn) -> + %%------------------------------------------------- + %% decode tag and length + %%------------------------------------------------- +Tlv1 = match_tags(Tlv, TagIn), + +%%------------------------------------------------- +%% attribute abort-source(1) with type INTEGER +%%------------------------------------------------- +[V1|Tlv2] = Tlv1, +Term1 = begin +Val1 = decode_integer(V1, [131072]), +number2name(Val1, [{'acse-service-user',0},{'acse-service-provider',1}]) +end +, + +%%------------------------------------------------- +%% attribute abort-diagnostic(2) with type ENUMERATED OPTIONAL +%%------------------------------------------------- +{Term2,Tlv3} = case Tlv2 of +[{131073,V2}|TempTlv3] -> + {case decode_integer(V2, []) of +1 -> 'no-reason-given'; +2 -> 'protocol-error'; +3 -> 'authentication-mechanism-name-not-recognized'; +4 -> 'authentication-mechanism-name-required'; +5 -> 'authentication-failure'; +6 -> 'authentication-required'; +Default1 -> {asn1_enum,Default1} +end, TempTlv3}; + _ -> + { asn1_NOVALUE, Tlv2} +end, +Tlv4 = skip_ExtensionAdditions(Tlv3, [131102]), + +%%------------------------------------------------- +%% attribute user-information(2) External acse:Association-information OPTIONAL +%%------------------------------------------------- +{Term3,Tlv5} = case Tlv4 of +[{131102,V3}|TempTlv5] -> + {'dec_Association-information'(V3, []), TempTlv5}; + _ -> + { asn1_NOVALUE, Tlv4} +end, + +case Tlv5 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv5}}}) % extra fields not allowed +end, + {'ABRT-apdu', Term1, Term2, Term3}. + + + +%%================================ +%% RLRE-apdu +%%================================ +'enc_RLRE-apdu'(Val) -> + 'enc_RLRE-apdu'(Val, [<<99>>]). + +'enc_RLRE-apdu'(Val, TagIn) -> +{_,Cindex1, Cindex2} = Val, + +%%------------------------------------------------- +%% attribute reason(1) with type INTEGER OPTIONAL +%%------------------------------------------------- + {EncBytes1,EncLen1} = case Cindex1 of + asn1_NOVALUE -> {<<>>,0}; + _ -> + encode_integer(Cindex1, [{normal,0},{'not-finished',1},{'user-defined',30}], [<<128>>]) + end, + +%%------------------------------------------------- +%% attribute user-information(2) External acse:Association-information OPTIONAL +%%------------------------------------------------- + {EncBytes2,EncLen2} = case Cindex2 of + asn1_NOVALUE -> {<<>>,0}; + _ -> + 'enc_Association-information'(Cindex2, [<<190>>]) + end, + + BytesSoFar = [EncBytes1, EncBytes2], +LenSoFar = EncLen1 + EncLen2, +encode_tags(TagIn, BytesSoFar, LenSoFar). + + +'dec_RLRE-apdu'(Tlv) -> + 'dec_RLRE-apdu'(Tlv, [65539]). + +'dec_RLRE-apdu'(Tlv, TagIn) -> + %%------------------------------------------------- + %% decode tag and length + %%------------------------------------------------- +Tlv1 = match_tags(Tlv, TagIn), + +%%------------------------------------------------- +%% attribute reason(1) with type INTEGER OPTIONAL +%%------------------------------------------------- +{Term1,Tlv2} = case Tlv1 of +[{131072,V1}|TempTlv2] -> + {begin +Val1 = decode_integer(V1, []), +number2name(Val1, [{normal,0},{'not-finished',1},{'user-defined',30}]) +end +, TempTlv2}; + _ -> + { asn1_NOVALUE, Tlv1} +end, +Tlv3 = skip_ExtensionAdditions(Tlv2, [131102]), + +%%------------------------------------------------- +%% attribute user-information(1) External acse:Association-information OPTIONAL +%%------------------------------------------------- +{Term2,Tlv4} = case Tlv3 of +[{131102,V2}|TempTlv4] -> + {'dec_Association-information'(V2, []), TempTlv4}; + _ -> + { asn1_NOVALUE, Tlv3} +end, + +case Tlv4 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowed +end, + {'RLRE-apdu', Term1, Term2}. + + + +%%================================ +%% RLRQ-apdu +%%================================ +'enc_RLRQ-apdu'(Val) -> + 'enc_RLRQ-apdu'(Val, [<<98>>]). + +'enc_RLRQ-apdu'(Val, TagIn) -> +{_,Cindex1, Cindex2} = Val, + +%%------------------------------------------------- +%% attribute reason(1) with type INTEGER OPTIONAL +%%------------------------------------------------- + {EncBytes1,EncLen1} = case Cindex1 of + asn1_NOVALUE -> {<<>>,0}; + _ -> + encode_integer(Cindex1, [{normal,0},{urgent,1},{'user-defined',30}], [<<128>>]) + end, + +%%------------------------------------------------- +%% attribute user-information(2) External acse:Association-information OPTIONAL +%%------------------------------------------------- + {EncBytes2,EncLen2} = case Cindex2 of + asn1_NOVALUE -> {<<>>,0}; + _ -> + 'enc_Association-information'(Cindex2, [<<190>>]) + end, + + BytesSoFar = [EncBytes1, EncBytes2], +LenSoFar = EncLen1 + EncLen2, +encode_tags(TagIn, BytesSoFar, LenSoFar). + + +'dec_RLRQ-apdu'(Tlv) -> + 'dec_RLRQ-apdu'(Tlv, [65538]). + +'dec_RLRQ-apdu'(Tlv, TagIn) -> + %%------------------------------------------------- + %% decode tag and length + %%------------------------------------------------- +Tlv1 = match_tags(Tlv, TagIn), + +%%------------------------------------------------- +%% attribute reason(1) with type INTEGER OPTIONAL +%%------------------------------------------------- +{Term1,Tlv2} = case Tlv1 of +[{131072,V1}|TempTlv2] -> + {begin +Val1 = decode_integer(V1, []), +number2name(Val1, [{normal,0},{urgent,1},{'user-defined',30}]) +end +, TempTlv2}; + _ -> + { asn1_NOVALUE, Tlv1} +end, +Tlv3 = skip_ExtensionAdditions(Tlv2, [131102]), + +%%------------------------------------------------- +%% attribute user-information(1) External acse:Association-information OPTIONAL +%%------------------------------------------------- +{Term2,Tlv4} = case Tlv3 of +[{131102,V2}|TempTlv4] -> + {'dec_Association-information'(V2, []), TempTlv4}; + _ -> + { asn1_NOVALUE, Tlv3} +end, + +case Tlv4 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowed +end, + {'RLRQ-apdu', Term1, Term2}. + + + +%%================================ +%% AARE-apdu +%%================================ +'enc_AARE-apdu'(Val) -> + 'enc_AARE-apdu'(Val, [<<97>>]). + +'enc_AARE-apdu'(Val, TagIn) -> +{_,Cindex1, Cindex2, Cindex3, Cindex4, Cindex5, Cindex6, Cindex7, Cindex8, Cindex9, Cindex10, Cindex11, Cindex12, Cindex13, Cindex14} = Val, + +%%------------------------------------------------- +%% attribute protocol-version(1) with type BIT STRING DEFAULT = [version1] +%%------------------------------------------------- + {EncBytes1,EncLen1} = case Cindex1 of + asn1_DEFAULT -> {<<>>,0}; + [version1] -> {<<>>,0}; + _ -> + encode_named_bit_string(Cindex1, [{version1,0}], [<<128>>]) + end, + +%%------------------------------------------------- +%% attribute application-context-name(2) with type OBJECT IDENTIFIER +%%------------------------------------------------- + {EncBytes2,EncLen2} = encode_object_identifier(Cindex2, [<<6>>,<<161>>]), + +%%------------------------------------------------- +%% attribute result(3) with type INTEGER +%%------------------------------------------------- + {EncBytes3,EncLen3} = encode_integer(Cindex3, [{accepted,0},{'rejected-permanent',1},{'rejected-transient',2}], [<<2>>,<<162>>]), + +%%------------------------------------------------- +%% attribute result-source-diagnostic(4) External acse:Associate-source-diagnostic +%%------------------------------------------------- + {EncBytes4,EncLen4} = 'enc_Associate-source-diagnostic'(Cindex4, [<<163>>]), + +%%------------------------------------------------- +%% attribute responding-AP-title(5) External acse:AP-title OPTIONAL +%%------------------------------------------------- + {EncBytes5,EncLen5} = case Cindex5 of + asn1_NOVALUE -> {<<>>,0}; + _ -> + 'enc_AP-title'(Cindex5, [<<164>>]) + end, + +%%------------------------------------------------- +%% attribute responding-AE-qualifier(6) External acse:AE-qualifier OPTIONAL +%%------------------------------------------------- + {EncBytes6,EncLen6} = case Cindex6 of + asn1_NOVALUE -> {<<>>,0}; + _ -> + 'enc_AE-qualifier'(Cindex6, [<<165>>]) + end, + +%%------------------------------------------------- +%% attribute responding-AP-invocation-identifier(7) with type INTEGER OPTIONAL +%%------------------------------------------------- + {EncBytes7,EncLen7} = case Cindex7 of + asn1_NOVALUE -> {<<>>,0}; + _ -> + encode_integer(Cindex7, [<<2>>,<<166>>]) + end, + +%%------------------------------------------------- +%% attribute responding-AE-invocation-identifier(8) with type INTEGER OPTIONAL +%%------------------------------------------------- + {EncBytes8,EncLen8} = case Cindex8 of + asn1_NOVALUE -> {<<>>,0}; + _ -> + encode_integer(Cindex8, [<<2>>,<<167>>]) + end, + +%%------------------------------------------------- +%% attribute responder-acse-requirements(9) with type BIT STRING OPTIONAL +%%------------------------------------------------- + {EncBytes9,EncLen9} = case Cindex9 of + asn1_NOVALUE -> {<<>>,0}; + _ -> + encode_named_bit_string(Cindex9, [{authentication,0},{'application-context-negotiation',1}], [<<136>>]) + end, + +%%------------------------------------------------- +%% attribute mechanism-name(10) with type OBJECT IDENTIFIER OPTIONAL +%%------------------------------------------------- + {EncBytes10,EncLen10} = case Cindex10 of + asn1_NOVALUE -> {<<>>,0}; + _ -> + encode_object_identifier(Cindex10, [<<137>>]) + end, + +%%------------------------------------------------- +%% attribute responding-authentication-value(11) External acse:Authentication-value OPTIONAL +%%------------------------------------------------- + {EncBytes11,EncLen11} = case Cindex11 of + asn1_NOVALUE -> {<<>>,0}; + _ -> + 'enc_Authentication-value'(Cindex11, [<<170>>]) + end, + +%%------------------------------------------------- +%% attribute application-context-name-list(12) External acse:Application-context-name-list OPTIONAL +%%------------------------------------------------- + {EncBytes12,EncLen12} = case Cindex12 of + asn1_NOVALUE -> {<<>>,0}; + _ -> + 'enc_Application-context-name-list'(Cindex12, [<<171>>]) + end, + +%%------------------------------------------------- +%% attribute implementation-information(13) with type GraphicString OPTIONAL +%%------------------------------------------------- + {EncBytes13,EncLen13} = case Cindex13 of + asn1_NOVALUE -> {<<>>,0}; + _ -> + encode_restricted_string(Cindex13, [<<157>>]) + end, + +%%------------------------------------------------- +%% attribute user-information(14) External acse:Association-information OPTIONAL +%%------------------------------------------------- + {EncBytes14,EncLen14} = case Cindex14 of + asn1_NOVALUE -> {<<>>,0}; + _ -> + 'enc_Association-information'(Cindex14, [<<190>>]) + 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, +encode_tags(TagIn, BytesSoFar, LenSoFar). + + +'dec_AARE-apdu'(Tlv) -> + 'dec_AARE-apdu'(Tlv, [65537]). + +'dec_AARE-apdu'(Tlv, TagIn) -> + %%------------------------------------------------- + %% decode tag and length + %%------------------------------------------------- +Tlv1 = match_tags(Tlv, TagIn), + +%%------------------------------------------------- +%% attribute protocol-version(1) with type BIT STRING DEFAULT = [version1] +%%------------------------------------------------- +{Term1,Tlv2} = case Tlv1 of +[{131072,V1}|TempTlv2] -> + {decode_named_bit_string(V1, [{version1,0}], []), TempTlv2}; + _ -> + {[version1],Tlv1} +end, + +%%------------------------------------------------- +%% attribute application-context-name(2) with type OBJECT IDENTIFIER +%%------------------------------------------------- +[V2|Tlv3] = Tlv2, +Term2 = decode_object_identifier(V2, [131073,6]), + +%%------------------------------------------------- +%% attribute result(3) with type INTEGER +%%------------------------------------------------- +[V3|Tlv4] = Tlv3, +Term3 = begin +Val1 = decode_integer(V3, [131074,2]), +number2name(Val1, [{accepted,0},{'rejected-permanent',1},{'rejected-transient',2}]) +end +, + +%%------------------------------------------------- +%% attribute result-source-diagnostic(4) External acse:Associate-source-diagnostic +%%------------------------------------------------- +[V4|Tlv5] = Tlv4, +Term4 = 'dec_Associate-source-diagnostic'(V4, [131075]), + +%%------------------------------------------------- +%% attribute responding-AP-title(5) External acse:AP-title OPTIONAL +%%------------------------------------------------- +{Term5,Tlv6} = case Tlv5 of +[{131076,V5}|TempTlv6] -> + {'dec_AP-title'(V5, []), TempTlv6}; + _ -> + { asn1_NOVALUE, Tlv5} +end, + +%%------------------------------------------------- +%% attribute responding-AE-qualifier(6) External acse:AE-qualifier OPTIONAL +%%------------------------------------------------- +{Term6,Tlv7} = case Tlv6 of +[{131077,V6}|TempTlv7] -> + {'dec_AE-qualifier'(V6, []), TempTlv7}; + _ -> + { asn1_NOVALUE, Tlv6} +end, + +%%------------------------------------------------- +%% attribute responding-AP-invocation-identifier(7) with type INTEGER OPTIONAL +%%------------------------------------------------- +{Term7,Tlv8} = case Tlv7 of +[{131078,V7}|TempTlv8] -> + {decode_integer(V7, [2]), TempTlv8}; + _ -> + { asn1_NOVALUE, Tlv7} +end, + +%%------------------------------------------------- +%% attribute responding-AE-invocation-identifier(8) with type INTEGER OPTIONAL +%%------------------------------------------------- +{Term8,Tlv9} = case Tlv8 of +[{131079,V8}|TempTlv9] -> + {decode_integer(V8, [2]), TempTlv9}; + _ -> + { asn1_NOVALUE, Tlv8} +end, + +%%------------------------------------------------- +%% attribute responder-acse-requirements(9) with type BIT STRING OPTIONAL +%%------------------------------------------------- +{Term9,Tlv10} = case Tlv9 of +[{131080,V9}|TempTlv10] -> + {decode_named_bit_string(V9, [{authentication,0},{'application-context-negotiation',1}], []), TempTlv10}; + _ -> + { asn1_NOVALUE, Tlv9} +end, + +%%------------------------------------------------- +%% attribute mechanism-name(10) with type OBJECT IDENTIFIER OPTIONAL +%%------------------------------------------------- +{Term10,Tlv11} = case Tlv10 of +[{131081,V10}|TempTlv11] -> + {decode_object_identifier(V10, []), TempTlv11}; + _ -> + { asn1_NOVALUE, Tlv10} +end, + +%%------------------------------------------------- +%% attribute responding-authentication-value(11) External acse:Authentication-value OPTIONAL +%%------------------------------------------------- +{Term11,Tlv12} = case Tlv11 of +[{131082,V11}|TempTlv12] -> + {'dec_Authentication-value'(V11, []), TempTlv12}; + _ -> + { asn1_NOVALUE, Tlv11} +end, + +%%------------------------------------------------- +%% attribute application-context-name-list(12) External acse:Application-context-name-list OPTIONAL +%%------------------------------------------------- +{Term12,Tlv13} = case Tlv12 of +[{131083,V12}|TempTlv13] -> + {'dec_Application-context-name-list'(V12, []), TempTlv13}; + _ -> + { asn1_NOVALUE, Tlv12} +end, + +%%------------------------------------------------- +%% attribute implementation-information(13) with type GraphicString OPTIONAL +%%------------------------------------------------- +{Term13,Tlv14} = case Tlv13 of +[{131101,V13}|TempTlv14] -> + {begin +binary_to_list(decode_restricted_string(V13, [])) +end +, TempTlv14}; + _ -> + { asn1_NOVALUE, Tlv13} +end, +Tlv15 = skip_ExtensionAdditions(Tlv14, [131102]), + +%%------------------------------------------------- +%% attribute user-information(13) External acse:Association-information OPTIONAL +%%------------------------------------------------- +{Term14,Tlv16} = case Tlv15 of +[{131102,V14}|TempTlv16] -> + {'dec_Association-information'(V14, []), TempTlv16}; + _ -> + { asn1_NOVALUE, Tlv15} +end, + +case Tlv16 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv16}}}) % extra fields not allowed +end, + {'AARE-apdu', Term1, Term2, Term3, Term4, Term5, Term6, Term7, Term8, Term9, Term10, Term11, Term12, Term13, Term14}. + + + +%%================================ +%% AARQ-apdu +%%================================ +'enc_AARQ-apdu'(Val) -> + 'enc_AARQ-apdu'(Val, [<<96>>]). + +'enc_AARQ-apdu'(Val, TagIn) -> +{_,Cindex1, Cindex2, Cindex3, Cindex4, Cindex5, Cindex6, Cindex7, Cindex8, Cindex9, Cindex10, Cindex11, Cindex12, Cindex13, Cindex14, Cindex15, Cindex16} = Val, + +%%------------------------------------------------- +%% attribute protocol-version(1) with type BIT STRING DEFAULT = [version1] +%%------------------------------------------------- + {EncBytes1,EncLen1} = case Cindex1 of + asn1_DEFAULT -> {<<>>,0}; + [version1] -> {<<>>,0}; + _ -> + encode_named_bit_string(Cindex1, [{version1,0}], [<<128>>]) + end, + +%%------------------------------------------------- +%% attribute application-context-name(2) with type OBJECT IDENTIFIER +%%------------------------------------------------- + {EncBytes2,EncLen2} = encode_object_identifier(Cindex2, [<<6>>,<<161>>]), + +%%------------------------------------------------- +%% attribute called-AP-title(3) External acse:AP-title OPTIONAL +%%------------------------------------------------- + {EncBytes3,EncLen3} = case Cindex3 of + asn1_NOVALUE -> {<<>>,0}; + _ -> + 'enc_AP-title'(Cindex3, [<<162>>]) + end, + +%%------------------------------------------------- +%% attribute called-AE-qualifier(4) External acse:AE-qualifier OPTIONAL +%%------------------------------------------------- + {EncBytes4,EncLen4} = case Cindex4 of + asn1_NOVALUE -> {<<>>,0}; + _ -> + 'enc_AE-qualifier'(Cindex4, [<<163>>]) + end, + +%%------------------------------------------------- +%% attribute called-AP-invocation-identifier(5) with type INTEGER OPTIONAL +%%------------------------------------------------- + {EncBytes5,EncLen5} = case Cindex5 of + asn1_NOVALUE -> {<<>>,0}; + _ -> + encode_integer(Cindex5, [<<2>>,<<164>>]) + end, + +%%------------------------------------------------- +%% attribute called-AE-invocation-identifier(6) with type INTEGER OPTIONAL +%%------------------------------------------------- + {EncBytes6,EncLen6} = case Cindex6 of + asn1_NOVALUE -> {<<>>,0}; + _ -> + encode_integer(Cindex6, [<<2>>,<<165>>]) + end, + +%%------------------------------------------------- +%% attribute calling-AP-title(7) External acse:AP-title OPTIONAL +%%------------------------------------------------- + {EncBytes7,EncLen7} = case Cindex7 of + asn1_NOVALUE -> {<<>>,0}; + _ -> + 'enc_AP-title'(Cindex7, [<<166>>]) + end, + +%%------------------------------------------------- +%% attribute calling-AE-qualifier(8) External acse:AE-qualifier OPTIONAL +%%------------------------------------------------- + {EncBytes8,EncLen8} = case Cindex8 of + asn1_NOVALUE -> {<<>>,0}; + _ -> + 'enc_AE-qualifier'(Cindex8, [<<167>>]) + end, + +%%------------------------------------------------- +%% attribute calling-AP-invocation-identifier(9) with type INTEGER OPTIONAL +%%------------------------------------------------- + {EncBytes9,EncLen9} = case Cindex9 of + asn1_NOVALUE -> {<<>>,0}; + _ -> + encode_integer(Cindex9, [<<2>>,<<168>>]) + end, + +%%------------------------------------------------- +%% attribute calling-AE-invocation-identifier(10) with type INTEGER OPTIONAL +%%------------------------------------------------- + {EncBytes10,EncLen10} = case Cindex10 of + asn1_NOVALUE -> {<<>>,0}; + _ -> + encode_integer(Cindex10, [<<2>>,<<169>>]) + end, + +%%------------------------------------------------- +%% attribute sender-acse-requirements(11) with type BIT STRING OPTIONAL +%%------------------------------------------------- + {EncBytes11,EncLen11} = case Cindex11 of + asn1_NOVALUE -> {<<>>,0}; + _ -> + encode_named_bit_string(Cindex11, [{authentication,0},{'application-context-negotiation',1}], [<<138>>]) + end, + +%%------------------------------------------------- +%% attribute mechanism-name(12) with type OBJECT IDENTIFIER OPTIONAL +%%------------------------------------------------- + {EncBytes12,EncLen12} = case Cindex12 of + asn1_NOVALUE -> {<<>>,0}; + _ -> + encode_object_identifier(Cindex12, [<<139>>]) + end, + +%%------------------------------------------------- +%% attribute calling-authentication-value(13) External acse:Authentication-value OPTIONAL +%%------------------------------------------------- + {EncBytes13,EncLen13} = case Cindex13 of + asn1_NOVALUE -> {<<>>,0}; + _ -> + 'enc_Authentication-value'(Cindex13, [<<172>>]) + end, + +%%------------------------------------------------- +%% attribute application-context-name-list(14) External acse:Application-context-name-list OPTIONAL +%%------------------------------------------------- + {EncBytes14,EncLen14} = case Cindex14 of + asn1_NOVALUE -> {<<>>,0}; + _ -> + 'enc_Application-context-name-list'(Cindex14, [<<173>>]) + end, + +%%------------------------------------------------- +%% attribute implementation-information(15) with type GraphicString OPTIONAL +%%------------------------------------------------- + {EncBytes15,EncLen15} = case Cindex15 of + asn1_NOVALUE -> {<<>>,0}; + _ -> + encode_restricted_string(Cindex15, [<<157>>]) + end, + +%%------------------------------------------------- +%% attribute user-information(16) External acse:Association-information OPTIONAL +%%------------------------------------------------- + {EncBytes16,EncLen16} = case Cindex16 of + asn1_NOVALUE -> {<<>>,0}; + _ -> + 'enc_Association-information'(Cindex16, [<<190>>]) + 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, +encode_tags(TagIn, BytesSoFar, LenSoFar). + + +'dec_AARQ-apdu'(Tlv) -> + 'dec_AARQ-apdu'(Tlv, [65536]). + +'dec_AARQ-apdu'(Tlv, TagIn) -> + %%------------------------------------------------- + %% decode tag and length + %%------------------------------------------------- +Tlv1 = match_tags(Tlv, TagIn), + +%%------------------------------------------------- +%% attribute protocol-version(1) with type BIT STRING DEFAULT = [version1] +%%------------------------------------------------- +{Term1,Tlv2} = case Tlv1 of +[{131072,V1}|TempTlv2] -> + {decode_named_bit_string(V1, [{version1,0}], []), TempTlv2}; + _ -> + {[version1],Tlv1} +end, + +%%------------------------------------------------- +%% attribute application-context-name(2) with type OBJECT IDENTIFIER +%%------------------------------------------------- +[V2|Tlv3] = Tlv2, +Term2 = decode_object_identifier(V2, [131073,6]), + +%%------------------------------------------------- +%% attribute called-AP-title(3) External acse:AP-title OPTIONAL +%%------------------------------------------------- +{Term3,Tlv4} = case Tlv3 of +[{131074,V3}|TempTlv4] -> + {'dec_AP-title'(V3, []), TempTlv4}; + _ -> + { asn1_NOVALUE, Tlv3} +end, + +%%------------------------------------------------- +%% attribute called-AE-qualifier(4) External acse:AE-qualifier OPTIONAL +%%------------------------------------------------- +{Term4,Tlv5} = case Tlv4 of +[{131075,V4}|TempTlv5] -> + {'dec_AE-qualifier'(V4, []), TempTlv5}; + _ -> + { asn1_NOVALUE, Tlv4} +end, + +%%------------------------------------------------- +%% attribute called-AP-invocation-identifier(5) with type INTEGER OPTIONAL +%%------------------------------------------------- +{Term5,Tlv6} = case Tlv5 of +[{131076,V5}|TempTlv6] -> + {decode_integer(V5, [2]), TempTlv6}; + _ -> + { asn1_NOVALUE, Tlv5} +end, + +%%------------------------------------------------- +%% attribute called-AE-invocation-identifier(6) with type INTEGER OPTIONAL +%%------------------------------------------------- +{Term6,Tlv7} = case Tlv6 of +[{131077,V6}|TempTlv7] -> + {decode_integer(V6, [2]), TempTlv7}; + _ -> + { asn1_NOVALUE, Tlv6} +end, + +%%------------------------------------------------- +%% attribute calling-AP-title(7) External acse:AP-title OPTIONAL +%%------------------------------------------------- +{Term7,Tlv8} = case Tlv7 of +[{131078,V7}|TempTlv8] -> + {'dec_AP-title'(V7, []), TempTlv8}; + _ -> + { asn1_NOVALUE, Tlv7} +end, + +%%------------------------------------------------- +%% attribute calling-AE-qualifier(8) External acse:AE-qualifier OPTIONAL +%%------------------------------------------------- +{Term8,Tlv9} = case Tlv8 of +[{131079,V8}|TempTlv9] -> + {'dec_AE-qualifier'(V8, []), TempTlv9}; + _ -> + { asn1_NOVALUE, Tlv8} +end, + +%%------------------------------------------------- +%% attribute calling-AP-invocation-identifier(9) with type INTEGER OPTIONAL +%%------------------------------------------------- +{Term9,Tlv10} = case Tlv9 of +[{131080,V9}|TempTlv10] -> + {decode_integer(V9, [2]), TempTlv10}; + _ -> + { asn1_NOVALUE, Tlv9} +end, + +%%------------------------------------------------- +%% attribute calling-AE-invocation-identifier(10) with type INTEGER OPTIONAL +%%------------------------------------------------- +{Term10,Tlv11} = case Tlv10 of +[{131081,V10}|TempTlv11] -> + {decode_integer(V10, [2]), TempTlv11}; + _ -> + { asn1_NOVALUE, Tlv10} +end, + +%%------------------------------------------------- +%% attribute sender-acse-requirements(11) with type BIT STRING OPTIONAL +%%------------------------------------------------- +{Term11,Tlv12} = case Tlv11 of +[{131082,V11}|TempTlv12] -> + {decode_named_bit_string(V11, [{authentication,0},{'application-context-negotiation',1}], []), TempTlv12}; + _ -> + { asn1_NOVALUE, Tlv11} +end, + +%%------------------------------------------------- +%% attribute mechanism-name(12) with type OBJECT IDENTIFIER OPTIONAL +%%------------------------------------------------- +{Term12,Tlv13} = case Tlv12 of +[{131083,V12}|TempTlv13] -> + {decode_object_identifier(V12, []), TempTlv13}; + _ -> + { asn1_NOVALUE, Tlv12} +end, + +%%------------------------------------------------- +%% attribute calling-authentication-value(13) External acse:Authentication-value OPTIONAL +%%------------------------------------------------- +{Term13,Tlv14} = case Tlv13 of +[{131084,V13}|TempTlv14] -> + {'dec_Authentication-value'(V13, []), TempTlv14}; + _ -> + { asn1_NOVALUE, Tlv13} +end, + +%%------------------------------------------------- +%% attribute application-context-name-list(14) External acse:Application-context-name-list OPTIONAL +%%------------------------------------------------- +{Term14,Tlv15} = case Tlv14 of +[{131085,V14}|TempTlv15] -> + {'dec_Application-context-name-list'(V14, []), TempTlv15}; + _ -> + { asn1_NOVALUE, Tlv14} +end, + +%%------------------------------------------------- +%% attribute implementation-information(15) with type GraphicString OPTIONAL +%%------------------------------------------------- +{Term15,Tlv16} = case Tlv15 of +[{131101,V15}|TempTlv16] -> + {begin +binary_to_list(decode_restricted_string(V15, [])) +end +, TempTlv16}; + _ -> + { asn1_NOVALUE, Tlv15} +end, +Tlv17 = skip_ExtensionAdditions(Tlv16, [131102]), + +%%------------------------------------------------- +%% attribute user-information(15) External acse:Association-information OPTIONAL +%%------------------------------------------------- +{Term16,Tlv18} = case Tlv17 of +[{131102,V16}|TempTlv18] -> + {'dec_Association-information'(V16, []), TempTlv18}; + _ -> + { asn1_NOVALUE, Tlv17} +end, + +case Tlv18 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv18}}}) % extra fields not allowed +end, + {'AARQ-apdu', Term1, Term2, Term3, Term4, Term5, Term6, Term7, Term8, Term9, Term10, Term11, Term12, Term13, Term14, Term15, Term16}. + + + +%%================================ +%% ACSE-apdu +%%================================ +'enc_ACSE-apdu'(Val) -> + 'enc_ACSE-apdu'(Val, []). + +'enc_ACSE-apdu'(Val, TagIn) -> + {EncBytes,EncLen} = case element(1,Val) of + aarq -> + 'enc_AARQ-apdu'(element(2,Val), [<<96>>]); + aare -> + 'enc_AARE-apdu'(element(2,Val), [<<97>>]); + rlrq -> + 'enc_RLRQ-apdu'(element(2,Val), [<<98>>]); + rlre -> + 'enc_RLRE-apdu'(element(2,Val), [<<99>>]); + abrt -> + 'enc_ABRT-apdu'(element(2,Val), [<<100>>]); + Else -> + exit({error,{asn1,{invalid_choice_type,Else}}}) + end, + +encode_tags(TagIn, EncBytes, EncLen). + + + + +'dec_ACSE-apdu'(Tlv) -> + 'dec_ACSE-apdu'(Tlv, []). + +'dec_ACSE-apdu'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of + +%% 'aarq' + {65536, V1} -> + {aarq, 'dec_AARQ-apdu'(V1, [])}; + + +%% 'aare' + {65537, V1} -> + {aare, 'dec_AARE-apdu'(V1, [])}; + + +%% 'rlrq' + {65538, V1} -> + {rlrq, 'dec_RLRQ-apdu'(V1, [])}; + + +%% 'rlre' + {65539, V1} -> + {rlre, 'dec_RLRE-apdu'(V1, [])}; + + +%% 'abrt' + {65540, V1} -> + {abrt, 'dec_ABRT-apdu'(V1, [])}; + + Else -> + {asn1_ExtAlt,ber_encode(Else)} + end +. + + +%%================================ +%% EXTERNAL +%%================================ +'enc_EXTERNAL'(Val) -> + 'enc_EXTERNAL'(Val, [<<40>>]). + +'enc_EXTERNAL'(Val, TagIn) -> + NewVal = transform_to_EXTERNAL1990(Val), +{_,Cindex1, Cindex2, Cindex3, Cindex4} = NewVal, + +%%------------------------------------------------- +%% attribute direct-reference(1) with type OBJECT IDENTIFIER OPTIONAL +%%------------------------------------------------- + {EncBytes1,EncLen1} = case Cindex1 of + asn1_NOVALUE -> {<<>>,0}; + _ -> + encode_object_identifier(Cindex1, [<<6>>]) + end, + +%%------------------------------------------------- +%% attribute indirect-reference(2) with type INTEGER OPTIONAL +%%------------------------------------------------- + {EncBytes2,EncLen2} = case Cindex2 of + asn1_NOVALUE -> {<<>>,0}; + _ -> + encode_integer(Cindex2, [<<2>>]) + end, + +%%------------------------------------------------- +%% attribute data-value-descriptor(3) with type ObjectDescriptor OPTIONAL +%%------------------------------------------------- + {EncBytes3,EncLen3} = case Cindex3 of + asn1_NOVALUE -> {<<>>,0}; + _ -> + encode_restricted_string(Cindex3, [<<7>>]) + end, + +%%------------------------------------------------- +%% attribute encoding(4) with type CHOICE +%%------------------------------------------------- + {EncBytes4,EncLen4} = 'enc_EXTERNAL_encoding'(Cindex4, []), + + BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4], +LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4, +encode_tags(TagIn, BytesSoFar, LenSoFar). + + + +%%================================ +%% EXTERNAL_encoding +%%================================ +'enc_EXTERNAL_encoding'(Val, TagIn) -> + {EncBytes,EncLen} = case element(1,Val) of + 'single-ASN1-type' -> + encode_open_type(element(2,Val), [<<160>>]); + 'octet-aligned' -> + encode_restricted_string(element(2,Val), [<<129>>]); + arbitrary -> + encode_unnamed_bit_string(element(2,Val), [<<130>>]); + Else -> + exit({error,{asn1,{invalid_choice_type,Else}}}) + end, + +encode_tags(TagIn, EncBytes, EncLen). + + + + +'dec_EXTERNAL'(Tlv) -> + 'dec_EXTERNAL'(Tlv, [8]). + +'dec_EXTERNAL'(Tlv, TagIn) -> + %%------------------------------------------------- + %% decode tag and length + %%------------------------------------------------- +Tlv1 = match_tags(Tlv, TagIn), + +%%------------------------------------------------- +%% attribute direct-reference(1) with type OBJECT IDENTIFIER OPTIONAL +%%------------------------------------------------- +{Term1,Tlv2} = case Tlv1 of +[{6,V1}|TempTlv2] -> + {decode_object_identifier(V1, []), TempTlv2}; + _ -> + { asn1_NOVALUE, Tlv1} +end, + +%%------------------------------------------------- +%% attribute indirect-reference(2) with type INTEGER OPTIONAL +%%------------------------------------------------- +{Term2,Tlv3} = case Tlv2 of +[{2,V2}|TempTlv3] -> + {decode_integer(V2, []), TempTlv3}; + _ -> + { asn1_NOVALUE, Tlv2} +end, + +%%------------------------------------------------- +%% attribute data-value-descriptor(3) with type ObjectDescriptor OPTIONAL +%%------------------------------------------------- +{Term3,Tlv4} = case Tlv3 of +[{7,V3}|TempTlv4] -> + {begin +binary_to_list(decode_restricted_string(V3, [])) +end +, TempTlv4}; + _ -> + { asn1_NOVALUE, Tlv3} +end, + +%%------------------------------------------------- +%% attribute encoding(4) with type CHOICE +%%------------------------------------------------- +[V4|Tlv5] = Tlv4, +Term4 = 'dec_EXTERNAL_encoding'(V4, []), + +case Tlv5 of +[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv5}}}) % extra fields not allowed +end, + OldFormat={'EXTERNAL', Term1, Term2, Term3, Term4}, + transform_to_EXTERNAL1994(OldFormat). +'dec_EXTERNAL_encoding'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of + +%% 'single-ASN1-type' + {131072, V1} -> + {'single-ASN1-type', decode_open_type_as_binary(V1, [])}; + + +%% 'octet-aligned' + {131073, V1} -> + {'octet-aligned', decode_octet_string(V1, [])}; + + +%% 'arbitrary' + {131074, V1} -> + {arbitrary, decode_native_bit_string(V1, [])}; + + Else -> + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. +'aCSE-id'() -> +{2,2,3,1,1}. + +'acse-as-id'() -> +{2,2,1,0,1}. + + + + +%%================================ +%% ObjectSet +%%================================ +'getenc_ObjectSet'(_) -> + fun(_, Val, _RestPrimFieldName) -> + case Val of + {asn1_OPENTYPE,Bin} when is_binary(Bin) -> + {Bin,byte_size(Bin)} + end + end. + +'getdec_ObjectSet'(_) -> + fun(_,Bytes, _RestPrimFieldName) -> + case Bytes of + Bin when is_binary(Bin) -> + {asn1_OPENTYPE,Bin}; + _ -> + {asn1_OPENTYPE,ber_encode(Bytes)} + end + end. + + + +%%% +%%% Run-time functions. +%%% + +'dialyzer-suppressions'(Arg) -> + ok. + +ber_decode_nif(B) -> + asn1rt_nif:decode_ber_tlv(B). + +ber_encode([Tlv]) -> + ber_encode(Tlv); +ber_encode(Tlv) when is_binary(Tlv) -> + Tlv; +ber_encode(Tlv) -> + asn1rt_nif:encode_ber_tlv(Tlv). + +collect_parts(TlvList) -> + collect_parts(TlvList, []). + +collect_parts([{_,L}|Rest], Acc) when is_list(L) -> + collect_parts(Rest, [collect_parts(L)|Acc]); +collect_parts([{3,<>}|Rest], _Acc) -> + collect_parts_bit(Rest, [Bits], Unused); +collect_parts([{_T,V}|Rest], Acc) -> + collect_parts(Rest, [V|Acc]); +collect_parts([], Acc) -> + list_to_binary(lists:reverse(Acc)). + +collect_parts_bit([{3,<>}|Rest], Acc, Uacc) -> + collect_parts_bit(Rest, [Bits|Acc], Unused + Uacc); +collect_parts_bit([], Acc, Uacc) -> + list_to_binary([Uacc|lists:reverse(Acc)]). + +dec_subidentifiers(<<>>, _Av, Al) -> + lists:reverse(Al); +dec_subidentifiers(<<1:1,H:7,T/binary>>, Av, Al) -> + dec_subidentifiers(T, Av bsl 7 + H, Al); +dec_subidentifiers(<>, Av, Al) -> + dec_subidentifiers(T, 0, [Av bsl 7 + H|Al]). + +decode_bitstring2(1, + Unused, + <>) -> + lists:sublist([B7,B6,B5,B4,B3,B2,B1,B0], 8 - Unused); +decode_bitstring2(Len, + Unused, + <>) -> + [B7,B6,B5,B4,B3,B2,B1,B0|decode_bitstring2(Len - 1, Unused, Buffer)]. + +decode_bitstring_NNL(BitList, NamedNumberList) -> + decode_bitstring_NNL(BitList, NamedNumberList, 0, []). + +decode_bitstring_NNL([], _, _No, Result) -> + lists:reverse(Result); +decode_bitstring_NNL([B|BitList], + [{Name,No}|NamedNumberList], + No, + Result) -> + if + B =:= 0 -> + decode_bitstring_NNL(BitList, + NamedNumberList, + No + 1, + Result); + true -> + decode_bitstring_NNL(BitList, + NamedNumberList, + No + 1, + [Name|Result]) + end; +decode_bitstring_NNL([1|BitList], NamedNumberList, No, Result) -> + decode_bitstring_NNL(BitList, + NamedNumberList, + No + 1, + [{bit,No}|Result]); +decode_bitstring_NNL([0|BitList], NamedNumberList, No, Result) -> + decode_bitstring_NNL(BitList, NamedNumberList, No + 1, Result). + +decode_integer(Tlv, TagIn) -> + Bin = match_tags(Tlv, TagIn), + Len = byte_size(Bin), + <> = Bin, + Int. + +decode_named_bit_string(Buffer, NamedNumberList, Tags) -> + case match_and_collect(Buffer, Tags) of + <<0>> -> + []; + <> -> + BitString = decode_bitstring2(byte_size(Bits), Unused, Bits), + decode_bitstring_NNL(BitString, NamedNumberList) + end. + +decode_native_bit_string(Buffer, Tags) -> + case match_and_collect(Buffer, Tags) of + <<0>> -> + <<>>; + <> -> + Size = bit_size(Bits) - Unused, + <> = Bits, + Val + end. + +decode_object_identifier(Tlv, Tags) -> + Val = match_tags(Tlv, Tags), + [AddedObjVal|ObjVals] = dec_subidentifiers(Val, 0, []), + {Val1,Val2} = + if + AddedObjVal < 40 -> + {0,AddedObjVal}; + AddedObjVal < 80 -> + {1,AddedObjVal - 40}; + true -> + {2,AddedObjVal - 80} + end, + list_to_tuple([Val1,Val2|ObjVals]). + +decode_octet_string(Tlv, TagsIn) -> + Bin = match_and_collect(Tlv, TagsIn), + binary:copy(Bin). + +decode_open_type(Tlv, TagIn) -> + case match_tags(Tlv, TagIn) of + Bin when is_binary(Bin) -> + {InnerTlv,_} = ber_decode_nif(Bin), + InnerTlv; + TlvBytes -> + TlvBytes + end. + +decode_open_type_as_binary(Tlv, TagIn) -> + ber_encode(match_tags(Tlv, TagIn)). + +decode_restricted_string(Tlv, TagsIn) -> + match_and_collect(Tlv, TagsIn). + +do_encode_named_bit_string([FirstVal|RestVal], NamedBitList, TagIn) -> + ToSetPos = get_all_bitposes([FirstVal|RestVal], NamedBitList, []), + Size = lists:max(ToSetPos) + 1, + BitList = make_and_set_list(Size, ToSetPos, 0), + {Len,Unused,OctetList} = encode_bitstring(BitList), + encode_tags(TagIn, [Unused|OctetList], Len + 1). + +e_object_identifier({'OBJECT IDENTIFIER',V}) -> + e_object_identifier(V); +e_object_identifier(V) when is_tuple(V) -> + e_object_identifier(tuple_to_list(V)); +e_object_identifier([E1,E2|Tail]) -> + Head = 40 * E1 + E2, + {H,Lh} = mk_object_val(Head), + {R,Lr} = lists:mapfoldl(fun enc_obj_id_tail/2, 0, Tail), + {[H|R],Lh + Lr}. + +enc_obj_id_tail(H, Len) -> + {B,L} = mk_object_val(H), + {B,Len + L}. + +encode_bitstring([B8,B7,B6,B5,B4,B3,B2,B1|Rest]) -> + Val = + B8 bsl 7 bor (B7 bsl 6) bor (B6 bsl 5) bor (B5 bsl 4) + bor + (B4 bsl 3) + bor + (B3 bsl 2) + bor + (B2 bsl 1) + bor + B1, + encode_bitstring(Rest, [Val], 1); +encode_bitstring(Val) -> + {Unused,Octet} = unused_bitlist(Val, 7, 0), + {1,Unused,[Octet]}. + +encode_bitstring([B8,B7,B6,B5,B4,B3,B2,B1|Rest], Ack, Len) -> + Val = + B8 bsl 7 bor (B7 bsl 6) bor (B6 bsl 5) bor (B5 bsl 4) + bor + (B4 bsl 3) + bor + (B3 bsl 2) + bor + (B2 bsl 1) + bor + B1, + encode_bitstring(Rest, [Ack,Val], Len + 1); +encode_bitstring([], Ack, Len) -> + {Len,0,Ack}; +encode_bitstring(Rest, Ack, Len) -> + {Unused,Val} = unused_bitlist(Rest, 7, 0), + {Len + 1,Unused,[Ack,Val]}. + +encode_integer(Val) -> + Bytes = + if + Val >= 0 -> + encode_integer_pos(Val, []); + true -> + encode_integer_neg(Val, []) + end, + {Bytes,length(Bytes)}. + +encode_integer(Val, NamedNumberList, Tag) when is_atom(Val) -> + case lists:keyfind(Val, 1, NamedNumberList) of + {_,NewVal} -> + encode_tags(Tag, encode_integer(NewVal)); + _ -> + exit({error,{asn1,{encode_integer_namednumber,Val}}}) + end; +encode_integer(Val, _NamedNumberList, Tag) -> + encode_tags(Tag, encode_integer(Val)). + +encode_integer(Val, Tag) when is_integer(Val) -> + encode_tags(Tag, encode_integer(Val)); +encode_integer(Val, _Tag) -> + exit({error,{asn1,{encode_integer,Val}}}). + +encode_integer_neg(- 1, [B1|_T] = L) when B1 > 127 -> + L; +encode_integer_neg(N, Acc) -> + encode_integer_neg(N bsr 8, [N band 255|Acc]). + +encode_integer_pos(0, [B|_Acc] = L) when B < 128 -> + L; +encode_integer_pos(N, Acc) -> + encode_integer_pos(N bsr 8, [N band 255|Acc]). + +encode_length(L) when L =< 127 -> + {[L],1}; +encode_length(L) -> + Oct = minimum_octets(L), + Len = length(Oct), + if + Len =< 126 -> + {[128 bor Len|Oct],Len + 1}; + true -> + exit({error,{asn1,too_long_length_oct,Len}}) + end. + +encode_named_bit_string([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(Bits, _NamedBitList, TagIn) + when is_bitstring(Bits) -> + encode_unnamed_bit_string(Bits, TagIn). + +encode_object_identifier(Val, TagIn) -> + encode_tags(TagIn, e_object_identifier(Val)). + +encode_open_type(Val, T) when is_list(Val) -> + encode_open_type(list_to_binary(Val), T); +encode_open_type(Val, Tag) -> + encode_tags(Tag, Val, byte_size(Val)). + +encode_restricted_string(OctetList, TagIn) when is_binary(OctetList) -> + encode_tags(TagIn, OctetList, byte_size(OctetList)); +encode_restricted_string(OctetList, TagIn) when is_list(OctetList) -> + encode_tags(TagIn, OctetList, length(OctetList)). + +encode_tags(TagIn, {BytesSoFar,LenSoFar}) -> + encode_tags(TagIn, BytesSoFar, LenSoFar). + +encode_tags([Tag|Trest], BytesSoFar, LenSoFar) -> + {Bytes2,L2} = encode_length(LenSoFar), + encode_tags(Trest, + [Tag,Bytes2|BytesSoFar], + LenSoFar + byte_size(Tag) + L2); +encode_tags([], BytesSoFar, LenSoFar) -> + {BytesSoFar,LenSoFar}. + +encode_unnamed_bit_string(Bits, TagIn) -> + Unused = (8 - bit_size(Bits) band 7) band 7, + Bin = <>, + encode_tags(TagIn, Bin, byte_size(Bin)). + +get_all_bitposes([{bit,ValPos}|Rest], NamedBitList, Ack) -> + get_all_bitposes(Rest, NamedBitList, [ValPos|Ack]); +get_all_bitposes([Val|Rest], NamedBitList, Ack) when is_atom(Val) -> + case lists:keyfind(Val, 1, NamedBitList) of + {_ValName,ValPos} -> + get_all_bitposes(Rest, NamedBitList, [ValPos|Ack]); + _ -> + exit({error,{asn1,{bitstring_namedbit,Val}}}) + end; +get_all_bitposes([], _NamedBitList, Ack) -> + lists:sort(Ack). + +make_and_set_list(0, [], _) -> + []; +make_and_set_list(0, _, _) -> + exit({error,{asn1,bitstring_sizeconstraint}}); +make_and_set_list(Len, [XPos|SetPos], XPos) -> + [1|make_and_set_list(Len - 1, SetPos, XPos + 1)]; +make_and_set_list(Len, [Pos|SetPos], XPos) -> + [0|make_and_set_list(Len - 1, [Pos|SetPos], XPos + 1)]; +make_and_set_list(Len, [], XPos) -> + [0|make_and_set_list(Len - 1, [], XPos + 1)]. + +match_and_collect(Tlv, TagsIn) -> + Val = match_tags(Tlv, TagsIn), + case Val of + [_|_] = PartList -> + collect_parts(PartList); + Bin when is_binary(Bin) -> + Bin + end. + +match_tags({T,V}, [T]) -> + V; +match_tags({T,V}, [T|Tt]) -> + match_tags(V, Tt); +match_tags([{T,V}], [T|Tt]) -> + match_tags(V, Tt); +match_tags([{T,_V}|_] = Vlist, [T]) -> + Vlist; +match_tags(Tlv, []) -> + Tlv; +match_tags({Tag,_V} = Tlv, [T|_Tt]) -> + exit({error,{asn1,{wrong_tag,{{expected,T},{got,Tag,Tlv}}}}}). + +minimum_octets(0, Acc) -> + Acc; +minimum_octets(Val, Acc) -> + minimum_octets(Val bsr 8, [Val band 255|Acc]). + +minimum_octets(Val) -> + minimum_octets(Val, []). + +mk_object_val(0, Ack, Len) -> + {Ack,Len}; +mk_object_val(Val, Ack, Len) -> + mk_object_val(Val bsr 7, [Val band 127 bor 128|Ack], Len + 1). + +mk_object_val(Val) when Val =< 127 -> + {[255 band Val],1}; +mk_object_val(Val) -> + mk_object_val(Val bsr 7, [Val band 127], 1). + +number2name(Int, NamedNumberList) -> + case lists:keyfind(Int, 2, NamedNumberList) of + {NamedVal,_} -> + NamedVal; + _ -> + Int + end. + +skip_ExtensionAdditions([], _Tags) -> + []; +skip_ExtensionAdditions([{Tag,_}|Rest] = TLV, Tags) -> + case + [ + X || + X = T <- Tags, + T =:= Tag + ] + of + [] -> + skip_ExtensionAdditions(Rest, Tags); + _ -> + TLV + end. + +transform_to_EXTERNAL1990(['EXTERNAL'|Rest], Acc) -> + transform_to_EXTERNAL1990(Rest, ['EXTERNAL'|Acc]); +transform_to_EXTERNAL1990([{syntax,Syntax}|Rest], Acc) -> + transform_to_EXTERNAL1990(Rest, [asn1_NOVALUE,Syntax|Acc]); +transform_to_EXTERNAL1990([{'presentation-context-id',PCid}|Rest], Acc) -> + transform_to_EXTERNAL1990(Rest, [PCid,asn1_NOVALUE|Acc]); +transform_to_EXTERNAL1990([{'context-negotiation',Context_negot}|Rest], + Acc) -> + {_,Presentation_Cid,Transfer_syntax} = Context_negot, + transform_to_EXTERNAL1990(Rest, + [Presentation_Cid,Transfer_syntax|Acc]); +transform_to_EXTERNAL1990([asn1_NOVALUE|Rest], Acc) -> + transform_to_EXTERNAL1990(Rest, [asn1_NOVALUE|Acc]); +transform_to_EXTERNAL1990([Data_val_desc,Data_value], Acc) + when is_list(Data_value); is_binary(Data_value) -> + list_to_tuple(lists:reverse([{'octet-aligned',Data_value}, + Data_val_desc| + Acc])); +transform_to_EXTERNAL1990([Data_val_desc,Data_value], Acc) + when is_binary(Data_value) -> + list_to_tuple(lists:reverse([{'single-ASN1-type',Data_value}, + Data_val_desc| + Acc])); +transform_to_EXTERNAL1990([Data_value], Acc) + when is_list(Data_value); is_binary(Data_value) -> + list_to_tuple(lists:reverse([{'octet-aligned',Data_value}|Acc])). + +transform_to_EXTERNAL1990({_,_,_,_} = Val) -> + transform_to_EXTERNAL1990(tuple_to_list(Val), []); +transform_to_EXTERNAL1990(Val) when is_tuple(Val) -> + Val. + +transform_to_EXTERNAL1994({'EXTERNAL',DRef,IndRef,Data_v_desc,Encoding} = + V) -> + Identification = + case {DRef,IndRef} of + {DRef,asn1_NOVALUE} -> + {syntax,DRef}; + {asn1_NOVALUE,IndRef} -> + {'presentation-context-id',IndRef}; + _ -> + {'context-negotiation', + {'EXTERNAL_identification_context-negotiation', + IndRef, + DRef}} + end, + case Encoding of + {'octet-aligned',Val} when is_list(Val); is_binary(Val) -> + {'EXTERNAL',Identification,Data_v_desc,Val}; + _ -> + V + end. + +unused_bitlist([], Trail, Ack) -> + {Trail + 1,Ack}; +unused_bitlist([Bit|Rest], Trail, Ack) -> + unused_bitlist(Rest, Trail - 1, Bit bsl Trail bor Ack). -- cgit v1.2.3