From 078a3a2ffc64572dc6483cc00c9e772c268e103e Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Fri, 23 Oct 2015 10:27:10 +0200 Subject: Recompile with a new version (18) --- CSTA-application-context-information-csta3.erl | 1178 ++++++++++++++---------- 1 file changed, 695 insertions(+), 483 deletions(-) (limited to 'CSTA-application-context-information-csta3.erl') diff --git a/CSTA-application-context-information-csta3.erl b/CSTA-application-context-information-csta3.erl index fdf7405..6d5fb0a 100644 --- a/CSTA-application-context-information-csta3.erl +++ b/CSTA-application-context-information-csta3.erl @@ -1,14 +1,23 @@ -%% Generated by the Erlang ASN.1 BER-compiler version:1.7 +%% Generated by the Erlang ASN.1 BER_V2-compiler version, utilizing bit-syntax:4.0 %% Purpose: encoder and decoder to the types in mod CSTA-application-context-information-csta3 -module('CSTA-application-context-information-csta3'). +-compile(nowarn_unused_vars). -include("CSTA-application-context-information-csta3.hrl"). --define('RT_BER',asn1rt_ber_bin). --asn1_info([{vsn,'1.7'}, +-asn1_info([{vsn,'4.0'}, {module,'CSTA-application-context-information-csta3'}, - {options,[{i,[47,104,111,109,101,47,113,117,97,120,47,101,114,108,47,97,115,110]},warnings,ber,errors,{cwd,[47,104,111,109,101,47,113,117,97,120,47,101,114,108,47,97,115,110]},{outdir,[47,104,111,109,101,47,113,117,97,120,47,101,114,108,47,97,115,110]},{i,[46]},{i,[47,104,111,109,101,47,113,117,97,120,47,101,114,108,47,97,115,110,47,107,109,101]}]}]). - --export([encoding_rule/0]). + {options,[{i,"/Users/quax/erl"}, + warnings,ber,errors, + {cwd,"/Users/quax/erl"}, + {outdir,"/Users/quax/erl"}, + {i,"/Users/quax/erl/acse"}, + {i,"/Users/quax/erl/csta"}, + {i,"."}, + {i,"/Users/quax/erl/kme"}]}]). + +-export([encoding_rule/0,bit_string_format/0, + legacy_erlang_types/0]). +-export(['dialyzer-suppressions'/1]). -export([ 'enc_CSTAFunctionality'/2, 'enc_SwitchingFunctionServicesC2'/2, @@ -69,680 +78,649 @@ 'dec_VendorSpecEvents'/2 ]). --export([ -'dec_CSTAFunctionality'/3, -'dec_SwitchingFunctionServicesC2'/3, -'dec_EventReportServicesC2'/3, -'dec_ComputingFunctionServicesC2'/3, -'dec_BidirectionalServicesC2'/3, -'dec_StatusReportingServicesC2'/3, -'dec_InputOutputServicesC2'/3, -'dec_VoiceUnitServicesC2'/3, -'dec_ACSEUserInformationForCSTA'/3, -'dec_OldACSEUserInformationForCSTA'/3, -'dec_NewACSEUserInformationForCSTA'/3, -'dec_CSTAPrivateDataVersionList'/3, -'dec_CSTAVersion'/3, -'dec_CallControlServices'/3, -'dec_CallAssociatedServices'/3, -'dec_MediaAttachmentServices'/3, -'dec_RouteingServices'/3, -'dec_VoiceUnitServices'/3, -'dec_LocationServices'/3, -'dec_CallControlEvents'/3, -'dec_CallAssociatedEvents'/3, -'dec_MediaAttachmentEvents'/3, -'dec_PhysicalDeviceFeatureEvents'/3, -'dec_LogicalDeviceFeatureEvents'/3, -'dec_DeviceMaintenanceEvents'/3, -'dec_VoiceUnitEvents'/3, -'dec_VendorSpecEvents'/3 -]). - -export([info/0]). --export([encode/2,decode/2,encode_disp/2,decode_disp/2]). +-export([encode/2,decode/2]). + +encoding_rule() -> ber. + +bit_string_format() -> bitstring. -encoding_rule() -> - ber. +legacy_erlang_types() -> false. -encode(Type,Data) -> -case catch encode_disp(Type,Data) of - {'EXIT',{error,Reason}} -> - {error,Reason}; - {'EXIT',Reason} -> - {error,{asn1,Reason}}; - {Bytes,_Len} -> - {ok,wrap_encode(Bytes)}; +encode(Type, Data) -> +try iolist_to_binary(element(1, encode_disp(Type, Data))) of Bytes -> - {ok,wrap_encode(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) -> -case catch decode_disp(Type,wrap_decode(Data)) of - {'EXIT',{error,Reason}} -> - {error,Reason}; - {'EXIT',Reason} -> - {error,{asn1,Reason}}; - {X,_Rest} -> - {ok,X}; - {X,_Rest,_Len} -> - {ok,X} +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('CSTAFunctionality',Data) -> 'enc_CSTAFunctionality'(Data,[]); -encode_disp('SwitchingFunctionServicesC2',Data) -> 'enc_SwitchingFunctionServicesC2'(Data,[]); -encode_disp('EventReportServicesC2',Data) -> 'enc_EventReportServicesC2'(Data,[]); -encode_disp('ComputingFunctionServicesC2',Data) -> 'enc_ComputingFunctionServicesC2'(Data,[]); -encode_disp('BidirectionalServicesC2',Data) -> 'enc_BidirectionalServicesC2'(Data,[]); -encode_disp('StatusReportingServicesC2',Data) -> 'enc_StatusReportingServicesC2'(Data,[]); -encode_disp('InputOutputServicesC2',Data) -> 'enc_InputOutputServicesC2'(Data,[]); -encode_disp('VoiceUnitServicesC2',Data) -> 'enc_VoiceUnitServicesC2'(Data,[]); -encode_disp('ACSEUserInformationForCSTA',Data) -> 'enc_ACSEUserInformationForCSTA'(Data,[]); -encode_disp('OldACSEUserInformationForCSTA',Data) -> 'enc_OldACSEUserInformationForCSTA'(Data,[]); -encode_disp('NewACSEUserInformationForCSTA',Data) -> 'enc_NewACSEUserInformationForCSTA'(Data,[]); -encode_disp('CSTAPrivateDataVersionList',Data) -> 'enc_CSTAPrivateDataVersionList'(Data,[]); -encode_disp('CSTAVersion',Data) -> 'enc_CSTAVersion'(Data,[]); -encode_disp('CallControlServices',Data) -> 'enc_CallControlServices'(Data,[]); -encode_disp('CallAssociatedServices',Data) -> 'enc_CallAssociatedServices'(Data,[]); -encode_disp('MediaAttachmentServices',Data) -> 'enc_MediaAttachmentServices'(Data,[]); -encode_disp('RouteingServices',Data) -> 'enc_RouteingServices'(Data,[]); -encode_disp('VoiceUnitServices',Data) -> 'enc_VoiceUnitServices'(Data,[]); -encode_disp('LocationServices',Data) -> 'enc_LocationServices'(Data,[]); -encode_disp('CallControlEvents',Data) -> 'enc_CallControlEvents'(Data,[]); -encode_disp('CallAssociatedEvents',Data) -> 'enc_CallAssociatedEvents'(Data,[]); -encode_disp('MediaAttachmentEvents',Data) -> 'enc_MediaAttachmentEvents'(Data,[]); -encode_disp('PhysicalDeviceFeatureEvents',Data) -> 'enc_PhysicalDeviceFeatureEvents'(Data,[]); -encode_disp('LogicalDeviceFeatureEvents',Data) -> 'enc_LogicalDeviceFeatureEvents'(Data,[]); -encode_disp('DeviceMaintenanceEvents',Data) -> 'enc_DeviceMaintenanceEvents'(Data,[]); -encode_disp('VoiceUnitEvents',Data) -> 'enc_VoiceUnitEvents'(Data,[]); -encode_disp('VendorSpecEvents',Data) -> 'enc_VendorSpecEvents'(Data,[]); +encode_disp('CSTAFunctionality',Data) -> 'enc_CSTAFunctionality'(Data); +encode_disp('SwitchingFunctionServicesC2',Data) -> 'enc_SwitchingFunctionServicesC2'(Data); +encode_disp('EventReportServicesC2',Data) -> 'enc_EventReportServicesC2'(Data); +encode_disp('ComputingFunctionServicesC2',Data) -> 'enc_ComputingFunctionServicesC2'(Data); +encode_disp('BidirectionalServicesC2',Data) -> 'enc_BidirectionalServicesC2'(Data); +encode_disp('StatusReportingServicesC2',Data) -> 'enc_StatusReportingServicesC2'(Data); +encode_disp('InputOutputServicesC2',Data) -> 'enc_InputOutputServicesC2'(Data); +encode_disp('VoiceUnitServicesC2',Data) -> 'enc_VoiceUnitServicesC2'(Data); +encode_disp('ACSEUserInformationForCSTA',Data) -> 'enc_ACSEUserInformationForCSTA'(Data); +encode_disp('OldACSEUserInformationForCSTA',Data) -> 'enc_OldACSEUserInformationForCSTA'(Data); +encode_disp('NewACSEUserInformationForCSTA',Data) -> 'enc_NewACSEUserInformationForCSTA'(Data); +encode_disp('CSTAPrivateDataVersionList',Data) -> 'enc_CSTAPrivateDataVersionList'(Data); +encode_disp('CSTAVersion',Data) -> 'enc_CSTAVersion'(Data); +encode_disp('CallControlServices',Data) -> 'enc_CallControlServices'(Data); +encode_disp('CallAssociatedServices',Data) -> 'enc_CallAssociatedServices'(Data); +encode_disp('MediaAttachmentServices',Data) -> 'enc_MediaAttachmentServices'(Data); +encode_disp('RouteingServices',Data) -> 'enc_RouteingServices'(Data); +encode_disp('VoiceUnitServices',Data) -> 'enc_VoiceUnitServices'(Data); +encode_disp('LocationServices',Data) -> 'enc_LocationServices'(Data); +encode_disp('CallControlEvents',Data) -> 'enc_CallControlEvents'(Data); +encode_disp('CallAssociatedEvents',Data) -> 'enc_CallAssociatedEvents'(Data); +encode_disp('MediaAttachmentEvents',Data) -> 'enc_MediaAttachmentEvents'(Data); +encode_disp('PhysicalDeviceFeatureEvents',Data) -> 'enc_PhysicalDeviceFeatureEvents'(Data); +encode_disp('LogicalDeviceFeatureEvents',Data) -> 'enc_LogicalDeviceFeatureEvents'(Data); +encode_disp('DeviceMaintenanceEvents',Data) -> 'enc_DeviceMaintenanceEvents'(Data); +encode_disp('VoiceUnitEvents',Data) -> 'enc_VoiceUnitEvents'(Data); +encode_disp('VendorSpecEvents',Data) -> 'enc_VendorSpecEvents'(Data); encode_disp(Type,_Data) -> exit({error,{asn1,{undefined_type,Type}}}). -decode_disp('CSTAFunctionality',Data) -> 'dec_CSTAFunctionality'(Data,mandatory); -decode_disp('SwitchingFunctionServicesC2',Data) -> 'dec_SwitchingFunctionServicesC2'(Data,mandatory); -decode_disp('EventReportServicesC2',Data) -> 'dec_EventReportServicesC2'(Data,mandatory); -decode_disp('ComputingFunctionServicesC2',Data) -> 'dec_ComputingFunctionServicesC2'(Data,mandatory); -decode_disp('BidirectionalServicesC2',Data) -> 'dec_BidirectionalServicesC2'(Data,mandatory); -decode_disp('StatusReportingServicesC2',Data) -> 'dec_StatusReportingServicesC2'(Data,mandatory); -decode_disp('InputOutputServicesC2',Data) -> 'dec_InputOutputServicesC2'(Data,mandatory); -decode_disp('VoiceUnitServicesC2',Data) -> 'dec_VoiceUnitServicesC2'(Data,mandatory); -decode_disp('ACSEUserInformationForCSTA',Data) -> 'dec_ACSEUserInformationForCSTA'(Data,mandatory); -decode_disp('OldACSEUserInformationForCSTA',Data) -> 'dec_OldACSEUserInformationForCSTA'(Data,mandatory); -decode_disp('NewACSEUserInformationForCSTA',Data) -> 'dec_NewACSEUserInformationForCSTA'(Data,mandatory); -decode_disp('CSTAPrivateDataVersionList',Data) -> 'dec_CSTAPrivateDataVersionList'(Data,mandatory); -decode_disp('CSTAVersion',Data) -> 'dec_CSTAVersion'(Data,mandatory); -decode_disp('CallControlServices',Data) -> 'dec_CallControlServices'(Data,mandatory); -decode_disp('CallAssociatedServices',Data) -> 'dec_CallAssociatedServices'(Data,mandatory); -decode_disp('MediaAttachmentServices',Data) -> 'dec_MediaAttachmentServices'(Data,mandatory); -decode_disp('RouteingServices',Data) -> 'dec_RouteingServices'(Data,mandatory); -decode_disp('VoiceUnitServices',Data) -> 'dec_VoiceUnitServices'(Data,mandatory); -decode_disp('LocationServices',Data) -> 'dec_LocationServices'(Data,mandatory); -decode_disp('CallControlEvents',Data) -> 'dec_CallControlEvents'(Data,mandatory); -decode_disp('CallAssociatedEvents',Data) -> 'dec_CallAssociatedEvents'(Data,mandatory); -decode_disp('MediaAttachmentEvents',Data) -> 'dec_MediaAttachmentEvents'(Data,mandatory); -decode_disp('PhysicalDeviceFeatureEvents',Data) -> 'dec_PhysicalDeviceFeatureEvents'(Data,mandatory); -decode_disp('LogicalDeviceFeatureEvents',Data) -> 'dec_LogicalDeviceFeatureEvents'(Data,mandatory); -decode_disp('DeviceMaintenanceEvents',Data) -> 'dec_DeviceMaintenanceEvents'(Data,mandatory); -decode_disp('VoiceUnitEvents',Data) -> 'dec_VoiceUnitEvents'(Data,mandatory); -decode_disp('VendorSpecEvents',Data) -> 'dec_VendorSpecEvents'(Data,mandatory); +decode_disp('CSTAFunctionality',Data) -> 'dec_CSTAFunctionality'(Data); +decode_disp('SwitchingFunctionServicesC2',Data) -> 'dec_SwitchingFunctionServicesC2'(Data); +decode_disp('EventReportServicesC2',Data) -> 'dec_EventReportServicesC2'(Data); +decode_disp('ComputingFunctionServicesC2',Data) -> 'dec_ComputingFunctionServicesC2'(Data); +decode_disp('BidirectionalServicesC2',Data) -> 'dec_BidirectionalServicesC2'(Data); +decode_disp('StatusReportingServicesC2',Data) -> 'dec_StatusReportingServicesC2'(Data); +decode_disp('InputOutputServicesC2',Data) -> 'dec_InputOutputServicesC2'(Data); +decode_disp('VoiceUnitServicesC2',Data) -> 'dec_VoiceUnitServicesC2'(Data); +decode_disp('ACSEUserInformationForCSTA',Data) -> 'dec_ACSEUserInformationForCSTA'(Data); +decode_disp('OldACSEUserInformationForCSTA',Data) -> 'dec_OldACSEUserInformationForCSTA'(Data); +decode_disp('NewACSEUserInformationForCSTA',Data) -> 'dec_NewACSEUserInformationForCSTA'(Data); +decode_disp('CSTAPrivateDataVersionList',Data) -> 'dec_CSTAPrivateDataVersionList'(Data); +decode_disp('CSTAVersion',Data) -> 'dec_CSTAVersion'(Data); +decode_disp('CallControlServices',Data) -> 'dec_CallControlServices'(Data); +decode_disp('CallAssociatedServices',Data) -> 'dec_CallAssociatedServices'(Data); +decode_disp('MediaAttachmentServices',Data) -> 'dec_MediaAttachmentServices'(Data); +decode_disp('RouteingServices',Data) -> 'dec_RouteingServices'(Data); +decode_disp('VoiceUnitServices',Data) -> 'dec_VoiceUnitServices'(Data); +decode_disp('LocationServices',Data) -> 'dec_LocationServices'(Data); +decode_disp('CallControlEvents',Data) -> 'dec_CallControlEvents'(Data); +decode_disp('CallAssociatedEvents',Data) -> 'dec_CallAssociatedEvents'(Data); +decode_disp('MediaAttachmentEvents',Data) -> 'dec_MediaAttachmentEvents'(Data); +decode_disp('PhysicalDeviceFeatureEvents',Data) -> 'dec_PhysicalDeviceFeatureEvents'(Data); +decode_disp('LogicalDeviceFeatureEvents',Data) -> 'dec_LogicalDeviceFeatureEvents'(Data); +decode_disp('DeviceMaintenanceEvents',Data) -> 'dec_DeviceMaintenanceEvents'(Data); +decode_disp('VoiceUnitEvents',Data) -> 'dec_VoiceUnitEvents'(Data); +decode_disp('VendorSpecEvents',Data) -> 'dec_VendorSpecEvents'(Data); decode_disp(Type,_Data) -> exit({error,{asn1,{undefined_type,Type}}}). -wrap_encode(Bytes) when is_list(Bytes) -> - binary_to_list(list_to_binary(Bytes)); -wrap_encode(Bytes) when is_binary(Bytes) -> - binary_to_list(Bytes); -wrap_encode(Bytes) -> Bytes. - -wrap_decode(Bytes) when is_list(Bytes) -> - list_to_binary(Bytes); -wrap_decode(Bytes) -> Bytes. - info() -> - case ?MODULE:module_info() of - MI when is_list(MI) -> - case lists:keysearch(attributes,1,MI) of - {value,{_,Attributes}} when is_list(Attributes) -> - case lists:keysearch(asn1_info,1,Attributes) of - {value,{_,Info}} when is_list(Info) -> - Info; - _ -> - [] - end; - _ -> - [] - end + 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. %%================================ %% CSTAFunctionality %%================================ +'enc_CSTAFunctionality'(Val) -> + 'enc_CSTAFunctionality'(Val, [<<48>>]). + 'enc_CSTAFunctionality'(Val, TagIn) -> +{_,Cindex1, Cindex2, Cindex3, Cindex4, Cindex5, Cindex6, Cindex7} = Val, %%------------------------------------------------- -%% attribute number 1 with type BIT STRING DEFAULT = [] +%% attribute switchingFunctionServices(1) with type BIT STRING DEFAULT = [] %%------------------------------------------------- - {EncBytes1,EncLen1} = case ?RT_BER:cindex(2,Val,switchingFunctionServices) of + {EncBytes1,EncLen1} = case Cindex1 of asn1_DEFAULT -> {<<>>,0}; [] -> {<<>>,0}; _ -> - ?RT_BER:encode_bit_string([], ?RT_BER:cindex(2,Val,switchingFunctionServices), [{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}], [{tag,128,0,'IMPLICIT',32}]) + 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 number 2 with type BIT STRING DEFAULT = [] +%% attribute eventReportServices(2) with type BIT STRING DEFAULT = [] %%------------------------------------------------- - {EncBytes2,EncLen2} = case ?RT_BER:cindex(3,Val,eventReportServices) of + {EncBytes2,EncLen2} = case Cindex2 of asn1_DEFAULT -> {<<>>,0}; [] -> {<<>>,0}; _ -> - ?RT_BER:encode_bit_string([], ?RT_BER:cindex(3,Val,eventReportServices), [{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}], [{tag,128,1,'IMPLICIT',32}]) + 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 number 3 with type BIT STRING DEFAULT = [] +%% attribute computingFunctionServices(3) with type BIT STRING DEFAULT = [] %%------------------------------------------------- - {EncBytes3,EncLen3} = case ?RT_BER:cindex(4,Val,computingFunctionServices) of + {EncBytes3,EncLen3} = case Cindex3 of asn1_DEFAULT -> {<<>>,0}; [] -> {<<>>,0}; _ -> - ?RT_BER:encode_bit_string([], ?RT_BER:cindex(4,Val,computingFunctionServices), [{routeRequest,0},{reRouteRequest,1},{routeSelectRequest,2},{routeUsedRequest,3},{routeEndRequest,4}], [{tag,128,2,'IMPLICIT',32}]) + encode_named_bit_string(Cindex3, [{routeRequest,0},{reRouteRequest,1},{routeSelectRequest,2},{routeUsedRequest,3},{routeEndRequest,4}], [<<130>>]) end, %%------------------------------------------------- -%% attribute number 4 with type BIT STRING DEFAULT = [] +%% attribute bidirectionalServices(4) with type BIT STRING DEFAULT = [] %%------------------------------------------------- - {EncBytes4,EncLen4} = case ?RT_BER:cindex(5,Val,bidirectionalServices) of + {EncBytes4,EncLen4} = case Cindex4 of asn1_DEFAULT -> {<<>>,0}; [] -> {<<>>,0}; _ -> - ?RT_BER:encode_bit_string([], ?RT_BER:cindex(5,Val,bidirectionalServices), [{escapeService,0},{systemStatus,1}], [{tag,128,3,'IMPLICIT',32}]) + encode_named_bit_string(Cindex4, [{escapeService,0},{systemStatus,1}], [<<131>>]) end, %%------------------------------------------------- -%% attribute number 5 with type BIT STRING DEFAULT = [] +%% attribute statusReportingServices(5) with type BIT STRING DEFAULT = [] %%------------------------------------------------- - {EncBytes5,EncLen5} = case ?RT_BER:cindex(6,Val,statusReportingServices) of + {EncBytes5,EncLen5} = case Cindex5 of asn1_DEFAULT -> {<<>>,0}; [] -> {<<>>,0}; _ -> - ?RT_BER:encode_bit_string([], ?RT_BER:cindex(6,Val,statusReportingServices), [{monitorStart,0},{changeMonitorFilter,1},{monitorStop,2},{snapshotDevice,3},{snapshotCall,4}], [{tag,128,4,'IMPLICIT',32}]) + encode_named_bit_string(Cindex5, [{monitorStart,0},{changeMonitorFilter,1},{monitorStop,2},{snapshotDevice,3},{snapshotCall,4}], [<<132>>]) end, %%------------------------------------------------- -%% attribute number 6 with type BIT STRING DEFAULT = [] +%% attribute inputOutputServices(6) with type BIT STRING DEFAULT = [] %%------------------------------------------------- - {EncBytes6,EncLen6} = case ?RT_BER:cindex(7,Val,inputOutputServices) of + {EncBytes6,EncLen6} = case Cindex6 of asn1_DEFAULT -> {<<>>,0}; [] -> {<<>>,0}; _ -> - ?RT_BER:encode_bit_string([], ?RT_BER:cindex(7,Val,inputOutputServices), [{startDataPathService,0},{stopDataPathService,1},{sendDataService,2},{sendMulticastDataService,3},{sendBroadcastDataService,4},{suspendDataPathService,5},{dataPathSuspendedService,6},{resumeDataPath,7},{dataPathResumedService,8},{fastData,9}], [{tag,128,5,'IMPLICIT',32}]) + 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 number 7 with type BIT STRING DEFAULT = [] +%% attribute voiceUnitServices(7) with type BIT STRING DEFAULT = [] %%------------------------------------------------- - {EncBytes7,EncLen7} = case ?RT_BER:cindex(8,Val,voiceUnitServices) of + {EncBytes7,EncLen7} = case Cindex7 of asn1_DEFAULT -> {<<>>,0}; [] -> {<<>>,0}; _ -> - ?RT_BER:encode_bit_string([], ?RT_BER:cindex(8,Val,voiceUnitServices), [{concatenateMessage,0},{deleteMessage,1},{playMessage,2},{queryVoiceAttribute,3},{recordMessage,4},{reposition,5},{resume,6},{review,7},{setVoiceAttribute,8},{stop,9},{suspend,10},{synthesizeMessage,11}], [{tag,128,6,'IMPLICIT',32}]) + 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, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5 + EncLen6 + EncLen7, +encode_tags(TagIn, BytesSoFar, LenSoFar). -'dec_CSTAFunctionality'(Bytes, OptOrMand) -> - 'dec_CSTAFunctionality'(Bytes, OptOrMand, []). +'dec_CSTAFunctionality'(Tlv) -> + 'dec_CSTAFunctionality'(Tlv, [16]). -'dec_CSTAFunctionality'(Bytes, OptOrMand, TagIn) -> +'dec_CSTAFunctionality'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 with type BIT STRING DEFAULT = [] +%% attribute switchingFunctionServices(1) with type BIT STRING DEFAULT = [] %%------------------------------------------------- - {Term1,Bytes3,Rb2} = case Bytes2 of -<<2:2,_:1,0:5,_/binary>> -> -?RT_BER:decode_bit_string(Bytes2,[],[{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}],[{tag,128,0,'IMPLICIT',32}], no_length, mandatory); -_ -> -{[],Bytes2, 0 } +{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 number 2 with type BIT STRING DEFAULT = [] +%% attribute eventReportServices(2) with type BIT STRING DEFAULT = [] %%------------------------------------------------- - {Term2,Bytes4,Rb3} = case Bytes3 of -<<2:2,_:1,1:5,_/binary>> -> -?RT_BER:decode_bit_string(Bytes3,[],[{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}],[{tag,128,1,'IMPLICIT',32}], no_length, mandatory); -_ -> -{[],Bytes3, 0 } +{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 number 3 with type BIT STRING DEFAULT = [] +%% attribute computingFunctionServices(3) with type BIT STRING DEFAULT = [] %%------------------------------------------------- - {Term3,Bytes5,Rb4} = case Bytes4 of -<<2:2,_:1,2:5,_/binary>> -> -?RT_BER:decode_bit_string(Bytes4,[],[{routeRequest,0},{reRouteRequest,1},{routeSelectRequest,2},{routeUsedRequest,3},{routeEndRequest,4}],[{tag,128,2,'IMPLICIT',32}], no_length, mandatory); -_ -> -{[],Bytes4, 0 } +{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 number 4 with type BIT STRING DEFAULT = [] +%% attribute bidirectionalServices(4) with type BIT STRING DEFAULT = [] %%------------------------------------------------- - {Term4,Bytes6,Rb5} = case Bytes5 of -<<2:2,_:1,3:5,_/binary>> -> -?RT_BER:decode_bit_string(Bytes5,[],[{escapeService,0},{systemStatus,1}],[{tag,128,3,'IMPLICIT',32}], no_length, mandatory); -_ -> -{[],Bytes5, 0 } +{Term4,Tlv5} = case Tlv4 of +[{131075,V4}|TempTlv5] -> + {decode_named_bit_string(V4, [{escapeService,0},{systemStatus,1}], []), TempTlv5}; + _ -> + {[],Tlv4} end, %%------------------------------------------------- -%% attribute number 5 with type BIT STRING DEFAULT = [] +%% attribute statusReportingServices(5) with type BIT STRING DEFAULT = [] %%------------------------------------------------- - {Term5,Bytes7,Rb6} = case Bytes6 of -<<2:2,_:1,4:5,_/binary>> -> -?RT_BER:decode_bit_string(Bytes6,[],[{monitorStart,0},{changeMonitorFilter,1},{monitorStop,2},{snapshotDevice,3},{snapshotCall,4}],[{tag,128,4,'IMPLICIT',32}], no_length, mandatory); -_ -> -{[],Bytes6, 0 } +{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 number 6 with type BIT STRING DEFAULT = [] +%% attribute inputOutputServices(6) with type BIT STRING DEFAULT = [] %%------------------------------------------------- - {Term6,Bytes8,Rb7} = case Bytes7 of -<<2:2,_:1,5:5,_/binary>> -> -?RT_BER:decode_bit_string(Bytes7,[],[{startDataPathService,0},{stopDataPathService,1},{sendDataService,2},{sendMulticastDataService,3},{sendBroadcastDataService,4},{suspendDataPathService,5},{dataPathSuspendedService,6},{resumeDataPath,7},{dataPathResumedService,8},{fastData,9}],[{tag,128,5,'IMPLICIT',32}], no_length, mandatory); -_ -> -{[],Bytes7, 0 } +{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 number 7 with type BIT STRING DEFAULT = [] +%% attribute voiceUnitServices(7) with type BIT STRING DEFAULT = [] %%------------------------------------------------- - {Term7,Bytes9,Rb8} = case Bytes8 of -<<2:2,_:1,6:5,_/binary>> -> -?RT_BER:decode_bit_string(Bytes8,[],[{concatenateMessage,0},{deleteMessage,1},{playMessage,2},{queryVoiceAttribute,3},{recordMessage,4},{reposition,5},{resume,6},{review,7},{setVoiceAttribute,8},{stop,9},{suspend,10},{synthesizeMessage,11}],[{tag,128,6,'IMPLICIT',32}], no_length, mandatory); -_ -> -{[],Bytes8, 0 } +{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}. - {Bytes10,Rb9} = ?RT_BER:restbytes2(RemBytes, Bytes9,noext), - {{'CSTAFunctionality', Term1, Term2, Term3, Term4, Term5, Term6, Term7}, Bytes10, Rb1+Rb2+Rb3+Rb4+Rb5+Rb6+Rb7+Rb8+Rb9}. %%================================ %% SwitchingFunctionServicesC2 %%================================ - -'enc_SwitchingFunctionServicesC2'({'SwitchingFunctionServicesC2',Val}, TagIn) -> - 'enc_SwitchingFunctionServicesC2'(Val, TagIn); +'enc_SwitchingFunctionServicesC2'(Val) -> + 'enc_SwitchingFunctionServicesC2'(Val, [<<3>>]). 'enc_SwitchingFunctionServicesC2'(Val, TagIn) -> -?RT_BER:encode_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 ++ []). +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'(Bytes, OptOrMand) -> - 'dec_SwitchingFunctionServicesC2'(Bytes, OptOrMand, []). +'dec_SwitchingFunctionServicesC2'(Tlv) -> + 'dec_SwitchingFunctionServicesC2'(Tlv, [3]). -'dec_SwitchingFunctionServicesC2'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_bit_string(Bytes,[],[{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++[], no_length, OptOrMand). +'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). %%================================ %% EventReportServicesC2 %%================================ - -'enc_EventReportServicesC2'({'EventReportServicesC2',Val}, TagIn) -> - 'enc_EventReportServicesC2'(Val, TagIn); +'enc_EventReportServicesC2'(Val) -> + 'enc_EventReportServicesC2'(Val, [<<3>>]). 'enc_EventReportServicesC2'(Val, TagIn) -> -?RT_BER:encode_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 ++ []). +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'(Bytes, OptOrMand) -> - 'dec_EventReportServicesC2'(Bytes, OptOrMand, []). +'dec_EventReportServicesC2'(Tlv) -> + 'dec_EventReportServicesC2'(Tlv, [3]). -'dec_EventReportServicesC2'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_bit_string(Bytes,[],[{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++[], no_length, OptOrMand). +'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). %%================================ %% ComputingFunctionServicesC2 %%================================ - -'enc_ComputingFunctionServicesC2'({'ComputingFunctionServicesC2',Val}, TagIn) -> - 'enc_ComputingFunctionServicesC2'(Val, TagIn); +'enc_ComputingFunctionServicesC2'(Val) -> + 'enc_ComputingFunctionServicesC2'(Val, [<<3>>]). 'enc_ComputingFunctionServicesC2'(Val, TagIn) -> -?RT_BER:encode_bit_string([], Val, [{routeRequest,0},{reRouteRequest,1},{routeSelectRequest,2},{routeUsedRequest,3},{routeEndRequest,4}], TagIn ++ []). +encode_named_bit_string(Val, [{routeRequest,0},{reRouteRequest,1},{routeSelectRequest,2},{routeUsedRequest,3},{routeEndRequest,4}], TagIn). -'dec_ComputingFunctionServicesC2'(Bytes, OptOrMand) -> - 'dec_ComputingFunctionServicesC2'(Bytes, OptOrMand, []). +'dec_ComputingFunctionServicesC2'(Tlv) -> + 'dec_ComputingFunctionServicesC2'(Tlv, [3]). -'dec_ComputingFunctionServicesC2'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_bit_string(Bytes,[],[{routeRequest,0},{reRouteRequest,1},{routeSelectRequest,2},{routeUsedRequest,3},{routeEndRequest,4}],TagIn++[], no_length, OptOrMand). +'dec_ComputingFunctionServicesC2'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{routeRequest,0},{reRouteRequest,1},{routeSelectRequest,2},{routeUsedRequest,3},{routeEndRequest,4}], TagIn). %%================================ %% BidirectionalServicesC2 %%================================ - -'enc_BidirectionalServicesC2'({'BidirectionalServicesC2',Val}, TagIn) -> - 'enc_BidirectionalServicesC2'(Val, TagIn); +'enc_BidirectionalServicesC2'(Val) -> + 'enc_BidirectionalServicesC2'(Val, [<<3>>]). 'enc_BidirectionalServicesC2'(Val, TagIn) -> -?RT_BER:encode_bit_string([], Val, [{escapeService,0},{systemStatus,1}], TagIn ++ []). +encode_named_bit_string(Val, [{escapeService,0},{systemStatus,1}], TagIn). -'dec_BidirectionalServicesC2'(Bytes, OptOrMand) -> - 'dec_BidirectionalServicesC2'(Bytes, OptOrMand, []). +'dec_BidirectionalServicesC2'(Tlv) -> + 'dec_BidirectionalServicesC2'(Tlv, [3]). -'dec_BidirectionalServicesC2'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_bit_string(Bytes,[],[{escapeService,0},{systemStatus,1}],TagIn++[], no_length, OptOrMand). +'dec_BidirectionalServicesC2'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{escapeService,0},{systemStatus,1}], TagIn). %%================================ %% StatusReportingServicesC2 %%================================ - -'enc_StatusReportingServicesC2'({'StatusReportingServicesC2',Val}, TagIn) -> - 'enc_StatusReportingServicesC2'(Val, TagIn); +'enc_StatusReportingServicesC2'(Val) -> + 'enc_StatusReportingServicesC2'(Val, [<<3>>]). 'enc_StatusReportingServicesC2'(Val, TagIn) -> -?RT_BER:encode_bit_string([], Val, [{monitorStart,0},{changeMonitorFilter,1},{monitorStop,2},{snapshotDevice,3},{snapshotCall,4}], TagIn ++ []). +encode_named_bit_string(Val, [{monitorStart,0},{changeMonitorFilter,1},{monitorStop,2},{snapshotDevice,3},{snapshotCall,4}], TagIn). -'dec_StatusReportingServicesC2'(Bytes, OptOrMand) -> - 'dec_StatusReportingServicesC2'(Bytes, OptOrMand, []). +'dec_StatusReportingServicesC2'(Tlv) -> + 'dec_StatusReportingServicesC2'(Tlv, [3]). -'dec_StatusReportingServicesC2'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_bit_string(Bytes,[],[{monitorStart,0},{changeMonitorFilter,1},{monitorStop,2},{snapshotDevice,3},{snapshotCall,4}],TagIn++[], no_length, OptOrMand). +'dec_StatusReportingServicesC2'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{monitorStart,0},{changeMonitorFilter,1},{monitorStop,2},{snapshotDevice,3},{snapshotCall,4}], TagIn). %%================================ %% InputOutputServicesC2 %%================================ - -'enc_InputOutputServicesC2'({'InputOutputServicesC2',Val}, TagIn) -> - 'enc_InputOutputServicesC2'(Val, TagIn); +'enc_InputOutputServicesC2'(Val) -> + 'enc_InputOutputServicesC2'(Val, [<<3>>]). 'enc_InputOutputServicesC2'(Val, TagIn) -> -?RT_BER:encode_bit_string([], Val, [{startDataPathService,0},{stopDataPathService,1},{sendDataService,2},{sendMulticastDataService,3},{sendBroadcastDataService,4},{suspendDataPathService,5},{dataPathSuspendedService,6},{resumeDataPath,7},{dataPathResumedService,8},{fastData,9}], 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'(Bytes, OptOrMand) -> - 'dec_InputOutputServicesC2'(Bytes, OptOrMand, []). +'dec_InputOutputServicesC2'(Tlv) -> + 'dec_InputOutputServicesC2'(Tlv, [3]). -'dec_InputOutputServicesC2'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_bit_string(Bytes,[],[{startDataPathService,0},{stopDataPathService,1},{sendDataService,2},{sendMulticastDataService,3},{sendBroadcastDataService,4},{suspendDataPathService,5},{dataPathSuspendedService,6},{resumeDataPath,7},{dataPathResumedService,8},{fastData,9}],TagIn++[], no_length, OptOrMand). +'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). %%================================ %% VoiceUnitServicesC2 %%================================ - -'enc_VoiceUnitServicesC2'({'VoiceUnitServicesC2',Val}, TagIn) -> - 'enc_VoiceUnitServicesC2'(Val, TagIn); +'enc_VoiceUnitServicesC2'(Val) -> + 'enc_VoiceUnitServicesC2'(Val, [<<3>>]). 'enc_VoiceUnitServicesC2'(Val, TagIn) -> -?RT_BER:encode_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 ++ []). +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'(Bytes, OptOrMand) -> - 'dec_VoiceUnitServicesC2'(Bytes, OptOrMand, []). +'dec_VoiceUnitServicesC2'(Tlv) -> + 'dec_VoiceUnitServicesC2'(Tlv, [3]). -'dec_VoiceUnitServicesC2'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_bit_string(Bytes,[],[{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++[], no_length, OptOrMand). +'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). %%================================ %% ACSEUserInformationForCSTA %%================================ - -'enc_ACSEUserInformationForCSTA'({'ACSEUserInformationForCSTA',Val}, TagIn) -> - 'enc_ACSEUserInformationForCSTA'(Val, TagIn); +'enc_ACSEUserInformationForCSTA'(Val) -> + 'enc_ACSEUserInformationForCSTA'(Val, []). 'enc_ACSEUserInformationForCSTA'(Val, TagIn) -> {EncBytes,EncLen} = case element(1,Val) of oldDefinition -> - 'enc_OldACSEUserInformationForCSTA'(element(2,Val), []); + 'enc_OldACSEUserInformationForCSTA'(element(2,Val), [<<48>>]); newDefinition -> - 'enc_NewACSEUserInformationForCSTA'(element(2,Val), [{tag,128,0,'IMPLICIT',32}]); + 'enc_NewACSEUserInformationForCSTA'(element(2,Val), [<<160>>]); Else -> exit({error,{asn1,{invalid_choice_type,Else}}}) end, -?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen). +encode_tags(TagIn, EncBytes, EncLen). -'dec_ACSEUserInformationForCSTA'(Bytes, OptOrMand) -> - 'dec_ACSEUserInformationForCSTA'(Bytes, OptOrMand, []). +'dec_ACSEUserInformationForCSTA'(Tlv) -> + 'dec_ACSEUserInformationForCSTA'(Tlv, []). -'dec_ACSEUserInformationForCSTA'(Bytes, OptOrMand, TagIn) -> - {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand), - IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end, - IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end, - case Bytes1 of +'dec_ACSEUserInformationForCSTA'(Tlv, TagIn) -> +Tlv1 = match_tags(Tlv, TagIn), +case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of %% 'oldDefinition' - <<0:2,_:1,16:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_OldACSEUserInformationForCSTA'(Bytes1, mandatory, []), - {{oldDefinition, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {16, V1} -> + {oldDefinition, 'dec_OldACSEUserInformationForCSTA'(V1, [])}; %% 'newDefinition' - <<2:2,_:1,0:5,_/binary>> -> - {Dec, Rest, RbCho} = 'dec_NewACSEUserInformationForCSTA'(Bytes1, mandatory, [{tag,128,0,'IMPLICIT',32}]), - {{newDefinition, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)}; + {131072, V1} -> + {newDefinition, 'dec_NewACSEUserInformationForCSTA'(V1, [])}; Else -> - case OptOrMand of - mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}}); - _ ->exit({error,{asn1,{no_optional_tag,Else}}}) - end - end. + exit({error,{asn1,{invalid_choice_tag,Else}}}) + end +. %%================================ %% OldACSEUserInformationForCSTA %%================================ +'enc_OldACSEUserInformationForCSTA'(Val) -> + 'enc_OldACSEUserInformationForCSTA'(Val, [<<48>>]). + 'enc_OldACSEUserInformationForCSTA'(Val, TagIn) -> +{_,Cindex1, Cindex2, Cindex3} = Val, %%------------------------------------------------- -%% attribute number 1 with type BIT STRING +%% attribute cSTAVersion(1) with type BIT STRING %%------------------------------------------------- - {EncBytes1,EncLen1} = ?RT_BER:encode_bit_string([], ?RT_BER:cindex(2,Val,cSTAVersion), [{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}], []), + {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 number 2 External CSTA-application-context-information-csta3:CSTAFunctionality +%% attribute cSTAFunctionsRequiredByApplication(2) External CSTA-application-context-information-csta3:CSTAFunctionality %%------------------------------------------------- - {EncBytes2,EncLen2} = 'enc_CSTAFunctionality'(?RT_BER:cindex(3,Val,cSTAFunctionsRequiredByApplication), []), + {EncBytes2,EncLen2} = 'enc_CSTAFunctionality'(Cindex2, [<<48>>]), %%------------------------------------------------- -%% attribute number 3 External CSTA-application-context-information-csta3:CSTAFunctionality +%% attribute cSTAFunctionsThatCanBeSupplied(3) External CSTA-application-context-information-csta3:CSTAFunctionality %%------------------------------------------------- - {EncBytes3,EncLen3} = 'enc_CSTAFunctionality'(?RT_BER:cindex(4,Val,cSTAFunctionsThatCanBeSupplied), []), + {EncBytes3,EncLen3} = 'enc_CSTAFunctionality'(Cindex3, [<<48>>]), BytesSoFar = [EncBytes1, EncBytes2, EncBytes3], - LenSoFar = EncLen1 + EncLen2 + EncLen3, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2 + EncLen3, +encode_tags(TagIn, BytesSoFar, LenSoFar). -'dec_OldACSEUserInformationForCSTA'(Bytes, OptOrMand) -> - 'dec_OldACSEUserInformationForCSTA'(Bytes, OptOrMand, []). +'dec_OldACSEUserInformationForCSTA'(Tlv) -> + 'dec_OldACSEUserInformationForCSTA'(Tlv, [16]). -'dec_OldACSEUserInformationForCSTA'(Bytes, OptOrMand, TagIn) -> +'dec_OldACSEUserInformationForCSTA'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 with type BIT STRING +%% attribute cSTAVersion(1) with type BIT STRING %%------------------------------------------------- - {Term1,Bytes3,Rb2} = ?RT_BER:decode_bit_string(Bytes2,[],[{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}],[], no_length, mandatory), +[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 number 2 External CSTA-application-context-information-csta3:CSTAFunctionality +%% attribute cSTAFunctionsRequiredByApplication(2) External CSTA-application-context-information-csta3:CSTAFunctionality %%------------------------------------------------- - {Term2,Bytes4,Rb3} = 'dec_CSTAFunctionality'(Bytes3, mandatory, []), +[V2|Tlv3] = Tlv2, +Term2 = 'dec_CSTAFunctionality'(V2, [16]), %%------------------------------------------------- -%% attribute number 3 External CSTA-application-context-information-csta3:CSTAFunctionality +%% attribute cSTAFunctionsThatCanBeSupplied(3) External CSTA-application-context-information-csta3:CSTAFunctionality %%------------------------------------------------- - {Term3,Bytes5,Rb4} = 'dec_CSTAFunctionality'(Bytes4, mandatory, []), +[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}. - {Bytes6,Rb5} = ?RT_BER:restbytes2(RemBytes, Bytes5,noext), - {{'OldACSEUserInformationForCSTA', Term1, Term2, Term3}, Bytes6, Rb1+Rb2+Rb3+Rb4+Rb5}. %%================================ %% NewACSEUserInformationForCSTA %%================================ +'enc_NewACSEUserInformationForCSTA'(Val) -> + 'enc_NewACSEUserInformationForCSTA'(Val, [<<48>>]). + 'enc_NewACSEUserInformationForCSTA'(Val, TagIn) -> +{_,Cindex1, Cindex2, Cindex3, Cindex4} = Val, %%------------------------------------------------- -%% attribute number 1 with type BIT STRING +%% attribute cSTAVersion(1) with type BIT STRING %%------------------------------------------------- - {EncBytes1,EncLen1} = ?RT_BER:encode_bit_string([], ?RT_BER:cindex(2,Val,cSTAVersion), [{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}], []), + {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 number 2 External CSTA-application-context-information-csta3:CSTAFunctionality OPTIONAL +%% attribute cSTAFunctionsRequiredByApplication(2) External CSTA-application-context-information-csta3:CSTAFunctionality OPTIONAL %%------------------------------------------------- - {EncBytes2,EncLen2} = case ?RT_BER:cindex(3,Val,cSTAFunctionsRequiredByApplication) of + {EncBytes2,EncLen2} = case Cindex2 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_CSTAFunctionality'(?RT_BER:cindex(3,Val,cSTAFunctionsRequiredByApplication), [{tag,128,0,'IMPLICIT',32}]) + 'enc_CSTAFunctionality'(Cindex2, [<<160>>]) end, %%------------------------------------------------- -%% attribute number 3 External CSTA-application-context-information-csta3:CSTAFunctionality OPTIONAL +%% attribute cSTAFunctionsThatCanBeSupplied(3) External CSTA-application-context-information-csta3:CSTAFunctionality OPTIONAL %%------------------------------------------------- - {EncBytes3,EncLen3} = case ?RT_BER:cindex(4,Val,cSTAFunctionsThatCanBeSupplied) of + {EncBytes3,EncLen3} = case Cindex3 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_CSTAFunctionality'(?RT_BER:cindex(4,Val,cSTAFunctionsThatCanBeSupplied), [{tag,128,1,'IMPLICIT',32}]) + 'enc_CSTAFunctionality'(Cindex3, [<<161>>]) end, %%------------------------------------------------- -%% attribute number 4 External CSTA-application-context-information-csta3:CSTAPrivateDataVersionList OPTIONAL +%% attribute cSTAPrivateDataVersionList(4) External CSTA-application-context-information-csta3:CSTAPrivateDataVersionList OPTIONAL %%------------------------------------------------- - {EncBytes4,EncLen4} = case ?RT_BER:cindex(5,Val,cSTAPrivateDataVersionList) of + {EncBytes4,EncLen4} = case Cindex4 of asn1_NOVALUE -> {<<>>,0}; _ -> - 'enc_CSTAPrivateDataVersionList'(?RT_BER:cindex(5,Val,cSTAPrivateDataVersionList), [{tag,128,2,'IMPLICIT',32}]) + 'enc_CSTAPrivateDataVersionList'(Cindex4, [<<162>>]) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4], - LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4, - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar). +LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4, +encode_tags(TagIn, BytesSoFar, LenSoFar). -'dec_NewACSEUserInformationForCSTA'(Bytes, OptOrMand) -> - 'dec_NewACSEUserInformationForCSTA'(Bytes, OptOrMand, []). +'dec_NewACSEUserInformationForCSTA'(Tlv) -> + 'dec_NewACSEUserInformationForCSTA'(Tlv, [16]). -'dec_NewACSEUserInformationForCSTA'(Bytes, OptOrMand, TagIn) -> +'dec_NewACSEUserInformationForCSTA'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), -{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len), +Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute number 1 with type BIT STRING +%% attribute cSTAVersion(1) with type BIT STRING %%------------------------------------------------- - {Term1,Bytes3,Rb2} = ?RT_BER:decode_bit_string(Bytes2,[],[{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}],[], no_length, mandatory), +[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 number 2 External CSTA-application-context-information-csta3:CSTAFunctionality OPTIONAL +%% attribute cSTAFunctionsRequiredByApplication(2) External CSTA-application-context-information-csta3:CSTAFunctionality OPTIONAL %%------------------------------------------------- - {Term2,Bytes4,Rb3} = case Bytes3 of -<<2:2,_:1,0:5,_/binary>> -> -'dec_CSTAFunctionality'(Bytes3, opt_or_default, [{tag,128,0,'IMPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes3, 0 } +{Term2,Tlv3} = case Tlv2 of +[{131072,V2}|TempTlv3] -> + {'dec_CSTAFunctionality'(V2, []), TempTlv3}; + _ -> + { asn1_NOVALUE, Tlv2} end, %%------------------------------------------------- -%% attribute number 3 External CSTA-application-context-information-csta3:CSTAFunctionality OPTIONAL +%% attribute cSTAFunctionsThatCanBeSupplied(3) External CSTA-application-context-information-csta3:CSTAFunctionality OPTIONAL %%------------------------------------------------- - {Term3,Bytes5,Rb4} = case Bytes4 of -<<2:2,_:1,1:5,_/binary>> -> -'dec_CSTAFunctionality'(Bytes4, opt_or_default, [{tag,128,1,'IMPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes4, 0 } +{Term3,Tlv4} = case Tlv3 of +[{131073,V3}|TempTlv4] -> + {'dec_CSTAFunctionality'(V3, []), TempTlv4}; + _ -> + { asn1_NOVALUE, Tlv3} end, %%------------------------------------------------- -%% attribute number 4 External CSTA-application-context-information-csta3:CSTAPrivateDataVersionList OPTIONAL +%% attribute cSTAPrivateDataVersionList(4) External CSTA-application-context-information-csta3:CSTAPrivateDataVersionList OPTIONAL %%------------------------------------------------- - {Term4,Bytes6,Rb5} = case Bytes5 of -<<2:2,_:1,2:5,_/binary>> -> -'dec_CSTAPrivateDataVersionList'(Bytes5, opt_or_default, [{tag,128,2,'IMPLICIT',32}]); -_ -> -{ asn1_NOVALUE, Bytes5, 0 } +{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}. - {Bytes7,Rb6} = ?RT_BER:restbytes2(RemBytes, Bytes6,noext), - {{'NewACSEUserInformationForCSTA', Term1, Term2, Term3, Term4}, Bytes7, Rb1+Rb2+Rb3+Rb4+Rb5+Rb6}. %%================================ %% CSTAPrivateDataVersionList %%================================ - -'enc_CSTAPrivateDataVersionList'({'CSTAPrivateDataVersionList',Val}, TagIn) -> - 'enc_CSTAPrivateDataVersionList'(Val, TagIn); +'enc_CSTAPrivateDataVersionList'(Val) -> + 'enc_CSTAPrivateDataVersionList'(Val, [<<48>>]). 'enc_CSTAPrivateDataVersionList'(Val, TagIn) -> {EncBytes,EncLen} = 'enc_CSTAPrivateDataVersionList_components'(Val,[],0), - ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], EncBytes, EncLen). + encode_tags(TagIn, EncBytes, EncLen). 'enc_CSTAPrivateDataVersionList_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen}; 'enc_CSTAPrivateDataVersionList_components'([H|T],AccBytes, AccLen) -> - {EncBytes,EncLen} = ?RT_BER:encode_integer([], H, []), + {EncBytes,EncLen} = encode_integer(H, [<<2>>]), 'enc_CSTAPrivateDataVersionList_components'(T,[EncBytes|AccBytes], AccLen + EncLen). -'dec_CSTAPrivateDataVersionList'(Bytes, OptOrMand) -> - 'dec_CSTAPrivateDataVersionList'(Bytes, OptOrMand, []). +'dec_CSTAPrivateDataVersionList'(Tlv) -> + 'dec_CSTAPrivateDataVersionList'(Tlv, [16]). -'dec_CSTAPrivateDataVersionList'(Bytes, OptOrMand, TagIn) -> +'dec_CSTAPrivateDataVersionList'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%------------------------------------------------- - {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), - ?RT_BER:decode_components(Rb1, Len, Bytes1, fun(FBytes,_,_)-> -?RT_BER:decode_integer(FBytes,[],[], mandatory) -end, [], []). +Tlv1 = match_tags(Tlv, TagIn), +[decode_integer(V1, [2]) || V1 <- Tlv1]. @@ -750,283 +728,517 @@ end, [], []). %%================================ %% CSTAVersion %%================================ - -'enc_CSTAVersion'({'CSTAVersion',Val}, TagIn) -> - 'enc_CSTAVersion'(Val, TagIn); +'enc_CSTAVersion'(Val) -> + 'enc_CSTAVersion'(Val, [<<3>>]). 'enc_CSTAVersion'(Val, TagIn) -> -?RT_BER:encode_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 ++ []). +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'(Bytes, OptOrMand) -> - 'dec_CSTAVersion'(Bytes, OptOrMand, []). +'dec_CSTAVersion'(Tlv) -> + 'dec_CSTAVersion'(Tlv, [3]). -'dec_CSTAVersion'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_bit_string(Bytes,[],[{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++[], no_length, OptOrMand). +'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). %%================================ %% CallControlServices %%================================ - -'enc_CallControlServices'({'CallControlServices',Val}, TagIn) -> - 'enc_CallControlServices'(Val, TagIn); +'enc_CallControlServices'(Val) -> + 'enc_CallControlServices'(Val, [<<3>>]). 'enc_CallControlServices'(Val, TagIn) -> -?RT_BER:encode_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 ++ []). +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'(Bytes, OptOrMand) -> - 'dec_CallControlServices'(Bytes, OptOrMand, []). +'dec_CallControlServices'(Tlv) -> + 'dec_CallControlServices'(Tlv, [3]). -'dec_CallControlServices'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_bit_string(Bytes,[],[{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++[], no_length, OptOrMand). +'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). %%================================ %% CallAssociatedServices %%================================ - -'enc_CallAssociatedServices'({'CallAssociatedServices',Val}, TagIn) -> - 'enc_CallAssociatedServices'(Val, TagIn); +'enc_CallAssociatedServices'(Val) -> + 'enc_CallAssociatedServices'(Val, [<<3>>]). 'enc_CallAssociatedServices'(Val, TagIn) -> -?RT_BER:encode_bit_string([], Val, [{associateData,0},{cancelTelephonyTones,1},{generateDigits,2},{generateTelephonyTones,3},{sendUserInformation,4},{changeConnectionInformation,5}], TagIn ++ []). +encode_named_bit_string(Val, [{associateData,0},{cancelTelephonyTones,1},{generateDigits,2},{generateTelephonyTones,3},{sendUserInformation,4},{changeConnectionInformation,5}], TagIn). -'dec_CallAssociatedServices'(Bytes, OptOrMand) -> - 'dec_CallAssociatedServices'(Bytes, OptOrMand, []). +'dec_CallAssociatedServices'(Tlv) -> + 'dec_CallAssociatedServices'(Tlv, [3]). -'dec_CallAssociatedServices'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_bit_string(Bytes,[],[{associateData,0},{cancelTelephonyTones,1},{generateDigits,2},{generateTelephonyTones,3},{sendUserInformation,4},{changeConnectionInformation,5}],TagIn++[], no_length, OptOrMand). +'dec_CallAssociatedServices'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{associateData,0},{cancelTelephonyTones,1},{generateDigits,2},{generateTelephonyTones,3},{sendUserInformation,4},{changeConnectionInformation,5}], TagIn). %%================================ %% MediaAttachmentServices %%================================ - -'enc_MediaAttachmentServices'({'MediaAttachmentServices',Val}, TagIn) -> - 'enc_MediaAttachmentServices'(Val, TagIn); +'enc_MediaAttachmentServices'(Val) -> + 'enc_MediaAttachmentServices'(Val, [<<3>>]). 'enc_MediaAttachmentServices'(Val, TagIn) -> -?RT_BER:encode_bit_string([], Val, [{attachMediaService,0},{detachMediaService,1}], TagIn ++ []). +encode_named_bit_string(Val, [{attachMediaService,0},{detachMediaService,1}], TagIn). -'dec_MediaAttachmentServices'(Bytes, OptOrMand) -> - 'dec_MediaAttachmentServices'(Bytes, OptOrMand, []). +'dec_MediaAttachmentServices'(Tlv) -> + 'dec_MediaAttachmentServices'(Tlv, [3]). -'dec_MediaAttachmentServices'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_bit_string(Bytes,[],[{attachMediaService,0},{detachMediaService,1}],TagIn++[], no_length, OptOrMand). +'dec_MediaAttachmentServices'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{attachMediaService,0},{detachMediaService,1}], TagIn). %%================================ %% RouteingServices %%================================ - -'enc_RouteingServices'({'RouteingServices',Val}, TagIn) -> - 'enc_RouteingServices'(Val, TagIn); +'enc_RouteingServices'(Val) -> + 'enc_RouteingServices'(Val, [<<3>>]). 'enc_RouteingServices'(Val, TagIn) -> -?RT_BER:encode_bit_string([], Val, [{routeRegister,0},{routeRegisterCancel,1},{routeRegisterAbort,2},{reroute,3},{routeEnd,4},{routeReject,5},{routeRequest,6},{routeSelect,7},{routeUsed,8}], 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'(Bytes, OptOrMand) -> - 'dec_RouteingServices'(Bytes, OptOrMand, []). +'dec_RouteingServices'(Tlv) -> + 'dec_RouteingServices'(Tlv, [3]). -'dec_RouteingServices'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_bit_string(Bytes,[],[{routeRegister,0},{routeRegisterCancel,1},{routeRegisterAbort,2},{reroute,3},{routeEnd,4},{routeReject,5},{routeRequest,6},{routeSelect,7},{routeUsed,8}],TagIn++[], no_length, OptOrMand). +'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). %%================================ %% VoiceUnitServices %%================================ - -'enc_VoiceUnitServices'({'VoiceUnitServices',Val}, TagIn) -> - 'enc_VoiceUnitServices'(Val, TagIn); +'enc_VoiceUnitServices'(Val) -> + 'enc_VoiceUnitServices'(Val, [<<3>>]). 'enc_VoiceUnitServices'(Val, TagIn) -> -?RT_BER:encode_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 ++ []). +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'(Bytes, OptOrMand) -> - 'dec_VoiceUnitServices'(Bytes, OptOrMand, []). +'dec_VoiceUnitServices'(Tlv) -> + 'dec_VoiceUnitServices'(Tlv, [3]). -'dec_VoiceUnitServices'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_bit_string(Bytes,[],[{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++[], no_length, OptOrMand). +'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). %%================================ %% LocationServices %%================================ - -'enc_LocationServices'({'LocationServices',Val}, TagIn) -> - 'enc_LocationServices'(Val, TagIn); +'enc_LocationServices'(Val) -> + 'enc_LocationServices'(Val, [<<3>>]). 'enc_LocationServices'(Val, TagIn) -> -?RT_BER:encode_bit_string([], Val, [{getLocationInformation,0},{setLocationInformation,1},{locationTrackkingSessionResumed,2},{locationTrackkingSessionSuspended,3},{resumeLocationTrackingSession,4},{locationInformationReport,5},{startLocationTrackingSession,6},{stopLocationTrackingSession,7},{suspendLocationTrackingCapabilities,8},{locationSessionInfo,9}], 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'(Bytes, OptOrMand) -> - 'dec_LocationServices'(Bytes, OptOrMand, []). +'dec_LocationServices'(Tlv) -> + 'dec_LocationServices'(Tlv, [3]). -'dec_LocationServices'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_bit_string(Bytes,[],[{getLocationInformation,0},{setLocationInformation,1},{locationTrackkingSessionResumed,2},{locationTrackkingSessionSuspended,3},{resumeLocationTrackingSession,4},{locationInformationReport,5},{startLocationTrackingSession,6},{stopLocationTrackingSession,7},{suspendLocationTrackingCapabilities,8},{locationSessionInfo,9}],TagIn++[], no_length, OptOrMand). +'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). %%================================ %% CallControlEvents %%================================ - -'enc_CallControlEvents'({'CallControlEvents',Val}, TagIn) -> - 'enc_CallControlEvents'(Val, TagIn); +'enc_CallControlEvents'(Val) -> + 'enc_CallControlEvents'(Val, [<<3>>]). 'enc_CallControlEvents'(Val, TagIn) -> -?RT_BER:encode_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 ++ []). +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'(Bytes, OptOrMand) -> - 'dec_CallControlEvents'(Bytes, OptOrMand, []). +'dec_CallControlEvents'(Tlv) -> + 'dec_CallControlEvents'(Tlv, [3]). -'dec_CallControlEvents'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_bit_string(Bytes,[],[{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++[], no_length, OptOrMand). +'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). %%================================ %% CallAssociatedEvents %%================================ - -'enc_CallAssociatedEvents'({'CallAssociatedEvents',Val}, TagIn) -> - 'enc_CallAssociatedEvents'(Val, TagIn); +'enc_CallAssociatedEvents'(Val) -> + 'enc_CallAssociatedEvents'(Val, [<<3>>]). 'enc_CallAssociatedEvents'(Val, TagIn) -> -?RT_BER:encode_bit_string([], Val, [{callInformation,0},{charging,1},{dTMFDigitsDetected,2},{telephonyTonesDetected,3},{serviceCompletionFailure,4}], TagIn ++ []). +encode_named_bit_string(Val, [{callInformation,0},{charging,1},{dTMFDigitsDetected,2},{telephonyTonesDetected,3},{serviceCompletionFailure,4}], TagIn). -'dec_CallAssociatedEvents'(Bytes, OptOrMand) -> - 'dec_CallAssociatedEvents'(Bytes, OptOrMand, []). +'dec_CallAssociatedEvents'(Tlv) -> + 'dec_CallAssociatedEvents'(Tlv, [3]). -'dec_CallAssociatedEvents'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_bit_string(Bytes,[],[{callInformation,0},{charging,1},{dTMFDigitsDetected,2},{telephonyTonesDetected,3},{serviceCompletionFailure,4}],TagIn++[], no_length, OptOrMand). +'dec_CallAssociatedEvents'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{callInformation,0},{charging,1},{dTMFDigitsDetected,2},{telephonyTonesDetected,3},{serviceCompletionFailure,4}], TagIn). %%================================ %% MediaAttachmentEvents %%================================ - -'enc_MediaAttachmentEvents'({'MediaAttachmentEvents',Val}, TagIn) -> - 'enc_MediaAttachmentEvents'(Val, TagIn); +'enc_MediaAttachmentEvents'(Val) -> + 'enc_MediaAttachmentEvents'(Val, [<<3>>]). 'enc_MediaAttachmentEvents'(Val, TagIn) -> -?RT_BER:encode_bit_string([], Val, [{mediaAttached,0},{mediaDetached,1}], TagIn ++ []). +encode_named_bit_string(Val, [{mediaAttached,0},{mediaDetached,1}], TagIn). -'dec_MediaAttachmentEvents'(Bytes, OptOrMand) -> - 'dec_MediaAttachmentEvents'(Bytes, OptOrMand, []). +'dec_MediaAttachmentEvents'(Tlv) -> + 'dec_MediaAttachmentEvents'(Tlv, [3]). -'dec_MediaAttachmentEvents'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_bit_string(Bytes,[],[{mediaAttached,0},{mediaDetached,1}],TagIn++[], no_length, OptOrMand). +'dec_MediaAttachmentEvents'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{mediaAttached,0},{mediaDetached,1}], TagIn). %%================================ %% PhysicalDeviceFeatureEvents %%================================ - -'enc_PhysicalDeviceFeatureEvents'({'PhysicalDeviceFeatureEvents',Val}, TagIn) -> - 'enc_PhysicalDeviceFeatureEvents'(Val, TagIn); +'enc_PhysicalDeviceFeatureEvents'(Val) -> + 'enc_PhysicalDeviceFeatureEvents'(Val, [<<3>>]). 'enc_PhysicalDeviceFeatureEvents'(Val, TagIn) -> -?RT_BER:encode_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 ++ []). +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'(Bytes, OptOrMand) -> - 'dec_PhysicalDeviceFeatureEvents'(Bytes, OptOrMand, []). +'dec_PhysicalDeviceFeatureEvents'(Tlv) -> + 'dec_PhysicalDeviceFeatureEvents'(Tlv, [3]). -'dec_PhysicalDeviceFeatureEvents'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_bit_string(Bytes,[],[{buttonInformation,0},{buttonPress,1},{displayUpdated,2},{hookswitch,3},{lampMode,4},{messageWaiting,5},{microphoneGain,6},{microphoneMute,7},{ringerStatus,8},{speakerMute,9},{speakerVolume,10}],TagIn++[], no_length, OptOrMand). +'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). %%================================ %% LogicalDeviceFeatureEvents %%================================ - -'enc_LogicalDeviceFeatureEvents'({'LogicalDeviceFeatureEvents',Val}, TagIn) -> - 'enc_LogicalDeviceFeatureEvents'(Val, TagIn); +'enc_LogicalDeviceFeatureEvents'(Val) -> + 'enc_LogicalDeviceFeatureEvents'(Val, [<<3>>]). 'enc_LogicalDeviceFeatureEvents'(Val, TagIn) -> -?RT_BER:encode_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 ++ []). +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'(Bytes, OptOrMand) -> - 'dec_LogicalDeviceFeatureEvents'(Bytes, OptOrMand, []). +'dec_LogicalDeviceFeatureEvents'(Tlv) -> + 'dec_LogicalDeviceFeatureEvents'(Tlv, [3]). -'dec_LogicalDeviceFeatureEvents'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_bit_string(Bytes,[],[{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++[], no_length, OptOrMand). +'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). %%================================ %% DeviceMaintenanceEvents %%================================ - -'enc_DeviceMaintenanceEvents'({'DeviceMaintenanceEvents',Val}, TagIn) -> - 'enc_DeviceMaintenanceEvents'(Val, TagIn); +'enc_DeviceMaintenanceEvents'(Val) -> + 'enc_DeviceMaintenanceEvents'(Val, [<<3>>]). 'enc_DeviceMaintenanceEvents'(Val, TagIn) -> -?RT_BER:encode_bit_string([], Val, [{backInService,0},{outOfService,1},{deviceCapabilityChanged,2},{partiallyInService,3}], TagIn ++ []). +encode_named_bit_string(Val, [{backInService,0},{outOfService,1},{deviceCapabilityChanged,2},{partiallyInService,3}], TagIn). -'dec_DeviceMaintenanceEvents'(Bytes, OptOrMand) -> - 'dec_DeviceMaintenanceEvents'(Bytes, OptOrMand, []). +'dec_DeviceMaintenanceEvents'(Tlv) -> + 'dec_DeviceMaintenanceEvents'(Tlv, [3]). -'dec_DeviceMaintenanceEvents'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_bit_string(Bytes,[],[{backInService,0},{outOfService,1},{deviceCapabilityChanged,2},{partiallyInService,3}],TagIn++[], no_length, OptOrMand). +'dec_DeviceMaintenanceEvents'(Tlv, TagIn) -> +decode_named_bit_string(Tlv, [{backInService,0},{outOfService,1},{deviceCapabilityChanged,2},{partiallyInService,3}], TagIn). %%================================ %% VoiceUnitEvents %%================================ - -'enc_VoiceUnitEvents'({'VoiceUnitEvents',Val}, TagIn) -> - 'enc_VoiceUnitEvents'(Val, TagIn); +'enc_VoiceUnitEvents'(Val) -> + 'enc_VoiceUnitEvents'(Val, [<<3>>]). 'enc_VoiceUnitEvents'(Val, TagIn) -> -?RT_BER:encode_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 ++ []). +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'(Bytes, OptOrMand) -> - 'dec_VoiceUnitEvents'(Bytes, OptOrMand, []). +'dec_VoiceUnitEvents'(Tlv) -> + 'dec_VoiceUnitEvents'(Tlv, [3]). -'dec_VoiceUnitEvents'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_bit_string(Bytes,[],[{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++[], no_length, OptOrMand). +'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). %%================================ %% VendorSpecEvents %%================================ - -'enc_VendorSpecEvents'({'VendorSpecEvents',Val}, TagIn) -> - 'enc_VendorSpecEvents'(Val, TagIn); +'enc_VendorSpecEvents'(Val) -> + 'enc_VendorSpecEvents'(Val, [<<3>>]). 'enc_VendorSpecEvents'(Val, TagIn) -> -?RT_BER:encode_bit_string([], Val, [{privateEvent,0}], TagIn ++ []). - - -'dec_VendorSpecEvents'(Bytes, OptOrMand) -> - 'dec_VendorSpecEvents'(Bytes, OptOrMand, []). - -'dec_VendorSpecEvents'(Bytes, OptOrMand, TagIn) -> -?RT_BER:decode_bit_string(Bytes,[],[{privateEvent,0}],TagIn++[], no_length, OptOrMand). - +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). + + +%%% +%%% Run-time functions. +%%% + +'dialyzer-suppressions'(Arg) -> + ok. + +ber_decode_nif(B) -> + asn1rt_nif:decode_ber_tlv(B). + +collect_parts(TlvList) -> + collect_parts(TlvList, []). + +collect_parts([{_,L}|Rest], Acc) when is_list(L) -> + collect_parts(Rest, [collect_parts(L)|Acc]); +collect_parts([{3,<>}|Rest], _Acc) -> + collect_parts_bit(Rest, [Bits], Unused); +collect_parts([{_T,V}|Rest], Acc) -> + collect_parts(Rest, [V|Acc]); +collect_parts([], Acc) -> + list_to_binary(lists:reverse(Acc)). + +collect_parts_bit([{3,<>}|Rest], Acc, Uacc) -> + collect_parts_bit(Rest, [Bits|Acc], Unused + Uacc); +collect_parts_bit([], Acc, Uacc) -> + list_to_binary([Uacc|lists:reverse(Acc)]). + +decode_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. + +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). + +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, 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_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, []). + +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