⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 megaco_binary_transformer_prev3c.erl

📁 OTP是开放电信平台的简称
💻 ERL
📖 第 1 页 / 共 5 页
字号:
tr_opt_bool(asn1_NOVALUE, _State) -> asn1_NOVALUE;tr_opt_bool(Bool, State)         -> tr_bool(Bool, State).tr_bool(true, _State)  -> true;tr_bool(false, _State) -> false.tr_term_id_component(Sub, _State) ->    case Sub of        all    -> all;        choose -> choose;        Char when integer(Char) -> Char    end.%% mediaDescriptor      = MediaToken LBRKT mediaParm *(COMMA mediaParm) RBRKT%% ; at-most-once per item%% ; and either streamParm or streamDescriptor but not both%% mediaParm            = (streamParm / streamDescriptor / %%                         terminationStateDescriptor)%% ; at-most-once%% streamParm           = ( localDescriptor / remoteDescriptor / %%                         localControlDescriptor )%% streamDescriptor     = StreamToken EQUAL StreamID LBRKT streamParm %%                        *(COMMA streamParm) RBRKTtr_MediaDescriptor(#'MediaDescriptor'{termStateDescr = TermState,                                      streams        = Streams},                   State) ->    #'MediaDescriptor'{termStateDescr = tr_opt_TerminationStateDescriptor(TermState, State),                       streams        = tr_opt_streams(Streams, State)}.tr_opt_streams(asn1_NOVALUE, _State) ->    asn1_NOVALUE;tr_opt_streams({Tag, Val}, State) ->    Val2 =         case Tag of            oneStream   -> tr_StreamParms(Val, State);            multiStream -> [tr_StreamDescriptor(SD, State) || SD <- Val]        end,    {Tag, Val2}.tr_StreamParms(#'StreamParms'{localControlDescriptor = LCD,                              localDescriptor        = LD,                              remoteDescriptor       = RD,			      statisticsDescriptor   = SD},               State) ->    LCD2 = tr_opt_LocalControlDescriptor(LCD, State),    LD2  = tr_opt_LocalRemoteDescriptor(LD,   State),    RD2  = tr_opt_LocalRemoteDescriptor(RD,   State),    SD2  = tr_opt_StatisticsDescriptor(SD,    State),    #'StreamParms'{localControlDescriptor = LCD2,                   localDescriptor        = LD2,                   remoteDescriptor       = RD2,		   statisticsDescriptor   = SD2}.tr_StreamDescriptor(#'StreamDescriptor'{streamID    = Id,                                        streamParms = Parms},                    State) ->    #'StreamDescriptor'{streamID    = tr_StreamID(Id, State),                        streamParms = tr_StreamParms(Parms, State)}.%% localControlDescriptor = LocalControlToken LBRKT localParm %%                          *(COMMA localParm) RBRKT%% %% ; at-most-once per item%% localParm            = ( streamMode / propertyParm /%%                          reservedValueMode  / reservedGroupMode ) %% reservedValueMode       = ReservedValueToken EQUAL ( "ON" / "OFF" ) %% reservedGroupMode       = ReservedGroupToken EQUAL ( "ON" / "OFF" ) %% %% reservedMode      = ReservedToken EQUAL ( "ON" / "OFF" )%% %% streamMode           = ModeToken EQUAL streamModestr_opt_LocalControlDescriptor(asn1_NOVALUE, _State) ->    asn1_NOVALUE;tr_opt_LocalControlDescriptor(#'LocalControlDescriptor'{streamMode    = Mode,                                                        reserveGroup  = Group,                                                        reserveValue  = Value,                                                        propertyParms = Props},                              State) ->    #'LocalControlDescriptor'{streamMode    = tr_opt_StreamMode(Mode, State),                              reserveGroup  = tr_opt_bool(Group, State),                              reserveValue  = tr_opt_bool(Value, State),                              propertyParms = [tr_PropertyParm(P, State) || P <- Props]}.tr_opt_StreamMode(Mode, _State) ->    case Mode of        asn1_NOVALUE -> asn1_NOVALUE;        sendOnly     -> sendOnly;        recvOnly     -> recvOnly;        sendRecv     -> sendRecv;        inactive     -> inactive;        loopBack     -> loopBack    end.tr_Name(Name, State) ->    %% BUGBUG: transform    %% BUGBUG: NAME = ALPHA *63(ALPHA / DIGIT / "_" )    tr_STRING(Name, State, 2, 2).tr_PkgdName(Name, State) ->    %% BUGBUG: transform    %% BUGBUG:  pkgdName =  (NAME / "*")  SLASH  (ItemID / "*" )    tr_OCTET_STRING(Name, State, 4, 4).%% When text encoding the protocol, the descriptors consist of session%% descriptions as defined in SDP (RFC2327), except that the "s=", "t="%% and "o=" lines are optional. When multiple session descriptions are%% provided in one descriptor, the "v=" lines are required as delimiters;%% otherwise they are optional.  Implementations shall accept session%% descriptions that are fully conformant to RFC2327. When binary%% encoding the protocol the descriptor consists of groups of properties%% (tag-value pairs) as specified in Annex C.  Each such group may%% contain the parameters of a session description.tr_opt_LocalRemoteDescriptor(asn1_NOVALUE, _State) ->    asn1_NOVALUE;tr_opt_LocalRemoteDescriptor(#'LocalRemoteDescriptor'{propGrps = Groups},                             State) ->    #'LocalRemoteDescriptor'{propGrps = [tr_PropertyGroup(G, State) || G <- Groups]}.tr_PropertyGroup(Props, State) ->    [tr_PropertyGroupParm(P, State) || P <- Props].tr_PropertyGroupParm(#'PropertyParm'{name  = Name,                                     value = Value},                     State) ->    Constraint = fun(Item) -> tr_PkgdName(Item, State) end,    #'PropertyParm'{name  = resolve(property, Name, State, Constraint),                    value = tr_OCTET_STRING(Value, State, 0, infinity)}.tr_PropertyParm(#'PropertyParm'{name      = Name,                                value     = Value,                                extraInfo = Extra},                State) ->    Constraint = fun(Item) -> tr_PkgdName(Item, State) end,    #'PropertyParm'{name      = resolve(property, Name, State, Constraint),                    value     = tr_Value(Value, State),                    extraInfo = tr_opt_extraInfo(Extra, State)}.tr_opt_extraInfo(asn1_NOVALUE, _State) ->    asn1_NOVALUE;tr_opt_extraInfo({relation, Rel}, _State) ->    Rel2 =         case Rel of            greaterThan -> greaterThan;            smallerThan -> smallerThan;            unequalTo   -> unequalTo        end,    {relation, Rel2};tr_opt_extraInfo({range, Range}, State) ->    Range2 = tr_bool(Range, State),    {range, Range2};tr_opt_extraInfo({sublist, Sub}, State) ->    Sub2 = tr_bool(Sub, State),    {sublist, Sub2}.tr_opt_TerminationStateDescriptor(asn1_NOVALUE, _State) ->    asn1_NOVALUE;tr_opt_TerminationStateDescriptor(#'TerminationStateDescriptor'{propertyParms      = Props,                                                                eventBufferControl = Control,                                                                serviceState       = Service},                                  State) ->    #'TerminationStateDescriptor'{propertyParms      = [tr_PropertyParm(P, State) || P <- Props],                                  eventBufferControl = tr_opt_EventBufferControl(Control, State),                                  serviceState       = tr_opt_ServiceState(Service, State)}.tr_opt_EventBufferControl(Control, _State) ->    case Control of        asn1_NOVALUE -> asn1_NOVALUE;        off          -> off;        lockStep     -> lockStep    end.tr_opt_ServiceState(Service, _State) ->    case Service of        asn1_NOVALUE -> asn1_NOVALUE;        test         -> test;        outOfSvc     -> outOfSvc;        inSvc        -> inSvc    end.tr_MuxDescriptor(#'MuxDescriptor'{muxType  = Type,                                  termList = IdList},                 State) ->    #'MuxDescriptor'{muxType  = tr_MuxType(Type, State),                     termList = [tr_TerminationID(Id, State) || Id <- IdList]}.tr_MuxType(Type, _State) ->    case Type of        h221 -> h221;        h223 -> h223;        h226 -> h226;        v76  -> v76    end.tr_opt_StreamID(asn1_NOVALUE, _State) ->    asn1_NOVALUE;tr_opt_StreamID(Id, State) ->    tr_StreamID(Id, State).tr_StreamID(Id, State) ->    tr_UINT16(Id, State).tr_EventsDescriptor(#'EventsDescriptor'{requestID = Id,                                        eventList = Events},                    State) ->    #'EventsDescriptor'{requestID = tr_opt_RequestID(Id, State),                        eventList = [tr_RequestedEvent(E, State) || E <- Events]}.tr_RequestedEvent(#'RequestedEvent'{pkgdName    = Name,                                    streamID    = Id,                                    evParList   = Parms,                                    eventAction = Actions},                  State)  ->    Constraint = fun(Item) -> tr_PkgdName(Item, State) end,    #'RequestedEvent'{pkgdName    = resolve(event, Name, State, Constraint),                      streamID    = tr_opt_StreamID(Id, State),                      eventAction = tr_opt_RequestedActions(Actions, State),                      evParList   = [tr_EventParameter(P, Name, State) || P <- Parms]}.tr_RegulatedEmbeddedDescriptor(  #'RegulatedEmbeddedDescriptor'{secondEvent       = SE,				 signalsDescriptor = SD}, State) ->    SE2 = tr_opt_SecondEventsDescriptor(SE, State),    SD2 = tr_opt_SignalsDescriptor(SD, State),    #'RegulatedEmbeddedDescriptor'{secondEvent       = SE2,				   signalsDescriptor = SD2}.tr_opt_NotifyBehaviour(asn1_NOVALUE, _State) ->    asn1_NOVALUE;tr_opt_NotifyBehaviour(NB, State) ->    tr_NotifyBehaviour(NB, State).tr_NotifyBehaviour({notifyImmediate, 'NULL'} = NB, _State) ->    NB;tr_NotifyBehaviour({notifyRegulated = Tag, Val}, State) ->    {Tag, tr_RegulatedEmbeddedDescriptor(Val, State)};tr_NotifyBehaviour({neverNotify, 'NULL'} = NB, _State) ->    NB.tr_opt_RequestedActions(asn1_NOVALUE, _State) ->    asn1_NOVALUE;tr_opt_RequestedActions(#'RequestedActions'{keepActive            = KA,                                            eventDM               = DM,                                            secondEvent           = SE,                                            signalsDescriptor     = SD,					    notifyBehaviour       = NB,					    resetEventsDescriptor = RSD},                        State) ->    KA2  = tr_opt_keepActive(KA, State),    DM2  = tr_opt_EventDM(DM, State),    SE2  = tr_opt_SecondEventsDescriptor(SE, State),    SD2  = tr_opt_SignalsDescriptor(SD, State),    NB2  = tr_opt_NotifyBehaviour(NB, State),    RSD2 = tr_opt_null(RSD, State),    #'RequestedActions'{keepActive            = KA2,                         eventDM               = DM2,                         secondEvent           = SE2,                        signalsDescriptor     = SD2,			notifyBehaviour       = NB2,			resetEventsDescriptor = RSD2}.tr_opt_keepActive(asn1_NOVALUE, _State) ->    asn1_NOVALUE;tr_opt_keepActive(Keep, State) ->    tr_bool(Keep, State).tr_opt_EventDM(asn1_NOVALUE, _State) ->    asn1_NOVALUE;tr_opt_EventDM({Tag, Val}, State) ->    Val2 =         case Tag of            digitMapName  -> tr_DigitMapName(Val, State);            digitMapValue -> tr_DigitMapValue(Val, State)        end,    {Tag, Val2}.tr_opt_SecondEventsDescriptor(asn1_NOVALUE, _State) ->    asn1_NOVALUE;tr_opt_SecondEventsDescriptor(#'SecondEventsDescriptor'{requestID = Id,                                                        eventList = Events},                              State) ->    #'SecondEventsDescriptor'{requestID = tr_RequestID(Id, State), %% IG v6 6.8 withdrawn                              eventList = [tr_SecondRequestedEvent(E, State) || E <- Events]}.tr_SecondRequestedEvent(#'SecondRequestedEvent'{pkgdName    = Name,                                                streamID    = Id,                                                evParList   = Parms,                                                eventAction = Actions},                        State) ->    Constraint = fun(Item) -> tr_PkgdName(Item, State) end,    #'SecondRequestedEvent'{pkgdName    = resolve(event, Name, State, Constraint),                            streamID    = tr_opt_StreamID(Id, State),                            eventAction = tr_opt_SecondRequestedActions(Actions, State),                            evParList   = [tr_EventParameter(P, Name, State) || P <- Parms]}.tr_opt_SecondRequestedActions(asn1_NOVALUE, _State) ->    asn1_NOVALUE;tr_opt_SecondRequestedActions(  #'SecondRequestedActions'{keepActive            = KA,			    eventDM               = DM,			    signalsDescriptor     = SD,			    notifyBehaviour       = NB,			    resetEventsDescriptor = RSD},  State) ->    KA2  = tr_opt_keepActive(KA, State),    DM2  = tr_opt_EventDM(DM, State),    SD2  = tr_opt_SignalsDescriptor(SD, State),     NB2  = tr_opt_NotifyBehaviour(NB, State),    RSD2 = tr_opt_null(RSD, State),    #'SecondRequestedActions'{keepActive            = KA2,                               eventDM               = DM2,                               signalsDescriptor     = SD2, 			      notifyBehaviour       = NB2,			      resetEventsDescriptor = RSD2}.tr_EventBufferDescriptor(EventSpecs, State) ->    [tr_EventSpec(ES, State) || ES <- EventSpecs].tr_EventSpec(#'EventSpec'{eventName    = Name,                          streamID     = Id,                          eventParList = Parms},             State) ->    #'EventSpec'{eventName    = tr_EventName(Name, State),                 streamID     = tr_opt_StreamID(Id, State),                 eventParList = [tr_EventParameter(P, Name, State) || P <- Parms]}.tr_opt_SignalsDescriptor(asn1_NOVALUE, _State) ->    asn1_NOVALUE;tr_opt_SignalsDescriptor(SigDesc, State) ->    tr_SignalsDescriptor(SigDesc, State).tr_SignalsDescriptor(SigDesc, State)  when list(SigDesc) ->    [tr_SignalRequest(SigReq, State) || SigReq <- SigDesc].tr_SignalRequest({Tag, Val}, State) ->    Val2 =        case Tag of            signal     -> tr_Signal(Val, State);            seqSigList -> tr_SeqSigList(Val, State)        end,    {Tag, Val2}.tr_SeqSigList(#'SeqSigList'{id         = Id,

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -