📄 megaco_binary_transformer_prev3a.erl
字号:
onInterruptByNewSignalDescr -> onInterruptByNewSignalDescr; otherReason -> otherReason end.tr_opt_SignalType(asn1_NOVALUE = Type, _State) -> Type;tr_opt_SignalType(Type, _State) -> case Type of brief -> brief; onOff -> onOff; timeOut -> timeOut end.tr_opt_SignalDirection(asn1_NOVALUE = SD, _State) -> SD;tr_opt_SignalDirection(SD, _State) -> case SD of internal -> internal; external -> external; both -> both end. tr_SignalName(Name, State) -> Constraint = fun(Item) -> tr_PkgdName(Item, State) end, resolve(signal, Name, State, Constraint).tr_SigParameter(#'SigParameter'{sigParameterName = ParName, value = Value, extraInfo = Extra}, SigName, State) -> Constraint = fun(Item) -> tr_Name(Item, State) end, N = resolve({signal_parameter, SigName}, ParName, State, Constraint), #'SigParameter'{sigParameterName = N, value = tr_Value(Value, State), extraInfo = tr_opt_extraInfo(Extra, State)}.tr_opt_RequestID(asn1_NOVALUE, _State) -> asn1_NOVALUE;tr_opt_RequestID(Id, State) -> tr_RequestID(Id, State).tr_RequestID(Id, _State) when Id == ?megaco_all_request_id -> ?megaco_all_request_id;tr_RequestID(Id, State) -> tr_UINT32(Id, State).tr_ModemDescriptor(_MD, _State) -> deprecated.tr_DigitMapDescriptor(#'DigitMapDescriptor'{digitMapName = Name, digitMapValue = Value}, State) -> #'DigitMapDescriptor'{digitMapName = tr_opt_DigitMapName(Name, State), digitMapValue = tr_opt_DigitMapValue(Value, State)}.tr_opt_DigitMapName(asn1_NOVALUE, _State) -> asn1_NOVALUE;tr_opt_DigitMapName(Name, State) -> tr_DigitMapName(Name, State).tr_DigitMapName(Name, State) -> Constraint = fun(Item) -> tr_Name(Item, State) end, resolve(dialplan, Name, State, Constraint).tr_opt_DigitMapValue(asn1_NOVALUE, _State) -> asn1_NOVALUE;tr_opt_DigitMapValue(Value, State) -> tr_DigitMapValue(Value, State).tr_DigitMapValue(#'DigitMapValue'{digitMapBody = Body, startTimer = Start, shortTimer = Short, longTimer = Long}, State) -> #'DigitMapValue'{startTimer = tr_opt_timer(Start, State), shortTimer = tr_opt_timer(Short, State), longTimer = tr_opt_timer(Long, State), digitMapBody = tr_STRING(Body, State)}. %% BUGBUG: digitMapBody not handled at alltr_opt_timer(asn1_NOVALUE, _State) -> asn1_NOVALUE;tr_opt_timer(Timer, State) -> tr_DIGIT(Timer, State, 0, 99).tr_ServiceChangeParm( #'ServiceChangeParm'{serviceChangeMethod = Method, serviceChangeAddress = Addr, serviceChangeVersion = Version, serviceChangeProfile = Profile, serviceChangeReason = Reason, serviceChangeDelay = Delay, serviceChangeMgcId = MgcId, timeStamp = Time, serviceChangeInfo = Info, serviceChangeIncompleteFlag = Incomplete}, State) -> Method2 = tr_ServiceChangeMethod(Method, State), Addr2 = tr_opt_ServiceChangeAddress(Addr, State), Version2 = tr_opt_serviceChangeVersion(Version, State), Profile2 = tr_opt_ServiceChangeProfile(Profile, State), Reason2 = tr_serviceChangeReason(Reason, State), Delay2 = tr_opt_serviceChangeDelay(Delay, State), MgcId2 = tr_opt_serviceChangeMgcId(MgcId, State), Time2 = tr_opt_TimeNotation(Time, State), Info2 = tr_opt_AuditDescriptor(Info, State), Incomplete2 = tr_opt_null(Incomplete, State), #'ServiceChangeParm'{serviceChangeMethod = Method2, serviceChangeAddress = Addr2, serviceChangeVersion = Version2, serviceChangeProfile = Profile2, serviceChangeReason = Reason2, serviceChangeDelay = Delay2, serviceChangeMgcId = MgcId2, timeStamp = Time2, serviceChangeInfo = Info2, serviceChangeIncompleteFlag = Incomplete2}.tr_ServiceChangeMethod(Method, _State) -> case Method of failover -> failover; forced -> forced; graceful -> graceful; restart -> restart; disconnected -> disconnected; handOff -> handOff end. %% BUGBUG: extensiontr_opt_ServiceChangeAddress(asn1_NOVALUE, _State) -> asn1_NOVALUE;tr_opt_ServiceChangeAddress({Tag, Val}, State) -> Val2 = case Tag of portNumber -> tr_portNumber(Val, State); ip4Address -> tr_IP4Address(Val, State); ip6Address -> tr_IP6Address(Val, State); domainName -> tr_DomainName(Val, State); deviceName -> tr_PathName(Val, State); mtpAddress -> tr_mtpAddress(Val, State) end, {Tag, Val2}.tr_opt_serviceChangeVersion(asn1_NOVALUE, _State) -> asn1_NOVALUE;tr_opt_serviceChangeVersion(Version, State) -> tr_version(Version, State).tr_opt_ServiceChangeProfile(asn1_NOVALUE, _State) -> asn1_NOVALUE;%% Decodetr_opt_ServiceChangeProfile({'ServiceChangeProfile', ProfileName}, State) -> case string:tokens(ProfileName, "/") of [Name0, Version0] -> Name = tr_STRING(Name0, State, 1, 64), Version = tr_version(list_to_integer(Version0), State), #'ServiceChangeProfile'{profileName = Name, version = Version} end;%% Encodetr_opt_ServiceChangeProfile(#'ServiceChangeProfile'{profileName = Name0, version = Version0}, State) -> Name = tr_STRING(Name0, State, 1, 64), Version = tr_version(Version0, State), ProfileName = lists:flatten(io_lib:format("~s/~w", [Name, Version])), {'ServiceChangeProfile', ProfileName}. tr_serviceChangeReason([_] = Reason, State) -> tr_Value(Reason, State).tr_opt_serviceChangeDelay(asn1_NOVALUE, _State) -> asn1_NOVALUE;tr_opt_serviceChangeDelay(Delay, State) -> tr_UINT32(Delay, State).tr_opt_serviceChangeMgcId(asn1_NOVALUE, _State) -> asn1_NOVALUE;tr_opt_serviceChangeMgcId(MgcId, State) -> tr_MId(MgcId, State).tr_opt_portNumber(asn1_NOVALUE, _State) -> asn1_NOVALUE;tr_opt_portNumber(Port, State) -> tr_portNumber(Port, State).tr_portNumber(Port, State) when integer(Port), Port >= 0 -> tr_UINT16(Port, State).tr_ServiceChangeResParm(#'ServiceChangeResParm'{serviceChangeMgcId = MgcId, serviceChangeAddress = Addr, serviceChangeVersion = Version, serviceChangeProfile = Profile, timeStamp = Time}, State) -> #'ServiceChangeResParm'{serviceChangeMgcId = tr_opt_serviceChangeMgcId(MgcId, State), serviceChangeAddress = tr_opt_ServiceChangeAddress(Addr, State), serviceChangeVersion = tr_opt_serviceChangeVersion(Version, State), serviceChangeProfile = tr_opt_ServiceChangeProfile(Profile, State), timeStamp = tr_opt_TimeNotation(Time, State)}.tr_PackagesDescriptor(Items, State) when list(Items) -> [tr_PackagesItem(I, State) || I <- Items].tr_PackagesItem(#'PackagesItem'{packageName = Name, packageVersion = Version}, State) -> Constraint = fun(Item) -> tr_Name(Item, State) end, #'PackagesItem'{packageName = resolve(package, Name, State, Constraint), packageVersion = tr_UINT16(Version, State)}.tr_opt_StatisticsDescriptor(asn1_NOVALUE, _State) -> asn1_NOVALUE;tr_opt_StatisticsDescriptor(Parms, State) -> tr_StatisticsDescriptor(Parms, State).tr_StatisticsDescriptor(Parms, State) when list(Parms) -> [tr_StatisticsParameter(P, State) || P <- Parms].tr_StatisticsParameter(#'StatisticsParameter'{statName = Name, statValue = Value}, State) -> Constraint = fun(Item) -> tr_PkgdName(Item, State) end, #'StatisticsParameter'{statName = resolve(statistics, Name, State, Constraint), statValue = tr_opt_Value(Value, State)}.tr_opt_TimeNotation(asn1_NOVALUE, _State) -> asn1_NOVALUE;tr_opt_TimeNotation(#'TimeNotation'{date = Date, time = Time}, State) -> #'TimeNotation'{date = tr_STRING(Date, State, 8, 8), % "yyyymmdd" time = tr_STRING(Time, State, 8, 8)}.% "hhmmssss"%% BUGBUG: Does not verify that string must contain at least one char%% BUGBUG: This violation of the is required in order to comply with%% BUGBUG: the dd/ce ds parameter that may possibly be empty.tr_opt_Value(asn1_NOVALUE, _State) -> asn1_NOVALUE;tr_opt_Value(Value, State) -> tr_Value(Value, State).tr_Value(Strings, _State) when list(Strings) -> [[Char || Char <- String] || String <- Strings].%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Encode an octet string, escape } by \ if necessary tr_OCTET_STRING(String, _State, Min, Max) when list(String) -> verify_count(length(String), Min, Max), String.tr_QUOTED_STRING(String, _State) when list(String) -> verify_count(length(String), 1, infinity), String.%% The internal format of hex digits is a list of octets%% Min and Max means #hexDigits%% Leading zeros are prepended in order to fulfill Mintr_HEXDIG(Octets, _State, Min, Max) when list(Octets) -> verify_count(length(Octets), Min, Max), Octets.tr_DIGIT(Val, State, Min, Max) -> tr_integer(Val, State, Min, Max).tr_STRING(String, _State) when list(String) -> String.tr_STRING(String, _State, Min, Max) when list(String) -> verify_count(length(String), Min, Max), String.tr_opt_UINT16(Val, State) -> tr_opt_integer(Val, State, 0, 65535).tr_UINT16(Val, State) -> tr_integer(Val, State, 0, 65535).tr_UINT32(Val, State) -> tr_integer(Val, State, 0, 4294967295).tr_opt_integer(asn1_NOVALUE, _State, _Min, _Max) -> asn1_NOVALUE;tr_opt_integer(Int, State, Min, Max) -> tr_integer(Int, State, Min, Max).tr_integer(Int, _State, Min, Max) -> verify_count(Int, Min, Max), Int.%% Verify that Count is within the range of Min and Maxverify_count(Count, Min, Max) -> if integer(Count) -> if integer(Min), Count >= Min -> if integer(Max), Count =< Max -> Count; Max == infinity -> Count; true -> error({count_too_large, Count, Max}) end; true -> error({count_too_small, Count, Min}) end; true -> error({count_not_an_integer, Count}) end.%% -------------------------------------------------------------------error(Reason) -> erlang:fault(Reason).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -