2 * $Id: scanner.l,v 1.6 2002/07/11 21:26:16 lutchann Exp $
5 * Pedro Roque <roque@di.fc.ul.pt>
6 * Lars Fenneberg <lf@elemental.net>
8 * This software is Copyright 1996-2000 by the above mentioned author(s),
11 * The license which is distributed with this software in the file COPYRIGHT
12 * applies to this software. If your distribution is missing this file, you
13 * may request it from <lutchann@litech.org>.
22 extern char *conf_file;
30 decimal ({number}"."{number})
31 hexdigit ([a-f]|[A-F]|[0-9])
32 addr1 {hexdigit}{1,4}":"({hexdigit}{1,4}":")*(":"{hexdigit}{1,4})+
33 addr2 {hexdigit}{1,4}(":"{hexdigit}{1,4})*"::"
34 addr3 ({hexdigit}{1,4}":"){7}{hexdigit}{1,4}
35 addr ({addr1}|{addr2}|{addr3}|"::")
37 string [a-z]([a-z]|{digit})*([:.]{digit}+)?
41 #.*$ {/* ignore comments */}
45 interface { return T_INTERFACE; }
46 prefix { return T_PREFIX; }
48 AdvSendAdvert { return T_AdvSendAdvert; }
49 MaxRtrAdvInterval { return T_MaxRtrAdvInterval; }
50 MinRtrAdvInterval { return T_MinRtrAdvInterval; }
51 AdvManagedFlag { return T_AdvManagedFlag; }
52 AdvOtherConfigFlag { return T_AdvOtherConfigFlag; }
53 AdvLinkMTU { return T_AdvLinkMTU; }
54 AdvReachableTime { return T_AdvReachableTime; }
55 AdvRetransTimer { return T_AdvRetransTimer; }
56 AdvCurHopLimit { return T_AdvCurHopLimit; }
57 AdvDefaultLifetime { return T_AdvDefaultLifetime; }
58 AdvSourceLLAddress { return T_AdvSourceLLAddress; }
60 AdvOnLink { return T_AdvOnLink; }
61 AdvAutonomous { return T_AdvAutonomous; }
62 AdvValidLifetime { return T_AdvValidLifetime; }
63 AdvPreferredLifetime { return T_AdvPreferredLifetime; }
65 AdvRouterAddr { return T_AdvRouterAddr; }
66 AdvHomeAgentFlag { return T_AdvHomeAgentFlag; }
67 AdvIntervalOpt { return T_AdvIntervalOpt; }
68 AdvHomeAgentInfo { return T_AdvHomeAgentInfo; }
69 UnicastOnly { return T_UnicastOnly; }
71 Base6to4Interface { return T_Base6to4Interface; }
73 HomeAgentPreference { return T_HomeAgentPreference; }
74 HomeAgentLifetime { return T_HomeAgentLifetime; }
77 static struct in6_addr addr;
80 i = inet_pton(AF_INET6, yytext, &addr);
82 dlog(LOG_DEBUG, 4, "inet_pton returned %d", i);
84 /* BSD API draft and NRL's code don't aggree on
85 * this. the draft specifies a return value of 1 on
86 * success, NRL's code returns the address length in
87 * bytes on success (16 for an IPv6 address)
90 log(LOG_ERR, "invalid address in %s, line %d", conf_file,
99 {number} { yylval.num = atoi(yytext); return NUMBER; }
101 {snum} { yylval.snum = atoi(yytext); return SIGNEDNUMBER; }
103 {decimal} { yylval.dec = atof(yytext); return DECIMAL; }
105 infinity { return INFINITY; }
107 on { yylval.bool = 1; return SWITCH; }
109 off { yylval.bool = 0; return SWITCH; }
112 static char name[IFNAMSIZ];
114 strncpy(name, yytext, IFNAMSIZ-1);
115 name[IFNAMSIZ-1] = '\0';
121 static char filepath[MAXPATHLEN];
127 if (len >= MAXPATHLEN)
129 strncpy(filepath, yytext+1, len);
130 filepath[len] = '\0';
131 yylval.str = filepath;
135 "{"|"}"|";"|"/" { return *yytext; }
137 . { return T_BAD_TOKEN; }