Deleted Added
full compact
grammar.y (56891) grammar.y (75110)
1%{
2/*
3 * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996
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
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/grammar.y 56891 2000-01-30 00:43:38Z fenner $
22 * $FreeBSD: head/contrib/libpcap/grammar.y 75110 2001-04-03 04:32:48Z fenner $
23 */
24#ifndef lint
25static const char rcsid[] =
23 */
24#ifndef lint
25static const char rcsid[] =
26 "@(#) $Header: /tcpdump/master/libpcap/grammar.y,v 1.57 1999/10/19 15:18:30 itojun Exp $ (LBL)";
26 "@(#) $Header: /tcpdump/master/libpcap/grammar.y,v 1.64 2000/10/28 10:18:40 guy Exp $ (LBL)";
27#endif
28
27#endif
28
29#ifdef HAVE_CONFIG_H
30#include "config.h"
31#endif
32
29#include <sys/types.h>
30#include <sys/time.h>
31#include <sys/socket.h>
33#include <sys/types.h>
34#include <sys/time.h>
35#include <sys/socket.h>
36#include <stdlib.h>
32
33#if __STDC__
34struct mbuf;
35struct rtentry;
36#endif
37
38#include <net/if.h>
39
40#include <netinet/in.h>
37
38#if __STDC__
39struct mbuf;
40struct rtentry;
41#endif
42
43#include <net/if.h>
44
45#include <netinet/in.h>
41#include <net/ethernet.h>
42
43#include <stdio.h>
44
45#include "pcap-int.h"
46
47#include "gencode.h"
48#include <pcap-namedb.h>
49
46
47#include <stdio.h>
48
49#include "pcap-int.h"
50
51#include "gencode.h"
52#include <pcap-namedb.h>
53
50#include "gnuc.h"
51#ifdef HAVE_OS_PROTO_H
52#include "os-proto.h"
53#endif
54
55#define QSET(q, p, d, a) (q).proto = (p),\
56 (q).dir = (d),\
57 (q).addr = (a)
58

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

100%type <a> arth narth
101%type <i> byteop pname pnum relop irelop
102%type <blk> and or paren not null prog
103%type <rblk> other
104
105%token DST SRC HOST GATEWAY
106%token NET MASK PORT LESS GREATER PROTO PROTOCHAIN BYTE
107%token ARP RARP IP TCP UDP ICMP IGMP IGRP PIM
54#ifdef HAVE_OS_PROTO_H
55#include "os-proto.h"
56#endif
57
58#define QSET(q, p, d, a) (q).proto = (p),\
59 (q).dir = (d),\
60 (q).addr = (a)
61

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

103%type <a> arth narth
104%type <i> byteop pname pnum relop irelop
105%type <blk> and or paren not null prog
106%type <rblk> other
107
108%token DST SRC HOST GATEWAY
109%token NET MASK PORT LESS GREATER PROTO PROTOCHAIN BYTE
110%token ARP RARP IP TCP UDP ICMP IGMP IGRP PIM
108%token ATALK DECNET LAT SCA MOPRC MOPDL
111%token ATALK AARP DECNET LAT SCA MOPRC MOPDL
109%token TK_BROADCAST TK_MULTICAST
110%token NUM INBOUND OUTBOUND
111%token LINK
112%token GEQ LEQ NEQ
113%token ID EID HID HID6
114%token LSH RSH
115%token LEN
112%token TK_BROADCAST TK_MULTICAST
113%token NUM INBOUND OUTBOUND
114%token LINK
115%token GEQ LEQ NEQ
116%token ID EID HID HID6
117%token LSH RSH
118%token LEN
116%token ISO ESIS ISIS
117%token IPV6 ICMPV6 AH ESP
119%token IPV6 ICMPV6 AH ESP
120%token VLAN
121%token ISO ESIS ISIS CLNP
118
119%type <s> ID
120%type <e> EID
121%type <s> HID HID6
122%type <i> NUM
123
124%left OR AND
125%nonassoc '!'

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

156nid: ID { $$.b = gen_scode($1, $$.q = $<blk>0.q); }
157 | HID '/' NUM { $$.b = gen_mcode($1, NULL, $3,
158 $$.q = $<blk>0.q); }
159 | HID MASK HID { $$.b = gen_mcode($1, $3, 0,
160 $$.q = $<blk>0.q); }
161 | HID {
162 /* Decide how to parse HID based on proto */
163 $$.q = $<blk>0.q;
122
123%type <s> ID
124%type <e> EID
125%type <s> HID HID6
126%type <i> NUM
127
128%left OR AND
129%nonassoc '!'

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

160nid: ID { $$.b = gen_scode($1, $$.q = $<blk>0.q); }
161 | HID '/' NUM { $$.b = gen_mcode($1, NULL, $3,
162 $$.q = $<blk>0.q); }
163 | HID MASK HID { $$.b = gen_mcode($1, $3, 0,
164 $$.q = $<blk>0.q); }
165 | HID {
166 /* Decide how to parse HID based on proto */
167 $$.q = $<blk>0.q;
164 switch ($$.q.proto) {
165 case Q_DECNET:
166 $$.b = gen_ncode($1, 0, $$.q);
167 break;
168 default:
169 $$.b = gen_ncode($1, 0, $$.q);
170 break;
171 }
168 $$.b = gen_ncode($1, 0, $$.q);
172 }
173 | HID6 '/' NUM {
174#ifdef INET6
175 $$.b = gen_mcode6($1, NULL, $3,
176 $$.q = $<blk>0.q);
177#else
178 bpf_error("'ip6addr/prefixlen' not supported "
179 "in this configuration");

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

248 | RARP { $$ = Q_RARP; }
249 | TCP { $$ = Q_TCP; }
250 | UDP { $$ = Q_UDP; }
251 | ICMP { $$ = Q_ICMP; }
252 | IGMP { $$ = Q_IGMP; }
253 | IGRP { $$ = Q_IGRP; }
254 | PIM { $$ = Q_PIM; }
255 | ATALK { $$ = Q_ATALK; }
169 }
170 | HID6 '/' NUM {
171#ifdef INET6
172 $$.b = gen_mcode6($1, NULL, $3,
173 $$.q = $<blk>0.q);
174#else
175 bpf_error("'ip6addr/prefixlen' not supported "
176 "in this configuration");

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

245 | RARP { $$ = Q_RARP; }
246 | TCP { $$ = Q_TCP; }
247 | UDP { $$ = Q_UDP; }
248 | ICMP { $$ = Q_ICMP; }
249 | IGMP { $$ = Q_IGMP; }
250 | IGRP { $$ = Q_IGRP; }
251 | PIM { $$ = Q_PIM; }
252 | ATALK { $$ = Q_ATALK; }
253 | AARP { $$ = Q_AARP; }
256 | DECNET { $$ = Q_DECNET; }
257 | LAT { $$ = Q_LAT; }
258 | SCA { $$ = Q_SCA; }
259 | MOPDL { $$ = Q_MOPDL; }
260 | MOPRC { $$ = Q_MOPRC; }
261 | IPV6 { $$ = Q_IPV6; }
262 | ICMPV6 { $$ = Q_ICMPV6; }
263 | AH { $$ = Q_AH; }
264 | ESP { $$ = Q_ESP; }
265 | ISO { $$ = Q_ISO; }
266 | ESIS { $$ = Q_ESIS; }
267 | ISIS { $$ = Q_ISIS; }
254 | DECNET { $$ = Q_DECNET; }
255 | LAT { $$ = Q_LAT; }
256 | SCA { $$ = Q_SCA; }
257 | MOPDL { $$ = Q_MOPDL; }
258 | MOPRC { $$ = Q_MOPRC; }
259 | IPV6 { $$ = Q_IPV6; }
260 | ICMPV6 { $$ = Q_ICMPV6; }
261 | AH { $$ = Q_AH; }
262 | ESP { $$ = Q_ESP; }
263 | ISO { $$ = Q_ISO; }
264 | ESIS { $$ = Q_ESIS; }
265 | ISIS { $$ = Q_ISIS; }
266 | CLNP { $$ = Q_CLNP; }
268 ;
269other: pqual TK_BROADCAST { $$ = gen_broadcast($1); }
270 | pqual TK_MULTICAST { $$ = gen_multicast($1); }
271 | LESS NUM { $$ = gen_less($2); }
272 | GREATER NUM { $$ = gen_greater($2); }
273 | BYTE NUM byteop NUM { $$ = gen_byteop($3, $2, $4); }
274 | INBOUND { $$ = gen_inbound(0); }
275 | OUTBOUND { $$ = gen_inbound(1); }
267 ;
268other: pqual TK_BROADCAST { $$ = gen_broadcast($1); }
269 | pqual TK_MULTICAST { $$ = gen_multicast($1); }
270 | LESS NUM { $$ = gen_less($2); }
271 | GREATER NUM { $$ = gen_greater($2); }
272 | BYTE NUM byteop NUM { $$ = gen_byteop($3, $2, $4); }
273 | INBOUND { $$ = gen_inbound(0); }
274 | OUTBOUND { $$ = gen_inbound(1); }
275 | VLAN pnum { $$ = gen_vlan($2); }
276 | VLAN { $$ = gen_vlan(-1); }
276 ;
277relop: '>' { $$ = BPF_JGT; }
278 | GEQ { $$ = BPF_JGE; }
279 | '=' { $$ = BPF_JEQ; }
280 ;
281irelop: LEQ { $$ = BPF_JGT; }
282 | '<' { $$ = BPF_JGE; }
283 | NEQ { $$ = BPF_JEQ; }

--- 28 unchanged lines hidden ---
277 ;
278relop: '>' { $$ = BPF_JGT; }
279 | GEQ { $$ = BPF_JGE; }
280 | '=' { $$ = BPF_JEQ; }
281 ;
282irelop: LEQ { $$ = BPF_JGT; }
283 | '<' { $$ = BPF_JGE; }
284 | NEQ { $$ = BPF_JEQ; }

--- 28 unchanged lines hidden ---