/* Copyright (C) 2005-2009 Michel de Boer This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ %{ #include #include "sdp_parse_ctrl.h" #include "sdp_parser.h" #include "audits/memman.h" using namespace std; %} %option noyywrap %option stack DIGIT [0-9] ALPHA [a-zA-Z] ALNUM [a-zA-Z0-9] TOKEN_SYM [[:alnum:]\-\.!%\*_\+\'~] SAFE_SYM [[:alnum:]'`\-\.\/:\?\"#\$&\*;=@\[\]\^_\{|\}\+~\"] %x C_NUM %x C_LINE %x C_SAFE %% switch (t_sdp_parser::context) { case t_sdp_parser::X_NUM: BEGIN(C_NUM); break; case t_sdp_parser::X_LINE: BEGIN(C_LINE); break; case t_sdp_parser::X_SAFE: BEGIN(C_SAFE); break; default: BEGIN(INITIAL); } /* SDP lines */ ^v= { return T_LINE_VERSION; } ^o= { return T_LINE_ORIGIN; } ^s= { return T_LINE_SESSION_NAME; } ^c= { return T_LINE_CONNECTION; } ^a= { return T_LINE_ATTRIBUTE; } ^m= { return T_LINE_MEDIA; } ^{ALPHA}= { return T_LINE_UNKNOWN; } /* Token as define in RFC 3261 */ {TOKEN_SYM}+ { yysdplval.yysdpt_str = new string(yysdptext); MEMMAN_NEW(yysdplval.yysdpt_str); return T_TOKEN; } /* End of line */ \r\n { return T_CRLF; } \n { return T_CRLF; } [[:blank:]] /* Skip white space */ /* Single character token */ . { return yysdptext[0]; } /* Number */ {DIGIT}+ { yysdplval.yysdpt_int = atoi(yysdptext); return T_NUM; } [[:blank:]] /* Skip white space */ . { return yysdptext[0]; } \r\n { return T_CRLF; } \n { return T_CRLF; } /* Safe */ {SAFE_SYM}+ { yysdplval.yysdpt_str = new string(yysdptext); MEMMAN_NEW(yysdplval.yysdpt_str); return T_SAFE; } [[:blank:]] /* Skip white space */ . { return yysdptext[0]; } \r\n { return T_CRLF; } \n { return T_CRLF; } /* Get all text till end of line */ [^\r\n]+ { yysdplval.yysdpt_str = new string(yysdptext); MEMMAN_NEW(yysdplval.yysdpt_str); return T_LINE; } \r\n { return T_CRLF; } \n { return T_CRLF; } \r { return T_CRLF; }