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 75110 2001-04-03 04:32:48Z fenner $
23 */
24
25#ifndef lint
26static const char rcsid[] =
27 "@(#) $Header: /tcpdump/master/libpcap/scanner.l,v 1.70 2000/10/28 10:18:40 guy Exp $ (LBL)";
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>
--- 131 unchanged lines hidden (view full) ---
167dst return DST;
168src return SRC;
169
170link|ether|ppp|slip return LINK;
171fddi|tr return LINK;
172arp return ARP;
173rarp return RARP;
174ip return IP;
175tcp return TCP;
176udp return UDP;
177icmp return ICMP;
178igmp return IGMP;
179igrp return IGRP;
180pim return PIM;
181
182ip6 return IPV6;
183icmp6 return ICMPV6;
184ah return AH;
185esp return ESP;
186
187atalk return ATALK;
188aarp return AARP;
189decnet return DECNET;
190lat return LAT;
191sca return SCA;
192moprc return MOPRC;
193mopdl return MOPDL;
194
195iso return ISO;
196esis return ESIS;
197es-is return ESIS;
198isis return ISIS;
199is-is return ISIS;
200clnp return CLNP;
201
202host return HOST;
203net return NET;
204mask return MASK;
205port return PORT;
206proto return PROTO;
207protochain {
208#ifdef NO_PROTOCHAIN
209 bpf_error("%s not supported", yytext);
--- 23 unchanged lines hidden (view full) ---
233[ \n\t] ;
234[+\-*/:\[\]!<>()&|=] return yytext[0];
235">=" return GEQ;
236"<=" return LEQ;
237"!=" return NEQ;
238"==" return '=';
239"<<" return LSH;
240">>" return RSH;
241{N} { yylval.i = stoi((char *)yytext); return NUM; }
242({N}\.{N})|({N}\.{N}\.{N})|({N}\.{N}\.{N}\.{N}) {
243 yylval.s = sdup((char *)yytext); return HID; }
244{B}:{B}:{B}:{B}:{B}:{B} { yylval.e = pcap_ether_aton((char *)yytext);
245 return EID; }
246{V6} {
247#ifdef INET6
248 struct addrinfo hints, *res;
--- 5 unchanged lines hidden (view full) ---
254 else {
255 yylval.e = sdup((char *)yytext); return HID6;
256 }
257#else
258 bpf_error("IPv6 address %s not supported", yytext);
259#endif /*INET6*/
260 }
261{B}:+({B}:+)+ { bpf_error("bogus ethernet address %s", yytext); }
262[A-Za-z0-9][-_.A-Za-z0-9]*[.A-Za-z0-9] {
263 yylval.s = sdup((char *)yytext); return ID; }
264"\\"[^ !()\n\t]+ { yylval.s = sdup((char *)yytext + 1); return ID; }
265[^ \[\]\t\n\-_.A-Za-z0-9!<>()&|=]+i {
266 bpf_error("illegal token: %s\n", yytext); }
267. { bpf_error("illegal char '%c'", *yytext); }
268%%
269void
270lex_init(buf)
271 char *buf;
272{
273#ifdef FLEX_SCANNER
274 in_buffer = yy_scan_string(buf);
--- 67 unchanged lines hidden ---
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 75110 2001-04-03 04:32:48Z fenner $
23 */
24
25#ifndef lint
26static const char rcsid[] =
27 "@(#) $Header: /tcpdump/master/libpcap/scanner.l,v 1.70 2000/10/28 10:18:40 guy Exp $ (LBL)";
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>
--- 131 unchanged lines hidden (view full) ---
167dst return DST;
168src return SRC;
169
170link|ether|ppp|slip return LINK;
171fddi|tr return LINK;
172arp return ARP;
173rarp return RARP;
174ip return IP;
175tcp return TCP;
176udp return UDP;
177icmp return ICMP;
178igmp return IGMP;
179igrp return IGRP;
180pim return PIM;
181
182ip6 return IPV6;
183icmp6 return ICMPV6;
184ah return AH;
185esp return ESP;
186
187atalk return ATALK;
188aarp return AARP;
189decnet return DECNET;
190lat return LAT;
191sca return SCA;
192moprc return MOPRC;
193mopdl return MOPDL;
194
195iso return ISO;
196esis return ESIS;
197es-is return ESIS;
198isis return ISIS;
199is-is return ISIS;
200clnp return CLNP;
201
202host return HOST;
203net return NET;
204mask return MASK;
205port return PORT;
206proto return PROTO;
207protochain {
208#ifdef NO_PROTOCHAIN
209 bpf_error("%s not supported", yytext);
--- 23 unchanged lines hidden (view full) ---
233[ \n\t] ;
234[+\-*/:\[\]!<>()&|=] return yytext[0];
235">=" return GEQ;
236"<=" return LEQ;
237"!=" return NEQ;
238"==" return '=';
239"<<" return LSH;
240">>" return RSH;
241{N} { yylval.i = stoi((char *)yytext); return NUM; }
242({N}\.{N})|({N}\.{N}\.{N})|({N}\.{N}\.{N}\.{N}) {
243 yylval.s = sdup((char *)yytext); return HID; }
244{B}:{B}:{B}:{B}:{B}:{B} { yylval.e = pcap_ether_aton((char *)yytext);
245 return EID; }
246{V6} {
247#ifdef INET6
248 struct addrinfo hints, *res;
--- 5 unchanged lines hidden (view full) ---
254 else {
255 yylval.e = sdup((char *)yytext); return HID6;
256 }
257#else
258 bpf_error("IPv6 address %s not supported", yytext);
259#endif /*INET6*/
260 }
261{B}:+({B}:+)+ { bpf_error("bogus ethernet address %s", yytext); }
262[A-Za-z0-9][-_.A-Za-z0-9]*[.A-Za-z0-9] {
263 yylval.s = sdup((char *)yytext); return ID; }
264"\\"[^ !()\n\t]+ { yylval.s = sdup((char *)yytext + 1); return ID; }
265[^ \[\]\t\n\-_.A-Za-z0-9!<>()&|=]+i {
266 bpf_error("illegal token: %s\n", yytext); }
267. { bpf_error("illegal char '%c'", *yytext); }
268%%
269void
270lex_init(buf)
271 char *buf;
272{
273#ifdef FLEX_SCANNER
274 in_buffer = yy_scan_string(buf);
--- 67 unchanged lines hidden ---