Brian Waters | 13d9601 | 2017-12-08 16:53:31 -0600 | [diff] [blame] | 1 | /***************************************************************************************************** |
| 2 | * Software License Agreement (BSD License) |
| 3 | * Author : Souheil Ben Ayed <souheil@tera.ics.keio.ac.jp> |
| 4 | * |
| 5 | * Copyright (c) 2009-2010, Souheil Ben Ayed, Teraoka Laboratory of Keio University, and the WIDE Project |
| 6 | * All rights reserved. |
| 7 | * |
| 8 | * Redistribution and use of this software in source and binary forms, with or without |
| 9 | * modification, are permitted provided that the following conditions are met: |
| 10 | * |
| 11 | * 1. Redistributions of source code must retain the above copyright |
| 12 | * notice, this list of conditions and the following disclaimer. |
| 13 | * |
| 14 | * 2. Redistributions in binary form must reproduce the above copyright |
| 15 | * notice, this list of conditions and the following disclaimer in the |
| 16 | * documentation and/or other materials provided with the distribution. |
| 17 | * |
| 18 | * 3. All advertising materials mentioning features or use of this software |
| 19 | * must display the following acknowledgement: |
| 20 | * This product includes software developed by Souheil Ben Ayed <souheil@tera.ics.keio.ac.jp>. |
| 21 | * |
| 22 | * 4. Neither the name of Souheil Ben Ayed, Teraoka Laboratory of Keio University or the WIDE Project nor the |
| 23 | * names of its contributors may be used to endorse or promote products |
| 24 | * derived from this software without specific prior written permission. |
| 25 | * |
| 26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ''AS IS'' AND ANY |
| 27 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 28 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 29 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY |
| 30 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 31 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 32 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 33 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 34 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 35 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 36 | *****************************************************************************************************/ |
| 37 | |
| 38 | |
| 39 | |
| 40 | /*Declarations and option settings*/ |
| 41 | %{ |
| 42 | #include <stdio.h> |
| 43 | #include "diameap_common.h" |
| 44 | #include "diameap.tab.h" |
| 45 | |
| 46 | #define YY_USER_ACTION { \ |
| 47 | yylloc->first_line = yylloc->last_line = yylineno; \ |
| 48 | yylloc->first_column = yylloc->last_column + 1; \ |
| 49 | yylloc->last_column += yyleng +1; \ |
| 50 | } |
| 51 | |
| 52 | #define YY_NO_INPUT |
| 53 | %} |
| 54 | |
| 55 | |
| 56 | |
| 57 | %option noyywrap |
| 58 | %option yylineno |
| 59 | %option bison-bridge |
| 60 | %option bison-locations |
| 61 | %option nounput |
| 62 | |
| 63 | %% |
| 64 | /* List of patterns and actions */ |
| 65 | |
| 66 | <*>\n { |
| 67 | yylloc->last_column=0; |
| 68 | } |
| 69 | |
| 70 | <*>#.*$ { } |
| 71 | |
| 72 | [ \t\n]+ { |
| 73 | yylloc->last_column=0; |
| 74 | /* ignore whitespace */ |
| 75 | } |
| 76 | |
| 77 | \"([^\n\"]*)\" { |
| 78 | yylval->str = strdup(yytext+1); /* Quoted String */ |
| 79 | yylval->str[yyleng-2]='\0'; |
| 80 | return iSTRING; |
| 81 | } |
| 82 | |
| 83 | |
| 84 | [[:digit:]]+ { /* Digital number */ |
| 85 | yylval->val = atoi(yytext); |
| 86 | return NUM; /* Numeric value */ |
| 87 | } |
| 88 | |
| 89 | (?i:"Load_Plugin") { |
| 90 | return EAPMETHOD; |
| 91 | } |
| 92 | |
| 93 | (?i:"Authorization") { |
| 94 | return AUTHORIZE; |
| 95 | } |
| 96 | |
| 97 | (?i:"DiamEAP_MySQL") { |
| 98 | return DIAMEAP_MYSQL; |
| 99 | } |
| 100 | |
| 101 | (?i:"MAX_Invalid_EAP_Packets") { |
| 102 | return MAX_INVALID_EAP_PACKET; |
| 103 | } |
| 104 | |
| 105 | (?i:"Multi_Round_Time_Out") { |
| 106 | return MULTI_ROUND_TIMEOUT; |
| 107 | } |
| 108 | |
| 109 | (?i:"Check_user_identity") { |
| 110 | return CHECK_USER_IDENTITY; |
| 111 | } |
| 112 | |
| 113 | "="|";"|":"|"," { |
| 114 | return yytext[0]; |
| 115 | } |
| 116 | |
| 117 | /* Unrecognized token or text */ |
| 118 | |
| 119 | <*>[[:alnum:]]+ | |
| 120 | <*>. { |
| 121 | fprintf(stderr,"Unrecognized input text '%s'( on line %i column %i )\n", yytext, yylloc->first_line, yylloc->first_column); |
| 122 | return LEX_ERROR; |
| 123 | } |
| 124 | |
| 125 | %% |
| 126 | /* Routines */ |
| 127 | |
| 128 | |