📄 megaco_text_gen_prev3b.hrl
字号:
[Bin].enc_immAckRequired(Val, _State) -> case Val of asn1_NOVALUE -> []; 'NULL' -> [?ImmAckRequiredToken, ?COMMA_INDENT(?INC_INDENT(_State))] end.enc_TransactionReply_transactionResult({'TransactionReply_transactionResult', Val}, State) -> enc_TransactionReply_transactionResult(Val, State);enc_TransactionReply_transactionResult({Tag, Val}, State) -> case Tag of transactionError -> enc_ErrorDescriptor(Val, State); actionReplies -> enc_TransactionReply_transactionResult_actionReplies(Val, State); _ -> error({invalid_TransactionReply_transactionResult_tag, Tag}) end.enc_TransactionReply_transactionResult_actionReplies({'TransactionReply_transactionResult_actionReplies',Val}, State) -> enc_TransactionReply_transactionResult_actionReplies(Val, State);enc_TransactionReply_transactionResult_actionReplies([Mand], State) -> [enc_ActionReply(Mand, State)];enc_TransactionReply_transactionResult_actionReplies([Mand | Opt], State) -> [enc_ActionReply(Mand, State), [[?COMMA_INDENT(State), enc_ActionReply(Val, State)] || Val <- Opt]].enc_ErrorDescriptor(#'ErrorDescriptor'{errorText = asn1_NOVALUE, errorCode = Code}, State) -> [ ?ErrorToken, ?EQUAL, enc_ErrorCode(Code, State), ?LBRKT, ?RBRKT ];enc_ErrorDescriptor(#'ErrorDescriptor'{errorText = Text, errorCode = Code}, State) -> [ ?ErrorToken, ?EQUAL, enc_ErrorCode(Code, State), ?LBRKT, enc_ErrorText(Text, State), ?RBRKT ].enc_ErrorCode({'ErrorCode',Val}, State)-> enc_ErrorCode(Val, State);enc_ErrorCode(Val, State) -> enc_DIGIT(Val, State, 0, 999).enc_ErrorText({'ErrorText',Val}, State) -> enc_ErrorText(Val, State);enc_ErrorText(Val, State) -> enc_QUOTED_STRING(Val, State).enc_ContextID({'ContextID',Val}, State) -> enc_ContextID(Val, State);enc_ContextID(Val, State) -> case Val of ?megaco_all_context_id -> $*; ?megaco_null_context_id -> $-; ?megaco_choose_context_id -> $$; Int when integer(Int) -> enc_UINT32(Int, State) end.enc_ActionRequest(Bin, _State) when binary(Bin) -> [Bin]; %% Already encoded...enc_ActionRequest(#'ActionRequest'{contextId = CID, contextRequest = asn1_NOVALUE, contextAttrAuditReq = asn1_NOVALUE, commandRequests = CmdReqs}, State) -> [ ?CtxToken, ?EQUAL, enc_ContextID(CID, State), ?LBRKT_INDENT(State), enc_list([{CmdReqs, fun enc_CommandRequest/2}], ?INC_INDENT(State)), ?RBRKT_INDENT(State) ];enc_ActionRequest(#'ActionRequest'{contextId = CID, contextRequest = CtxReq, contextAttrAuditReq = asn1_NOVALUE, commandRequests = CmdReqs}, State) -> [ ?CtxToken, ?EQUAL, enc_ContextID(CID, State), ?LBRKT_INDENT(State), enc_list([{[CtxReq], fun enc_ContextRequest/2}, {CmdReqs, fun enc_CommandRequest/2}], ?INC_INDENT(State)), ?RBRKT_INDENT(State) ];enc_ActionRequest(#'ActionRequest'{contextId = CID, contextRequest = CtxReq, contextAttrAuditReq = CtxAAR, commandRequests = CmdReqs}, State) -> [ ?CtxToken, ?EQUAL, enc_ContextID(CID, State), ?LBRKT_INDENT(State), enc_list([{[CtxReq], fun enc_ContextRequest/2}, {[CtxAAR], fun enc_ContextAttrAuditRequest/2}, {CmdReqs, fun enc_CommandRequest/2}], ?INC_INDENT(State)), ?RBRKT_INDENT(State) ].%% OTP-5085enc_ActionReply(#'ActionReply'{contextId = Id, errorDescriptor = ED, contextReply = CtxRep, commandReply = CmdRep}, State) ->%% d("enc_ActionReply -> entry with"%% "~n Id: ~p"%% "~n ED: ~p"%% "~n CtxRep: ~p"%% "~n CmdRep: ~p", [Id, ED, CtxRep, CmdRep]), [ ?CtxToken, ?EQUAL, enc_ContextID(Id, State), ?LBRKT_INDENT(State), do_enc_ActionReply(ED, CtxRep, CmdRep, State), ?RBRKT_INDENT(State) ].do_enc_ActionReply(asn1_NOVALUE, CtxRep, [], State) when CtxRep =/= asn1_NOVALUE ->%% d("do_enc_ActionReply -> entry with"%% "~n CtxRep: ~p", [CtxRep]), [ enc_ContextRequest(CtxRep, ?INC_INDENT(State)) ];do_enc_ActionReply(asn1_NOVALUE, CtxRep, CmdRep, State) when CtxRep =/= asn1_NOVALUE, CmdRep =/= [] ->%% d("do_enc_ActionReply -> entry with"%% "~n CtxRep: ~p"%% "~n CmdRep: ~p", [CtxRep, CmdRep]), [ enc_ContextRequest(CtxRep, ?INC_INDENT(State)), ?COMMA_INDENT(?INC_INDENT(State)), enc_list([{CmdRep, fun enc_CommandReply/2}], ?INC_INDENT(State)) ];do_enc_ActionReply(asn1_NOVALUE, asn1_NOVALUE, CmdRep, State) when CmdRep =/= [] ->%% d("do_enc_ActionReply -> entry with"%% "~n CmdRep: ~p", [CmdRep]), [ enc_list([{CmdRep, fun enc_CommandReply/2}], ?INC_INDENT(State)) ];do_enc_ActionReply(ED, CtxRep, [], State) when ED =/= asn1_NOVALUE, CtxRep =/= asn1_NOVALUE ->%% d("do_enc_ActionReply -> entry with"%% "~n ED: ~p"%% "~n CtxRep: ~p", [ED, CtxRep]), [ enc_ContextRequest(CtxRep, ?INC_INDENT(State)), ?COMMA_INDENT(?INC_INDENT(State)), enc_list([{[ED], fun enc_ErrorDescriptor/2}], % Indention cosmetics ?INC_INDENT(State)) ];do_enc_ActionReply(ED, asn1_NOVALUE, CmdRep, State) when ED =/= asn1_NOVALUE, CmdRep =/= [] ->%% d("do_enc_ActionReply -> entry with"%% "~n ED: ~p"%% "~n CmdRep: ~p", [ED, CmdRep]), [ enc_list([{CmdRep, fun enc_CommandReply/2}, {[ED], fun enc_ErrorDescriptor/2}], % Indention cosmetics ?INC_INDENT(State)) ];do_enc_ActionReply(ED, CtxRep, CmdRep, State) when ED =/= asn1_NOVALUE, CtxRep =/= asn1_NOVALUE, CmdRep =/= [] ->%% d("do_enc_ActionReply -> entry with"%% "~n ED: ~p"%% "~n CtxRep: ~p"%% "~n CmdRep: ~p", [ED, CtxRep, CmdRep]), [ enc_ContextRequest(CtxRep, ?INC_INDENT(State)), ?COMMA_INDENT(?INC_INDENT(State)), enc_list([{CmdRep, fun enc_CommandReply/2}, {[ED], fun enc_ErrorDescriptor/2}], % Indention cosmetics ?INC_INDENT(State)) ];do_enc_ActionReply(ED, asn1_NOVALUE, [], State) when ED =/= asn1_NOVALUE ->%% d("do_enc_ActionReply -> entry with"%% "~n ED: ~p", [ED]), [ enc_ErrorDescriptor(ED, ?INC_INDENT(State)) ].enc_ContextRequest_priority(asn1_NOVALUE, _State) -> {[], dummy};enc_ContextRequest_priority(Val, _State) -> {[Val], fun(X,S) -> [?PriorityToken,?EQUAL,enc_UINT16(X, S)] end}.enc_ContextRequest_emergency(asn1_NOVALUE, _State) -> {[], dummy};enc_ContextRequest_emergency(true, _State) -> {[?EmergencyToken], fun(Elem, _) -> Elem end};enc_ContextRequest_emergency(false, _State) -> {[?EmergencyOffToken], fun(Elem, _) -> Elem end}.enc_ContextRequest_topologyReq(asn1_NOVALUE, _State) -> {[], dummy};enc_ContextRequest_topologyReq({'ContextRequest_topologyReq', asn1_NOVALUE}, _State) -> {[], dummy};enc_ContextRequest_topologyReq({'ContextRequest_topologyReq', List}, _State) -> {List, fun enc_TopologyRequest/2};enc_ContextRequest_topologyReq(List, _State) -> {[List], fun enc_TopologyRequest/2}.enc_ContextRequest_iepscallind(asn1_NOVALUE, _State) -> {[], dummy};enc_ContextRequest_iepscallind(Bool, _State) -> {[Bool], fun enc_iepsValue/2}.enc_ContextRequest_contextProp(asn1_NOVALUE, _State) -> {[], dummy};enc_ContextRequest_contextProp([], _State) -> {[], dummy};enc_ContextRequest_contextProp(Props, _State) -> {[Props], fun(Elem, S) -> enc_contextAttrDescriptor(Elem, contextProps, S) end}.enc_contextAttrDescriptor([Mand|Opt], contextProps, State) -> [ ?ContextAttrToken, ?LBRKT_INDENT(State), [enc_PropertyParm(Mand, State) | [[?COMMA_INDENT(State), enc_PropertyParm(Val, State)] || Val <- Opt]], ?RBRKT_INDENT(State) ].enc_ContextRequest(asn1_NOVALUE, _State) -> [];enc_ContextRequest(#'ContextRequest'{priority = asn1_NOVALUE, emergency = asn1_NOVALUE, topologyReq = asn1_NOVALUE, iepscallind = asn1_NOVALUE, contextProp = asn1_NOVALUE}, _State) -> [];enc_ContextRequest(#'ContextRequest'{priority = asn1_NOVALUE, emergency = asn1_NOVALUE, topologyReq = [], iepscallind = asn1_NOVALUE, contextProp = []}, _State) -> [];enc_ContextRequest(#'ContextRequest'{priority = Prio, emergency = Em, topologyReq = TR, iepscallind = Ieps, contextProp = CP}, State) -> [ enc_list([enc_ContextRequest_priority(Prio, State), enc_ContextRequest_emergency(Em, State), enc_ContextRequest_topologyReq(TR, State), enc_ContextRequest_iepscallind(Ieps, State), enc_ContextRequest_contextProp(CP, State)], State) ].enc_ContextAttrAuditRequest( #'ContextAttrAuditRequest'{topology = asn1_NOVALUE, emergency = asn1_NOVALUE, priority = asn1_NOVALUE, iepscallind = asn1_NOVALUE, contextPropAud = asn1_NOVALUE}, _State) -> [];enc_ContextAttrAuditRequest( #'ContextAttrAuditRequest'{topology = asn1_NOVALUE, emergency = asn1_NOVALUE, priority = asn1_NOVALUE, iepscallind = asn1_NOVALUE, contextPropAud = []}, _State) -> [];enc_ContextAttrAuditRequest(CAAR, State) -> [ ?ContextAuditToken, ?LBRKT_INDENT(State), enc_IndAudContextAttrDescriptor(CAAR, ?INC_INDENT(State)), ?RBRKT_INDENT(State) ].enc_IndAudContextAttrDescriptor( #'ContextAttrAuditRequest'{topology = Top, emergency = Em, priority = Prio, iepscallind = Ieps, contextPropAud = CPA}, State) -> [ ?ContextAttrToken, ?LBRKT_INDENT(State), enc_list([{[Top], fun('NULL', _) -> ?TopologyToken end}, {[Em], fun('NULL', _) -> ?EmergencyToken end}, {[Prio], fun('NULL', _) -> ?PriorityToken end}, {[Ieps], fun('NULL', _) -> ?IEPSToken end}, {CPA, fun enc_IndAudPropertyParm/2}], ?INC_INDENT(State)), ?RBRKT_INDENT(State) ].enc_CommandRequest(#'CommandRequest'{optional = asn1_NOVALUE, wildcardReturn = asn1_NOVALUE, command = Cmd}, State) -> [ enc_Command(Cmd, State) ];enc_CommandRequest(#'CommandRequest'{optional = 'NULL', wildcardReturn = asn1_NOVALUE, command = Cmd}, State) -> [ "O-", enc_Command(Cmd, State) ]; enc_CommandRequest(#'CommandRequest'{optional = asn1_NOVALUE, wildcardReturn = 'NULL', command = Cmd}, State) -> [ "W-", enc_Command(Cmd, State) ]; enc_CommandRequest(#'CommandRequest'{optional = 'NULL', wildcardReturn = 'NULL', command = Cmd}, State) -> [ "O-", "W-", enc_Command(Cmd, State) ]. enc_Command({'Command',Val}, State) -> enc_Command(Val, State);enc_Command({Tag, Val}, State) ->% d("enc_Command -> entry with"% "~n Tag: ~p"% "~n Val: ~p", [Tag, Val]), case Tag of addReq -> [?AddToken, enc_AmmRequest(Val, State)]; moveReq -> [?MoveToken, enc_AmmRequest(Val, State)]; modReq -> [?ModifyToken, enc_AmmRequest(Val, State)]; subtractReq -> [?SubtractToken, enc_SubtractRequest(Val, State)]; auditCapRequest -> [?AuditCapToken, enc_AuditRequest(Val, State)]; auditValueRequest -> [?AuditValueToken, enc_AuditRequest(Val, State)]; notifyReq -> [?NotifyToken, enc_NotifyRequest(Val, State)]; serviceChangeReq -> [?ServiceChangeToken, enc_ServiceChangeRequest(Val, State)]; _ -> error({invalid_Command_tag, Tag}) end.enc_CommandReply({'CommandReply',Val}, State) -> enc_CommandReply(Val, State);enc_CommandReply({Tag, Val}, State) ->%% d("enc_CommandReply -> entry with"%% "~n Tag: ~p"%% "~n Val: ~p", [Tag, Val]), case Tag of addReply -> [?AddToken, enc_AmmsReply(Val, State)]; moveReply -> [?MoveToken, enc_AmmsReply(Val, State)]; modReply -> [?ModifyToken, enc_AmmsReply(Val, State)]; subtractReply -> [?SubtractToken, enc_AmmsReply(Val, State)]; auditCapReply -> [?AuditCapToken, enc_AuditReply(Val, State)]; auditValueReply -> [?AuditValueToken, enc_AuditReply(Val, State)]; notifyReply -> [?NotifyToken, enc_NotifyReply(Val, State)]; serviceChangeReply -> [?ServiceChangeToken, enc_ServiceChangeReply(Val, State)]; _ -> error({invalid_CommandReply_tag, Tag}) end.enc_TopologyRequest(Val, State) when list(Val) -> [ ?TopologyToken, ?LBRKT_INDENT(State), enc_list([{Val, fun enc_TopologyRequest1/2}],?INC_INDENT(State)), ?RBRKT_INDENT(State) ].enc_TopologyRequest1(#'TopologyRequest'{terminationFrom = From, terminationTo = To, topologyDirection = Dir}, State) -> [ enc_TerminationID(From, State), ?COMMA_INDENT(State), enc_TerminationID(To, State), ?COMMA_INDENT(State), enc_TopologyDirection(Dir, State) ].enc_TopologyDirection(bothway, _State) -> ?BothwayToken;enc_TopologyDirection(isolate, _State) -> ?IsolateToken;enc_TopologyDirection(oneway, _State) -> ?OnewayToken;enc_TopologyDirection(Top, _State) -> error({illegal_TopologyDirection, Top}).enc_iepsValue(Val, _State) -> [ ?IEPSToken, ?EQUAL, case Val of false -> ?OffToken; true -> ?OnToken end ].enc_AmmRequest(Val, State)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -