Match acpi_cpu_add_child()'s prototype with that of the corresponding
[dragonfly.git] / lib / libipsec / policy_token.l
blob10434481b43722996b743fec9a6426f023533e7c
1 /*      $FreeBSD: src/lib/libipsec/policy_token.l,v 1.2.2.2 2001/07/03 11:01:15 ume Exp $       */
2 /*      $DragonFly: src/lib/libipsec/policy_token.l,v 1.4 2008/09/30 16:57:05 swildner Exp $    */
3 /*      $KAME: policy_token.l,v 1.11 2000/12/01 10:08:29 sakane Exp $   */
5 /*
6  * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  * 1. Redistributions of source code must retain the above copyright
13  *    notice, this list of conditions and the following disclaimer.
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  * 3. Neither the name of the project nor the names of its contributors
18  *    may be used to endorse or promote products derived from this software
19  *    without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
22  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
25  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31  * SUCH DAMAGE.
32  */
35 #include <sys/types.h>
36 #include <sys/param.h>
37 #include <sys/socket.h>
38 #include <net/route.h>
39 #include <net/pfkeyv2.h>
40 #include <netkey/keydb.h>
41 #include <netinet/in.h>
42 #include <netinet6/ipsec.h>
44 #include <stdlib.h>
45 #include <limits.h>
46 #include <string.h>
47 #include <unistd.h>
48 #include <errno.h>
50 #ifndef __NetBSD__
51 #include "y.tab.h"
52 #else
53 #include "policy_parse.h"
54 #endif
55 #define yylval __libipsecyylval /* XXX */
57 int yylex (void);
60 %option noyywrap
61 %option nounput
63 /* common section */
64 nl              \n
65 ws              [ \t]+
66 digit           [0-9]
67 hexdigit        [0-9A-Fa-f]
68 special         [()+\|\?\*,]
69 dot             \.
70 comma           \,
71 hyphen          \-
72 colon           \:
73 slash           \/
74 bcl             \{
75 ecl             \}
76 blcl            \[
77 elcl            \]
78 percent         \%
79 semi            \;
80 usec            {dot}{digit}{1,6}
81 comment         \#.*
82 ccomment        "/*"
83 bracketstring   \<[^>]*\>
84 quotedstring    \"[^"]*\"
85 decstring       {digit}+
86 hexpair         {hexdigit}{hexdigit}
87 hexstring       0[xX]{hexdigit}+
88 octetstring     {octet}({dot}{octet})+
89 ipaddress       [a-zA-Z0-9:\._][a-zA-Z0-9:\._]*(%[a-zA-Z0-9]+)?
93 in              { yylval.num = IPSEC_DIR_INBOUND; return(DIR); }
94 out             { yylval.num = IPSEC_DIR_OUTBOUND; return(DIR); }
96 discard         { yylval.num = IPSEC_POLICY_DISCARD; return(ACTION); }
97 none            { yylval.num = IPSEC_POLICY_NONE; return(ACTION); }
98 ipsec           { yylval.num = IPSEC_POLICY_IPSEC; return(ACTION); }
99 bypass          { yylval.num = IPSEC_POLICY_BYPASS; return(ACTION); }
100 entrust         { yylval.num = IPSEC_POLICY_ENTRUST; return(ACTION); }
102 esp             { yylval.num = IPPROTO_ESP; return(PROTOCOL); }
103 ah              { yylval.num = IPPROTO_AH; return(PROTOCOL); }
104 ipcomp          { yylval.num = IPPROTO_IPCOMP; return(PROTOCOL); }
106 transport       { yylval.num = IPSEC_MODE_TRANSPORT; return(MODE); }
107 tunnel          { yylval.num = IPSEC_MODE_TUNNEL; return(MODE); }
109 me              { return(ME); }
110 any             { return(ANY); }
112 default         { yylval.num = IPSEC_LEVEL_DEFAULT; return(LEVEL); }
113 use             { yylval.num = IPSEC_LEVEL_USE; return(LEVEL); }
114 require         { yylval.num = IPSEC_LEVEL_REQUIRE; return(LEVEL); }
115 unique{colon}{decstring} {
116                         yylval.val.len = strlen(yytext + 7);
117                         yylval.val.buf = yytext + 7;
118                         return(LEVEL_SPECIFY);
119                 }
120 unique          { yylval.num = IPSEC_LEVEL_UNIQUE; return(LEVEL); }
121 {slash}         { return(SLASH); }
123 {ipaddress}     {
124                         yylval.val.len = strlen(yytext);
125                         yylval.val.buf = yytext;
126                         return(IPADDRESS);
127                 }
129 {hyphen}        { return(HYPHEN); }
131 {ws}            { ; }
132 {nl}            { ; }
136 void __policy__strbuffer__init__ (char *);
138 void
139 __policy__strbuffer__init__(char *msg)
141         YY_BUFFER_STATE yyb;
143         yyb = (YY_BUFFER_STATE)yy_scan_string(msg);
144         yy_switch_to_buffer(yyb);
146         return;