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

📄 megaco_text_gen_prev3a.hrl

📁 OTP是开放电信平台的简称
💻 HRL
📖 第 1 页 / 共 5 页
字号:
    ].enc_reservedGroupMode(Val, _State) ->    [     ?ReservedGroupToken,     ?EQUAL,     case Val of	 false -> ?OffToken;	 true  -> ?OnToken     end    ].enc_reservedValueMode(Val, _State) ->    [     ?ReservedValueToken,     ?EQUAL,     case Val of	 false -> ?OffToken;	 true  -> ?OnToken     end    ].enc_StreamMode({'StreamMode',Val}, State) ->    enc_StreamMode(Val, State);enc_StreamMode(Val, _State) ->    [     ?ModeToken,     ?EQUAL,     case Val of	 sendOnly -> ?SendonlyToken;	 recvOnly -> ?RecvonlyToken;	 sendRecv -> ?SendrecvToken;	 inactive -> ?InactiveToken;	 loopBack -> ?LoopbackToken     end    ].enc_Name({'Name',Val}, State) ->    enc_Name(Val, State);enc_Name(Val, State) ->    %% BUGBUG: NAME = ALPHA *63(ALPHA / DIGIT / "_" )    enc_STRING(Val, State, 1, 64).enc_PkgdName({'PkgdName', Val}, State) ->    enc_PkgdName(Val, State);enc_PkgdName(Val, State) ->    %% BUGBUG:  pkgdName =  (NAME / "*")  SLASH  (ItemID / "*" )    enc_OCTET_STRING(Val, State, 1, 64).enc_localDescriptor(Val, State)   when record(Val, 'LocalRemoteDescriptor') ->    [     ?LocalToken,     ?LBRKT,     enc_LocalRemoteDescriptor(Val, State),     ?RBRKT_INDENT(State)    ].enc_remoteDescriptor(Val, State)   when record(Val, 'LocalRemoteDescriptor') ->    [     ?RemoteToken,     ?LBRKT,     enc_LocalRemoteDescriptor(Val, State),     ?RBRKT_INDENT(State)    ].%% 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.enc_LocalRemoteDescriptor(Val, State)  when record(Val, 'LocalRemoteDescriptor') ->    case Val#'LocalRemoteDescriptor'.propGrps of	[] ->	    [];	[OptV | MandV] ->	    [?LfToken,	     enc_PropertyGroup(OptV, opt_v, State) |	     [enc_PropertyGroup(M, mand_v, State) || M <- MandV]]    end.enc_PropertyGroup({'PropertyGroup',Val}, RequiresV, State) ->    enc_PropertyGroup(Val, RequiresV, State);enc_PropertyGroup([H | _T] = List, mand_v, State)   when record(H, 'PropertyParm'), H#'PropertyParm'.name == "v" ->    enc_PropertyGroup(List, opt_v, State);enc_PropertyGroup(PG, opt_v, State) ->    [     [[enc_PropertyGroupParm(PP, State), ?CrToken, ?LfToken] || PP <- PG]    ].enc_PropertyGroupParm(Val, State)  when record(Val, 'PropertyParm') ->    [OctetString] = Val#'PropertyParm'.value,    [     enc_PkgdName(Val#'PropertyParm'.name, State),     ?EqualToken,     enc_OCTET_STRING(OctetString, State, 0, infinity)    ].%% propertyParm         = pkgdName parmValue%% parmValue            = (EQUAL alternativeValue/ INEQUAL VALUE)%% alternativeValue     = ( VALUE / LSBRKT VALUE *(COMMA VALUE) RSBRKT  / %% 			  LSBRKT VALUE DOT DOT VALUE RSBRKT )enc_PropertyParm(Val, State)  when record(Val, 'PropertyParm') ->    PkgdName = ?META_ENC(property, Val#'PropertyParm'.name),    [     enc_PkgdName(PkgdName, State),     enc_propertyParmValues(Val#'PropertyParm'.value,			    Val#'PropertyParm'.extraInfo,			    State)    ].     enc_propertyParmValues([Single], asn1_NOVALUE, State) ->    [     ?EqualToken,     enc_Value(Single, State)    ];enc_propertyParmValues([Single], {relation, Rel}, State) ->    case Rel of	greaterThan -> [$>, enc_Value(Single, State)];	smallerThan -> [$<, enc_Value(Single, State)];	unequalTo   -> [$#, enc_Value(Single, State)]    end;enc_propertyParmValues([Low, High], {range, true}, State)->    %% Exact two values    [     ?EQUAL,     ?LSBRKT,     enc_Value(Low, State),     ?COLON,     enc_Value(High, State),     ?RSBRKT    ];enc_propertyParmValues(Values, {sublist, true}, State)->    %% sublist (i.e. A AND B AND ...)    [     ?EQUAL,     ?LSBRKT_INDENT(State),     enc_list([{Values, fun enc_Value/2}], ?INC_INDENT(State)),     ?RSBRKT_INDENT(State)    ];enc_propertyParmValues(Values, {sublist, false}, State) ->    %% alternatives (i.e. A OR B OR ...)    [     ?EQUAL,     ?LBRKT_INDENT(State),     enc_list([{Values, fun enc_Value/2}], ?INC_INDENT(State)),     ?RBRKT_INDENT(State)    ];enc_propertyParmValues(V, EI, _State) ->    error({invalid_property_parm_values, V, EI}).enc_TerminationStateDescriptor(Val, State)  when record(Val, 'TerminationStateDescriptor') ->    [     ?TerminationStateToken,     ?LBRKT_INDENT(State),     enc_list([{Val#'TerminationStateDescriptor'.propertyParms,		fun enc_PropertyParm/2},	       {[Val#'TerminationStateDescriptor'.eventBufferControl],		fun enc_eventBufferControl/2},	       {[Val#'TerminationStateDescriptor'.serviceState],		fun enc_serviceState/2}],	      ?INC_INDENT(State)),     ?RBRKT_INDENT(State)    ].enc_eventBufferControl(Val, _State) ->    [     ?BufferToken,     ?EQUAL,       case Val of	 off      -> ?OffToken;	 lockStep -> ?LockStepToken    end    ].    enc_serviceState({'ServiceState',Val}, State) ->    enc_serviceState(Val, State);enc_serviceState(Val, _State) ->    [     ?ServiceStatesToken,     ?EQUAL,     case Val of	 test     -> ?TestToken;	 outOfSvc -> ?OutOfSvcToken;	 inSvc    -> ?InSvcToken     end    ].enc_MuxDescriptor(Val, State)  when record(Val, 'MuxDescriptor') ->    [     ?MuxToken,     ?EQUAL,     enc_MuxType(Val#'MuxDescriptor'.muxType, State),     enc_TerminationIDListN(Val#'MuxDescriptor'.termList, State)    ].enc_MuxType({'MuxType',Val}, State) ->    enc_MuxType(Val, State);enc_MuxType(Val, _State) ->    case Val of	h221  -> ?H221Token;	h223  -> ?H223Token;	h226  -> ?H226Token;	v76   -> ?V76Token;	%% extensionParameter	nx64k -> ?Nx64kToken  % v2    end.enc_StreamID({'StreamID',Val}, State) ->    enc_StreamID(Val, State);enc_StreamID(Val, State) ->    enc_UINT16(Val, State).enc_EventsDescriptor(Val, State)  when record(Val, 'EventsDescriptor') ->    #'EventsDescriptor'{requestID = RequestId,			eventList = Events} = Val,    if	RequestId == asn1_NOVALUE, Events == [] ->	    [	     ?EventsToken	    ];	RequestId /= asn1_NOVALUE, Events /= [] ->	    [	     ?EventsToken,	     ?EQUAL,	     enc_RequestID(RequestId, State),	     ?LBRKT_INDENT(State),	     enc_list([{Events, fun enc_RequestedEvent/2}],		      ?INC_INDENT(State)),	     ?RBRKT_INDENT(State)	    ]    end.enc_RequestedEvent(Val, State)  when record(Val, 'RequestedEvent') ->    PkgdName = ?META_ENC(event, Val#'RequestedEvent'.pkgdName),    [     enc_PkgdName(PkgdName, State),     enc_opt_brackets(       enc_list([{[Val#'RequestedEvent'.streamID],  fun enc_eventStream/2},		 {Val#'RequestedEvent'.evParList, fun enc_eventOther/2} |		 decompose_requestedActions(Val#'RequestedEvent'.eventAction)],		?INC_INDENT(State)),      State)    ].decompose_requestedActions(asn1_NOVALUE) ->    [];%% %% This in the ABNF: %% at-most-once each of KeepActiveToken , eventDM and eventStream%% at most one of either embedWithSig or embedNoSig but not both%% KeepActiveToken and embedWithSig must not both be present%% %% embedWithSigdecompose_requestedActions(#'RequestedActions'{keepActive        = KA,					       eventDM           = EDM,					       secondEvent       = SE,					       signalsDescriptor = SD})   when KA /= true,       SD /= asn1_NOVALUE, SD /= [] ->    [     {[EDM],      fun enc_EventDM/2},     {[{SE, SD}], fun enc_embedWithSig/2}    ];%% embedNoSigdecompose_requestedActions(#'RequestedActions'{keepActive        = KA,					       eventDM           = EDM,					       secondEvent       = SE,					       signalsDescriptor = SD})   when SD == asn1_NOVALUE; SD == [] ->    [     {[KA],  fun enc_keepActive/2},     {[EDM], fun enc_EventDM/2},     {[SE],  fun enc_embedNoSig/2}    ];%% Fallback, if everything else failes....decompose_requestedActions(#'RequestedActions'{keepActive        = KA,					       eventDM           = EDM,					       secondEvent       = SE,					       signalsDescriptor = SD}) ->    [     {[KA],       fun enc_keepActive/2},     {[EDM],      fun enc_EventDM/2},     {[{SE, SD}], fun enc_embedWithSig/2}    ].enc_embedNoSig(#'SecondEventsDescriptor'{requestID = RID,					 eventList = Evs}, State) ->    [     ?EmbedToken,     ?LBRKT_INDENT(State),     enc_embedFirst(RID, Evs, ?INC_INDENT(State)),      ?RBRKT_INDENT(State)    ].enc_embedWithSig({asn1_NOVALUE, SD}, State) ->    [     ?EmbedToken,     ?LBRKT_INDENT(State),     enc_SignalsDescriptor(SD, ?INC_INDENT(State)),     ?RBRKT_INDENT(State)    ];enc_embedWithSig({#'SecondEventsDescriptor'{requestID = RID,					    eventList = Evs}, SD}, State) ->    [     ?EmbedToken,     ?LBRKT_INDENT(State),     enc_SignalsDescriptor(SD, ?INC_INDENT(State)),     ?COMMA_INDENT(?INC_INDENT(State)),      enc_embedFirst(RID, Evs, ?INC_INDENT(State)),      ?RBRKT_INDENT(State)    ].enc_keepActive(Val, _State) ->    case Val of	true -> [?KeepActiveToken];	false -> []    end.    enc_EventDM({'EventDM',Val}, State) ->    enc_EventDM(Val, State);enc_EventDM({Tag, Val}, State) ->    case Tag of	digitMapName ->	    [	     ?DigitMapToken,	     ?EQUAL,	     enc_DigitMapName(Val, State)	    ];	digitMapValue ->	    [	     ?DigitMapToken,	     ?LBRKT_INDENT(State),	     enc_DigitMapValue(Val, ?INC_INDENT(State)),	     ?RBRKT_INDENT(State)	    ];	_ ->	    error({invalid_EventDM_tag, Tag})    end.enc_embedFirst(RID, Evs, State)  when RID /= asn1_NOVALUE, list(Evs), Evs /= [] ->    %%     d("enc_embedFirst -> entry with"    %%       "~n   RID: ~p"    %%       "~n   Evs: ~p", [RID, Evs]),    [     ?EventsToken,     ?EQUAL,     enc_RequestID(RID, State),     ?LBRKT_INDENT(State),     enc_list([{Evs, fun enc_SecondRequestedEvent/2}], ?INC_INDENT(State)),     ?RBRKT_INDENT(State)    ];enc_embedFirst(_RID, _Evs, _State) ->    %%     d("enc_embedFirst -> entry"),    [     ?EventsToken    ].enc_SecondRequestedEvent(#'SecondRequestedEvent'{pkgdName    = N,						 streamID    = SID,						 evParList   = EPL,						 eventAction = EA}, State) ->    PkgdName = ?META_ENC(event, N),    [     enc_PkgdName(PkgdName, State),     enc_opt_brackets(       enc_list(	 [{[SID], fun enc_eventStream/2},	  {EPL, fun enc_eventOther/2} |	  decompose_secondRequestedActions(EA)],	 ?INC_INDENT(State)),       State)    ].decompose_secondRequestedActions(asn1_NOVALUE) ->    [];decompose_secondRequestedActions(Val)  when record(Val, 'SecondRequestedActions') ->    [     {[Val#'SecondRequestedActions'.keepActive],      fun enc_keepActive/2},     {[Val#'SecondRequestedActions'.eventDM],      fun enc_EventDM/2},     {[Val#'SecondRequestedActions'.signalsDescriptor],      fun enc_embeddedSignalsDescriptor/2}    ].enc_embeddedSignalsDescriptor(Val, State) ->    [     ?EmbedToken,     ?LBRKT_INDENT(State),     enc_SignalsDescriptor(Val, ?INC_INDENT(State)),     ?RBRKT_INDENT(State)    ].    enc_EventBufferDescriptor({'EventBufferDescriptor',Val}, State) ->    enc_EventBufferDescriptor(Val, State);enc_EventBufferDescriptor([], _State) ->    [     ?EventBufferToken    ];enc_EventBufferDescriptor(EventSpecs, State)   when is_list(EventSpecs) and (length(EventSpecs) >= 1) ->    [     ?EventBufferToken,     ?LBRKT_INDENT(State),     enc_eventSpecs(EventSpecs, ?INC_INDENT(State)),     ?RBRKT_INDENT(State)       ];enc_EventBufferDescriptor(EventSpecs, _State) ->    error({bad_eventSpecs, EventSpecs}).enc_eventSpecs([Mand | Opt], State) ->    [enc_eventSpec(Mand, State),     [[?COMMA_INDENT(State), enc_eventSpec(Val, State)] || Val <- Opt]].enc_eventSpec(#'EventSpec'{eventName    = Name,

⌨️ 快捷键说明

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