de rien
[parefeu.git] / policy_test.l
1 %{
2 #include <sys/types.h>
3 #include <sys/param.h>
4 #include <sys/socket.h>
5 #include <net/route.h>
6 #include <net/pfkeyv2.h>
7 #include <netipsec/keydb.h>
8 #include <netinet/in.h>
9 #include <netipsec/ipsec.h>
10
11 #include <stdlib.h>
12 #include <limits.h>
13 #include <string.h>
14 #include <unistd.h>
15 #include <errno.h>
16
17 #include "y.tab.h"
18
19 %}
20
21 %option noyywrap
22 %option nounput
23 %option noinput
24
25 /* common section */
26 nl              \n
27 ws              [ \t]+
28 special [()+\|\?\*,]
29 sstring [a-zA-Z0-9]
30 socket  \/{sstring}[^{special}][a-zA-Z0-9\/\.]+
31 quotedstring    \"[^"\n]*\"
32 bracketstring   \<[^>]*\>
33 comment         ^\#[^\n]*
34
35 %%
36
37 "DROP"  { yylval.number=0;return (ACTION);}
38 "PASS"  { yylval.number=1;return (ACTION);}
39 "IN"            { return (IN);}
40 "OUT"           { return (OUT);}
41 "ANY"           { return (ANY);}
42 {bracketstring} { yylval.string=strndup(yytext+1, yyleng -2);return WORD;}
43 {ws}"FROM"{ws}{socket}$ { yylval.string=strdup(yytext);return SOCKET;}
44 ^"LOG"  { return LOG;}
45 "QUICK" { return QUICK;}
46
47 {ws}            { ; }
48 {nl}            { ; }
49 {comment}       { return COMMENT; }
50 %%
51
52