Deleted Added
full compact
scanner.l (122029) scanner.l (127667)
1%{
2/*
3 * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
4 * The Regents of the University of California. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that: (1) source code distributions
8 * retain the above copyright notice and this paragraph in its entirety, (2)

--- 5 unchanged lines hidden (view full) ---

14 * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
15 * the University nor the names of its contributors may be used to endorse
16 * or promote products derived from this software without specific prior
17 * written permission.
18 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
19 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
20 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21 *
1%{
2/*
3 * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
4 * The Regents of the University of California. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that: (1) source code distributions
8 * retain the above copyright notice and this paragraph in its entirety, (2)

--- 5 unchanged lines hidden (view full) ---

14 * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
15 * the University nor the names of its contributors may be used to endorse
16 * or promote products derived from this software without specific prior
17 * written permission.
18 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
19 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
20 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21 *
22 * $FreeBSD: head/contrib/libpcap/scanner.l 122029 2003-11-04 06:12:21Z green $
22 * $FreeBSD: head/contrib/libpcap/scanner.l 127667 2004-03-31 09:15:09Z bms $
23 */
24
25#ifndef lint
23 */
24
25#ifndef lint
26static const char rcsid[] =
27 "@(#) $Header: /tcpdump/master/libpcap/scanner.l,v 1.81 2001/09/14 01:40:57 fenner Exp $ (LBL)";
26static const char rcsid[] _U_ =
27 "@(#) $Header: /tcpdump/master/libpcap/scanner.l,v 1.95.2.3 2004/03/28 21:45:33 fenner Exp $ (LBL)";
28#endif
29
30#ifdef HAVE_CONFIG_H
31#include "config.h"
32#endif
33
28#endif
29
30#ifdef HAVE_CONFIG_H
31#include "config.h"
32#endif
33
34#include <sys/types.h>
35#include <sys/time.h>
36
37#include <ctype.h>
34#include <ctype.h>
38#include <unistd.h>
39#include <string.h>
40
41#include "pcap-int.h"
42
43#include "gencode.h"
35#include <string.h>
36
37#include "pcap-int.h"
38
39#include "gencode.h"
44#include <pcap-namedb.h>
45#ifdef INET6
40#ifdef INET6
46#include <netdb.h>
47#include <sys/socket.h>
41#ifdef WIN32
42#include <pcap-stdinc.h>
43
44#ifdef __MINGW32__
45#include "IP6_misc.h"
46#endif
47#else /* WIN32 */
48#include <sys/socket.h> /* for "struct sockaddr" in "struct addrinfo" */
49#include <netdb.h> /* for "struct addrinfo" */
50#endif /* WIN32 */
51
48/* Workaround for AIX 4.3 */
49#if !defined(AI_NUMERICHOST)
50#define AI_NUMERICHOST 0x04
51#endif
52#endif /*INET6*/
52/* Workaround for AIX 4.3 */
53#if !defined(AI_NUMERICHOST)
54#define AI_NUMERICHOST 0x04
55#endif
56#endif /*INET6*/
57#include <pcap-namedb.h>
53#include "tokdefs.h"
54
55#ifdef HAVE_OS_PROTO_H
56#include "os-proto.h"
57#endif
58
59static int stoi(char *);
60static inline int xdtoi(int);

--- 11 unchanged lines hidden (view full) ---

72extern YYSTYPE yylval;
73
74%}
75
76N ([0-9]+|(0X|0x)[0-9A-Fa-f]+)
77B ([0-9A-Fa-f][0-9A-Fa-f]?)
78W ([0-9A-Fa-f][0-9A-Fa-f]?[0-9A-Fa-f]?[0-9A-Fa-f]?)
79
58#include "tokdefs.h"
59
60#ifdef HAVE_OS_PROTO_H
61#include "os-proto.h"
62#endif
63
64static int stoi(char *);
65static inline int xdtoi(int);

--- 11 unchanged lines hidden (view full) ---

77extern YYSTYPE yylval;
78
79%}
80
81N ([0-9]+|(0X|0x)[0-9A-Fa-f]+)
82B ([0-9A-Fa-f][0-9A-Fa-f]?)
83W ([0-9A-Fa-f][0-9A-Fa-f]?[0-9A-Fa-f]?[0-9A-Fa-f]?)
84
80%a 15000
81%o 17000
85%a 16000
86%o 19000
82%e 6000
83%k 4000
87%e 6000
88%k 4000
84%p 19000
89%p 25000
85%n 2000
86
87V680 {W}:{W}:{W}:{W}:{W}:{W}:{W}:{W}
88
89V670 ::{W}:{W}:{W}:{W}:{W}:{W}:{W}
90V671 {W}::{W}:{W}:{W}:{W}:{W}:{W}
91V672 {W}:{W}::{W}:{W}:{W}:{W}:{W}
92V673 {W}:{W}:{W}::{W}:{W}:{W}:{W}

--- 69 unchanged lines hidden (view full) ---

162
163V6 ({V680}|{V670}|{V671}|{V672}|{V673}|{V674}|{V675}|{V676}|{V677}|{V660}|{V661}|{V662}|{V663}|{V664}|{V665}|{V666}|{V650}|{V651}|{V652}|{V653}|{V654}|{V655}|{V640}|{V641}|{V642}|{V643}|{V644}|{V630}|{V631}|{V632}|{V633}|{V620}|{V621}|{V622}|{V610}|{V611}|{V600}|{V6604}|{V6504}|{V6514}|{V6524}|{V6534}|{V6544}|{V6554}|{V6404}|{V6414}|{V6424}|{V6434}|{V6444}|{V6304}|{V6314}|{V6324}|{V6334}|{V6204}|{V6214}|{V6224}|{V6104}|{V6114}|{V6004})
164
165%%
166dst return DST;
167src return SRC;
168
169link|ether|ppp|slip return LINK;
90%n 2000
91
92V680 {W}:{W}:{W}:{W}:{W}:{W}:{W}:{W}
93
94V670 ::{W}:{W}:{W}:{W}:{W}:{W}:{W}
95V671 {W}::{W}:{W}:{W}:{W}:{W}:{W}
96V672 {W}:{W}::{W}:{W}:{W}:{W}:{W}
97V673 {W}:{W}:{W}::{W}:{W}:{W}:{W}

--- 69 unchanged lines hidden (view full) ---

167
168V6 ({V680}|{V670}|{V671}|{V672}|{V673}|{V674}|{V675}|{V676}|{V677}|{V660}|{V661}|{V662}|{V663}|{V664}|{V665}|{V666}|{V650}|{V651}|{V652}|{V653}|{V654}|{V655}|{V640}|{V641}|{V642}|{V643}|{V644}|{V630}|{V631}|{V632}|{V633}|{V620}|{V621}|{V622}|{V610}|{V611}|{V600}|{V6604}|{V6504}|{V6514}|{V6524}|{V6534}|{V6544}|{V6554}|{V6404}|{V6414}|{V6424}|{V6434}|{V6444}|{V6304}|{V6314}|{V6324}|{V6334}|{V6204}|{V6214}|{V6224}|{V6104}|{V6114}|{V6004})
169
170%%
171dst return DST;
172src return SRC;
173
174link|ether|ppp|slip return LINK;
170fddi|tr return LINK;
175fddi|tr|wlan return LINK;
171arp return ARP;
172rarp return RARP;
173ip return IP;
174sctp return SCTP;
175tcp return TCP;
176udp return UDP;
177icmp return ICMP;
178igmp return IGMP;

--- 26 unchanged lines hidden (view full) ---

205moprc return MOPRC;
206mopdl return MOPDL;
207
208iso return ISO;
209esis return ESIS;
210es-is return ESIS;
211isis return ISIS;
212is-is return ISIS;
176arp return ARP;
177rarp return RARP;
178ip return IP;
179sctp return SCTP;
180tcp return TCP;
181udp return UDP;
182icmp return ICMP;
183igmp return IGMP;

--- 26 unchanged lines hidden (view full) ---

210moprc return MOPRC;
211mopdl return MOPDL;
212
213iso return ISO;
214esis return ESIS;
215es-is return ESIS;
216isis return ISIS;
217is-is return ISIS;
218l1 return L1;
219l2 return L2;
220iih return IIH;
221lsp return LSP;
222snp return SNP;
223csnp return CSNP;
224psnp return PSNP;
225
213clnp return CLNP;
214
215stp return STP;
216
217ipx return IPX;
218
219netbeui return NETBEUI;
220
221host return HOST;
222net return NET;
226clnp return CLNP;
227
228stp return STP;
229
230ipx return IPX;
231
232netbeui return NETBEUI;
233
234host return HOST;
235net return NET;
223mask return MASK;
236mask return NETMASK;
224port return PORT;
225proto return PROTO;
226protochain {
227#ifdef NO_PROTOCHAIN
228 bpf_error("%s not supported", yytext);
229#else
230 return PROTOCHAIN;
231#endif
232 }
233
234gateway return GATEWAY;
235
236less return LESS;
237greater return GREATER;
237port return PORT;
238proto return PROTO;
239protochain {
240#ifdef NO_PROTOCHAIN
241 bpf_error("%s not supported", yytext);
242#else
243 return PROTOCHAIN;
244#endif
245 }
246
247gateway return GATEWAY;
248
249less return LESS;
250greater return GREATER;
238byte return BYTE;
251byte return CBYTE;
239broadcast return TK_BROADCAST;
240multicast return TK_MULTICAST;
241
242and|"&&" return AND;
243or|"||" return OR;
244not return '!';
245
246len|length return LEN;
247inbound return INBOUND;
248outbound return OUTBOUND;
249
250vlan return VLAN;
251
252broadcast return TK_BROADCAST;
253multicast return TK_MULTICAST;
254
255and|"&&" return AND;
256or|"||" return OR;
257not return '!';
258
259len|length return LEN;
260inbound return INBOUND;
261outbound return OUTBOUND;
262
263vlan return VLAN;
264
252[ \n\t] ;
265lane return LANE;
266llc return LLC;
267metac return METAC;
268bcc return BCC;
269oam return OAM;
270oamf4 return OAMF4;
271oamf4ec return OAMF4EC;
272oamf4sc return OAMF4SC;
273sc return SC;
274ilmic return ILMIC;
275vpi return VPI;
276vci return VCI;
277connectmsg return CONNECTMSG;
278metaconnect return METACONNECT;
279
280on|ifname return PF_IFNAME;
281rset|ruleset return PF_RSET;
282rnr|rulenum return PF_RNR;
283srnr|subrulenum return PF_SRNR;
284reason return PF_REASON;
285action return PF_ACTION;
286
287[ \r\n\t] ;
253[+\-*/:\[\]!<>()&|=] return yytext[0];
254">=" return GEQ;
255"<=" return LEQ;
256"!=" return NEQ;
257"==" return '=';
258"<<" return LSH;
259">>" return RSH;
260${B} { yylval.e = pcap_ether_aton(((char *)yytext)+1);

--- 7 unchanged lines hidden (view full) ---

268#ifdef INET6
269 struct addrinfo hints, *res;
270 memset(&hints, 0, sizeof(hints));
271 hints.ai_family = AF_INET6;
272 hints.ai_flags = AI_NUMERICHOST;
273 if (getaddrinfo(yytext, NULL, &hints, &res))
274 bpf_error("bogus IPv6 address %s", yytext);
275 else {
288[+\-*/:\[\]!<>()&|=] return yytext[0];
289">=" return GEQ;
290"<=" return LEQ;
291"!=" return NEQ;
292"==" return '=';
293"<<" return LSH;
294">>" return RSH;
295${B} { yylval.e = pcap_ether_aton(((char *)yytext)+1);

--- 7 unchanged lines hidden (view full) ---

303#ifdef INET6
304 struct addrinfo hints, *res;
305 memset(&hints, 0, sizeof(hints));
306 hints.ai_family = AF_INET6;
307 hints.ai_flags = AI_NUMERICHOST;
308 if (getaddrinfo(yytext, NULL, &hints, &res))
309 bpf_error("bogus IPv6 address %s", yytext);
310 else {
276 yylval.e = sdup((char *)yytext); return HID6;
311 yylval.s = sdup((char *)yytext); return HID6;
277 }
278#else
279 bpf_error("IPv6 address %s not supported", yytext);
280#endif /*INET6*/
281 }
282{B}:+({B}:+)+ { bpf_error("bogus ethernet address %s", yytext); }
283icmptype { yylval.i = 0; return NUM; }
284icmpcode { yylval.i = 1; return NUM; }

--- 102 unchanged lines hidden ---
312 }
313#else
314 bpf_error("IPv6 address %s not supported", yytext);
315#endif /*INET6*/
316 }
317{B}:+({B}:+)+ { bpf_error("bogus ethernet address %s", yytext); }
318icmptype { yylval.i = 0; return NUM; }
319icmpcode { yylval.i = 1; return NUM; }

--- 102 unchanged lines hidden ---