📄 rvmegacoauth.syn
字号:
{
/******************************************************************************
Filename: rvmegacoauth.c
Description: megaco authentication header parser
*******************************************************************************
Copyright (c) 2000 RADVision Inc.
*******************************************************************************
NOTICE:
This document contains information that is proprietary to RADVision Inc.
No part of this publication may be reproduced in any form whatsoever without
written prior approval by RADVision Inc.
RADVision Inc. reserves the right to revise this publication and make changes
without obligation to notify any person of such revisions or changes.
******************************************************************************/
#include "rvmegacoauth.h"
#define SYNTAX_ERROR
}
[
parser name = megacoauth
parser file name = "rvmegacoauthparse.c"
header file name = "rvmegacoauthparse.h"
reentrant parser
~case sensitive
distinguish keywords { ALPHA + DIGIT + '_' }
pointer input
pointer type = const char *
extend pcb {
RvMegacoAuthenticationHeader *authenticationHeader;
RvString authenticationData;
RvAlloc *alloc;
}
allow macros
]
(void)
authenticationHeader $
-> LWSP, AuthToken, EQUAL, SecurityParmIndex:idx, COLON, SequenceNum:n, COLON, AuthData, SEP, SafeChar =
{
rvMegacoAuthenticationHeaderConstructString(PCB.authenticationHeader, idx, n, &PCB.authenticationData, PCB.alloc);
}
AuthToken
-> {"Authentication" | "AU"}
(unsigned int)
SecurityParmIndex
-> fixedHexInt:x = x;
(unsigned int)
SequenceNum
-> fixedHexInt:x = x;
(unsigned int)
fixedHexInt
-> '0', 'x',
hexDigit:d7, hexDigit:d6, hexDigit:d5, hexDigit:d4,
hexDigit:d3, hexDigit:d2, hexDigit:d1, hexDigit:d0 =
{
return d7 << 28 | d6 << 24 | d5 << 20 | d4 << 16 | d3 << 12 | d2 << 8 | d1 << 4 | d0;
}
(unsigned int)
hexDigit
-> DIGIT:d = d - '0';
-> HEXLET:d = 9 + (d & 15);
AuthData
-> '0', 'x', HEXDIG:c = rvStringPushBack(&PCB.authenticationData, (char)c);
-> AuthData, HEXDIG:c = rvStringPushBack(&PCB.authenticationData, (char)c);
HTAB = 0x09
LF = 0x0A
CR = 0x0D
SP = 0x20
DQUOTE = 0x22
COLON = 0x3A
ALPHA = 'a-z' + 'A-Z'
DIGIT = '0-9'
HEXLET = 'a-f' + 'A-F'
HEXDIG = DIGIT + HEXLET
WSP = SP + HTAB
EOL = CR + LF
MYWSP = EOL + WSP
SEP
-> {MYWSP | COMMENT}...
LWSP
-> [MYWSP | COMMENT]...
COMMENT
-> ';', [SafeChar | RestChar | WSP | DQUOTE]..., EOL
EQUAL
-> LWSP, '=', LWSP
SafeChar = DIGIT + ALPHA + '+' + '-' + '&' + '!' + '_' + '/' + '\'' + '?' + '@' +
'^' + '`' + '~' + '*' + '$' + '\\' +
'(' + ')' + '%' + '|' + '.'
RestChar = ';' + '[' + ']' + '{' + '}' + ':' + ',' + '#' + '<' + '>' + '='
{
/*
{function:
{name: rvMegacoAuthenticationHeaderConstructParse}
{class: RvMegacoAuthenticationHeader}
{include: rvmegacoauth.h}
{description:
{p: Constructs an authentication header object from raw message text.}
}
{proto: RvMegacoAuthenticationHeader *rvMegacoAuthenticationHeaderConstructParse(
RvMegacoAuthenticationHeader *x, const char **text, RvAlloc *alloc);}
{params:
{param: {n:x} {d:The authentication header object.}}
{param: {n:text} {d:Pointer to raw message pointer. Raw message pointer
is advanced past the authentication header on successful parse.}}
{param: {n:alloc} {d:The allocator to use.}}
}
{returns: A pointer to the constructed object, or NULL if construction failed.}
{notes:
{note: see RFC2402}
}
}
*/
RvMegacoAuthenticationHeader *rvMegacoAuthenticationHeaderConstructParse(
RvMegacoAuthenticationHeader *x, const char **text, RvAlloc *alloc)
{
megacoauth_pcb_type pcb;
pcb.pointer = *text;
pcb.authenticationHeader = x;
pcb.alloc = alloc;
rvStringConstructAndReserve(&pcb.authenticationData, 64, alloc);
megacoauth(&pcb);
rvStringDestruct(&pcb.authenticationData);
if(pcb.exit_flag == AG_SUCCESS_CODE)
{
*text = pcb.pointer - 1;
return x;
}
return NULL;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -