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 98533 2002-06-21 01:38:14Z fenner $ |
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)"; |
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; |
175sctp return SCTP; |
176tcp return TCP; 177udp return UDP; 178icmp return ICMP; 179igmp return IGMP; 180igrp return IGRP; 181pim return PIM; |
182vrrp return VRRP; |
183 |
184ip6 { 185#ifdef INET6 186 return IPV6; 187#else 188 bpf_error("%s not supported", yytext); 189#endif 190 } 191icmp6 { 192#ifdef INET6 193 return ICMPV6; 194#else 195 bpf_error("%s not supported", yytext); 196#endif 197 } |
198ah return AH; 199esp return ESP; 200 201atalk return ATALK; 202aarp return AARP; 203decnet return DECNET; 204lat return LAT; 205sca return SCA; 206moprc return MOPRC; 207mopdl return MOPDL; 208 209iso return ISO; 210esis return ESIS; 211es-is return ESIS; 212isis return ISIS; 213is-is return ISIS; 214clnp return CLNP; 215 |
216stp return STP; 217 218ipx return IPX; 219 220netbeui return NETBEUI; 221 |
222host return HOST; 223net return NET; 224mask return MASK; 225port return PORT; 226proto return PROTO; 227protochain { 228#ifdef NO_PROTOCHAIN 229 bpf_error("%s not supported", yytext); --- 23 unchanged lines hidden (view full) --- 253[ \n\t] ; 254[+\-*/:\[\]!<>()&|=] return yytext[0]; 255">=" return GEQ; 256"<=" return LEQ; 257"!=" return NEQ; 258"==" return '='; 259"<<" return LSH; 260">>" return RSH; |
261${B} { yylval.e = pcap_ether_aton(((char *)yytext)+1); 262 return AID; } |
263{N} { yylval.i = stoi((char *)yytext); return NUM; } 264({N}\.{N})|({N}\.{N}\.{N})|({N}\.{N}\.{N}\.{N}) { 265 yylval.s = sdup((char *)yytext); return HID; } 266{B}:{B}:{B}:{B}:{B}:{B} { yylval.e = pcap_ether_aton((char *)yytext); 267 return EID; } 268{V6} { 269#ifdef INET6 270 struct addrinfo hints, *res; --- 5 unchanged lines hidden (view full) --- 276 else { 277 yylval.e = sdup((char *)yytext); return HID6; 278 } 279#else 280 bpf_error("IPv6 address %s not supported", yytext); 281#endif /*INET6*/ 282 } 283{B}:+({B}:+)+ { bpf_error("bogus ethernet address %s", yytext); } |
284icmptype { yylval.i = 0; return NUM; } 285icmpcode { yylval.i = 1; return NUM; } 286icmp-echoreply { yylval.i = 0; return NUM; } 287icmp-unreach { yylval.i = 3; return NUM; } 288icmp-sourcequench { yylval.i = 4; return NUM; } 289icmp-redirect { yylval.i = 5; return NUM; } 290icmp-echo { yylval.i = 8; return NUM; } 291icmp-routeradvert { yylval.i = 9; return NUM; } 292icmp-routersolicit { yylval.i = 10; return NUM; } 293icmp-timxceed { yylval.i = 11; return NUM; } 294icmp-paramprob { yylval.i = 12; return NUM; } 295icmp-tstamp { yylval.i = 13; return NUM; } 296icmp-tstampreply { yylval.i = 14; return NUM; } 297icmp-ireq { yylval.i = 15; return NUM; } 298icmp-ireqreply { yylval.i = 16; return NUM; } 299icmp-maskreq { yylval.i = 17; return NUM; } 300icmp-maskreply { yylval.i = 18; return NUM; } 301tcpflags { yylval.i = 13; return NUM; } 302tcp-fin { yylval.i = 0x01; return NUM; } 303tcp-syn { yylval.i = 0x02; return NUM; } 304tcp-rst { yylval.i = 0x04; return NUM; } 305tcp-push { yylval.i = 0x08; return NUM; } 306tcp-ack { yylval.i = 0x10; return NUM; } 307tcp-urg { yylval.i = 0x20; return NUM; } 308[A-Za-z0-9]([-_.A-Za-z0-9]*[.A-Za-z0-9])? { |
309 yylval.s = sdup((char *)yytext); return ID; } 310"\\"[^ !()\n\t]+ { yylval.s = sdup((char *)yytext + 1); return ID; } |
311[^ \[\]\t\n\-_.A-Za-z0-9!<>()&|=]+ { 312 bpf_error("illegal token: %s", yytext); } |
313. { bpf_error("illegal char '%c'", *yytext); } 314%% 315void 316lex_init(buf) 317 char *buf; 318{ 319#ifdef FLEX_SCANNER 320 in_buffer = yy_scan_string(buf); --- 67 unchanged lines hidden --- |