📄 megaco_text_mini_parser.yrl
字号:
%% ``The contents of this file are subject to the Erlang Public License,%% Version 1.1, (the "License"); you may not use this file except in%% compliance with the License. You should have received a copy of the%% Erlang Public License along with this software. If not, it can be%% retrieved via the world wide web at http://www.erlang.org/.%% %% Software distributed under the License is distributed on an "AS IS"%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See%% the License for the specific language governing rights and limitations%% under the License.%% %% The Initial Developer of the Original Code is Ericsson Utvecklings AB.%% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings%% AB. All Rights Reserved.''%% %% $Id$%%%%----------------------------------------------------------------------%% Purpose: YECC grammar for mini text decoding of Megaco/H.248%%----------------------------------------------------------------------%%----------------------------------------------------------------------%% Annex B TEXT ENCODING OF THE PROTOCOL (NORMATIVE)%%%% B.1 Coding of wildcards%%%% In a text encoding of the protocol, while TerminationIDs are%% arbitrary, by judicious choice of names, the wildcard character, "*"%% may be made more useful. When the wildcard character is encountered,%% it will "match" all TerminationIDs having the same previous and%% following characters (if appropriate). For example, if there were%% TerminationIDs of R13/3/1, R13/3/2 and R13/3/3, the TerminationID%% R13/3/* would match all of them. There are some circumstances where%% ALL Terminations must be referred to. The TerminationID "*" suffices,%% and is referred to as ALL. The CHOOSE TerminationID "$" may be used to%% signal to the MG that it has to create an ephemeral Termination or%% select an idle physical Termination.%%%% B.2 ABNF specification%%%% The protocol syntax is presented in ABNF according to RFC2234. The%% protocol is not case sensitive. Identifiers are not case sensitive.%%----------------------------------------------------------------------%%----------------------------------------------------------------------%% Non-terminals%%----------------------------------------------------------------------Nonterminals authenticationHeader daddr deviceName domainAddress domainName mId megacoMessage message mtpAddress optSep pathName portNumber safeToken.%%----------------------------------------------------------------------%% Terminals%%----------------------------------------------------------------------Terminals 'AuthToken' 'COLON' 'EQUAL' 'GREATER' 'LESSER' 'LSBRKT' 'MtpAddressToken' 'MgcIdToken' 'PendingToken' 'RSBRKT' 'ReplyToken' 'ResponseAckToken' 'SEP' 'SafeChars' 'TransToken' endOfMessage.%%----------------------------------------------------------------------%% Root symbol%%----------------------------------------------------------------------Rootsymbol megacoMessage.%%----------------------------------------------------------------------%% The grammar%%----------------------------------------------------------------------%% megacoMessage = LWSP [authenticationHeader SEP ] message%% authenticationHeader = AuthToken EQUAL SecurityParmIndex COLON%% SequenceNum COLON AuthData%% %% SecurityParmIndex = "0x" 8(HEXDIG)%% SequenceNum = "0x" 8(HEXDIG)%% AuthData = "0x" 24*64(HEXDIG)%% message = MegacopToken SLASH version SEP mId SEP messageBody%% version = 1*2(DIGIT) .megacoMessage -> optSep authenticationHeader message endOfMessage : #'MegacoMessage'{authHeader = '$2', mess = '$3'} .optSep -> 'SEP' : sep .optSep -> '$empty' : no_sep .authenticationHeader -> 'AuthToken' 'EQUAL' safeToken 'COLON' safeToken 'COLON' safeToken optSep : ensure_auth_header('$3', '$5', '$7') .authenticationHeader -> '$empty' : asn1_NOVALUE .message -> safeToken mId : ensure_message('$1', '$2') .mId -> domainName : '$1' .mId -> domainAddress : '$1' .mId -> optSep mtpAddress optSep : '$2' .mId -> optSep deviceName optSep : '$2' .domainName -> 'LESSER' safeToken 'GREATER' 'COLON' portNumber optSep : ensure_domainName('$2', '$5') .domainName -> 'LESSER' safeToken 'GREATER' : ensure_domainName('$2', asn1_NOVALUE) .deviceName -> pathName : {deviceName, '$1'} .domainAddress -> 'LSBRKT' daddr 'RSBRKT' 'COLON' portNumber optSep : ensure_domainAddress('$2', '$5') .domainAddress -> 'LSBRKT' daddr 'RSBRKT' : ensure_domainAddress('$2', asn1_NOVALUE) .daddr -> '$empty' : [] .daddr -> 'COLON' daddr : [colon| '$2'] .daddr -> safeToken daddr : ['$1'| '$2'] .portNumber -> safeToken : ensure_uint16('$1') .mtpAddress -> 'MtpAddressToken' : ensure_mtpAddress('$1') .pathName -> safeToken : ensure_pathName('$1') .safeToken -> 'SafeChars' : make_safe_token('$1') .safeToken -> 'PendingToken' : make_safe_token('$1') .safeToken -> 'ReplyToken' : make_safe_token('$1') .safeToken -> 'ResponseAckToken' : make_safe_token('$1') .safeToken -> 'TransToken' : make_safe_token('$1') .safeToken -> 'MgcIdToken' : make_safe_token('$1') .Erlang code.%% The following directive is needed for (significantly) faster compilation%% of the generated .erl file by the HiPE compiler. Please do not remove.-compile([{hipe,[{regalloc,linear_scan}]}]).-include("megaco_text_mini_parser.hrl").
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -