📄 megaco_binary_transformer_v1.erl
字号:
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 = Control, localDescriptor = Local, remoteDescriptor = Remote}, State) -> #'StreamParms'{localControlDescriptor = tr_opt_LocalControlDescriptor(Control, State), localDescriptor = tr_opt_LocalRemoteDescriptor(Local, State), remoteDescriptor = tr_opt_LocalRemoteDescriptor(Remote, State)}.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_opt_RequestedActions(asn1_NOVALUE, _State) -> asn1_NOVALUE;tr_opt_RequestedActions(#'RequestedActions'{keepActive = Keep, eventDM = DM, secondEvent = Event, signalsDescriptor = SigDesc}, State) -> #'RequestedActions'{keepActive = tr_opt_keepActive(Keep, State), eventDM = tr_opt_EventDM(DM, State), secondEvent = tr_opt_SecondEventsDescriptor(Event, State), signalsDescriptor = tr_opt_SignalsDescriptor(SigDesc, State)}.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 = Keep, eventDM = DM, signalsDescriptor = SigDesc}, State) -> #'SecondRequestedActions'{keepActive = tr_opt_keepActive(Keep, State), eventDM = tr_opt_EventDM(DM, State), signalsDescriptor = tr_opt_SignalsDescriptor(SigDesc, State)}.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, signalList = SigList}, State) when list(SigList) -> #'SeqSigList'{id = tr_UINT16(Id, State), signalList = [tr_Signal(Sig, State) || Sig <- SigList]}.tr_Signal(#'Signal'{signalName = Name, streamID = Id, sigType = Type, duration = Dur, notifyCompletion = Compl, keepActive = Keep, sigParList = Parms}, State) -> #'Signal'{signalName = tr_SignalName(Name, State), streamID = tr_opt_StreamID(Id, State), sigType = tr_opt_SignalType(Type, State), duration = tr_opt_duration(Dur, State), notifyCompletion = tr_opt_NotifyCompletion(Compl, State), keepActive = tr_opt_keepActive(Keep, State), sigParList = [tr_SigParameter(P, Name, State) || P <- Parms]}.tr_opt_duration(asn1_NOVALUE, _State) -> asn1_NOVALUE;tr_opt_duration(Dur, State) -> tr_UINT16(Dur, State).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -